Skip to content

Commit

Permalink
test(matrices): refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
AnzhiZhang committed Aug 7, 2024
1 parent cbc329f commit 84cc105
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
12 changes: 6 additions & 6 deletions test/matrices/binomial.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
# content
@test Binomial(5) [1 4 6 4 1; 1 2 0 -2 -1; 1 0 -2 0 1; 1 -2 0 2 -1; 1 -4 6 -4 1]

# eltype
@test test_matrix_elements(Binomial{Int32}(5))

# constructors
@test allequal([
Binomial(5),
Expand All @@ -12,3 +6,9 @@

# linear algebra functions
test_linearalgrbra_functions(Binomial.(1:5))

# eltype
@test test_matrix_elements(Binomial{Int32}(5))

# content
@test Binomial(5) [1 4 6 4 1; 1 2 0 -2 -1; 1 0 -2 0 1; 1 -2 0 2 -1; 1 -4 6 -4 1]
12 changes: 6 additions & 6 deletions test/matrices/cauchy.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
# content
@test Cauchy(5) [0.5 0.3333333333333333 0.25 0.2 0.16666666666666666; 0.3333333333333333 0.25 0.2 0.16666666666666666 0.14285714285714285; 0.25 0.2 0.16666666666666666 0.14285714285714285 0.125; 0.2 0.16666666666666666 0.14285714285714285 0.125 0.1111111111111111; 0.16666666666666666 0.14285714285714285 0.125 0.1111111111111111 0.1]

# eltype
@test test_matrix_elements(Cauchy{Float32}(5))

# constructors
@test allequal([
Cauchy(5),
Expand All @@ -19,3 +13,9 @@

# linear algebra functions
test_linearalgrbra_functions(Cauchy{Float64}.(1:5))

# eltype
@test test_matrix_elements(Cauchy{Float32}(5))

# content
@test Cauchy(5) [0.5 0.3333333333333333 0.25 0.2 0.16666666666666666; 0.3333333333333333 0.25 0.2 0.16666666666666666 0.14285714285714285; 0.25 0.2 0.16666666666666666 0.14285714285714285 0.125; 0.2 0.16666666666666666 0.14285714285714285 0.125 0.1111111111111111; 0.16666666666666666 0.14285714285714285 0.125 0.1111111111111111 0.1]
14 changes: 7 additions & 7 deletions test/matrices/chebspec.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
# content
@test ChebSpec(5) [5.5 -6.828427124746192 2.0000000000000004 -1.17157287525381 0.5; 1.707106781186548 -0.7071067811865477 -1.4142135623730951 0.7071067811865476 -0.2928932188134525; -0.5000000000000001 1.4142135623730951 -3.061616997868383e-17 -1.414213562373095 0.5; 0.2928932188134525 -0.7071067811865476 1.414213562373095 0.7071067811865474 -1.7071067811865472; -0.5 1.17157287525381 -2.0 6.828427124746189 -5.5]
@test ChebSpec(5, 1) [-1.170820393249937 -2.0 0.8944271909999159 -0.6180339887498948 0.276393202250021; 2.0 -0.17082039324993692 -1.618033988749895 0.8944271909999159 -0.38196601125010515; -0.8944271909999159 1.618033988749895 0.17082039324993686 -2.0 0.7236067977499789; 0.6180339887498948 -0.8944271909999159 2.0 1.1708203932499364 -2.6180339887498936; -1.105572809000084 1.5278640450004206 -2.8944271909999157 10.472135954999574 -8.5]

# eltype
@test test_matrix_elements(ChebSpec{Float32}(5))

# constructors
@test allequal([
ChebSpec(5),
Expand All @@ -15,3 +8,10 @@

# linear algebra functions
test_linearalgrbra_functions(ChebSpec.(1:5))

# eltype
@test test_matrix_elements(ChebSpec{Float32}(5))

# content
@test ChebSpec(5) [5.5 -6.828427124746192 2.0000000000000004 -1.17157287525381 0.5; 1.707106781186548 -0.7071067811865477 -1.4142135623730951 0.7071067811865476 -0.2928932188134525; -0.5000000000000001 1.4142135623730951 -3.061616997868383e-17 -1.414213562373095 0.5; 0.2928932188134525 -0.7071067811865476 1.414213562373095 0.7071067811865474 -1.7071067811865472; -0.5 1.17157287525381 -2.0 6.828427124746189 -5.5]
@test ChebSpec(5, 1) [-1.170820393249937 -2.0 0.8944271909999159 -0.6180339887498948 0.276393202250021; 2.0 -0.17082039324993692 -1.618033988749895 0.8944271909999159 -0.38196601125010515; -0.8944271909999159 1.618033988749895 0.17082039324993686 -2.0 0.7236067977499789; 0.6180339887498948 -0.8944271909999159 2.0 1.1708203932499364 -2.6180339887498936; -1.105572809000084 1.5278640450004206 -2.8944271909999157 10.472135954999574 -8.5]

0 comments on commit 84cc105

Please sign in to comment.