Skip to content

Commit 4e7eec8

Browse files
committed
Yet more tests for macros
1 parent 0ead7cd commit 4e7eec8

File tree

4 files changed

+7
-0
lines changed

4 files changed

+7
-0
lines changed

test/MArray.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@
4444
@test (ex = macroexpand(:(@MArray Float64[1 2; 3])); isa(ex, Expr) && ex.head == :error)
4545
@test (ex = macroexpand(:(@MArray fill)); isa(ex, Expr) && ex.head == :error)
4646
@test (ex = macroexpand(:(@MArray ones)); isa(ex, Expr) && ex.head == :error)
47+
@test (ex = macroexpand(:(@MArray fill())); isa(ex, Expr) && ex.head == :error)
48+
@test (ex = macroexpand(:(@MArray ones())); isa(ex, Expr) && ex.head == :error)
4749
@test (ex = macroexpand(:(@MArray fill(1))); isa(ex, Expr) && ex.head == :error)
4850
@test (ex = macroexpand(:(@MArray eye(5,6,7,8,9))); isa(ex, Expr) && ex.head == :error)
4951

test/MMatrix.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
@test ((@MMatrix Float64[i*j for i = 1:2, j=2:3])::MMatrix{2,2}).data === (2.0, 4.0, 3.0, 6.0)
4141

4242
@test (ex = macroexpand(:(@MMatrix [1 2; 3])); isa(ex, Expr) && ex.head == :error)
43+
@test (ex = macroexpand(:(@MMatrix Float32[1 2; 3])); isa(ex, Expr) && ex.head == :error)
4344
@test (ex = macroexpand(:(@MMatrix [i*j*k for i = 1:2, j=2:3, k=3:4])); isa(ex, Expr) && ex.head == :error)
4445
@test (ex = macroexpand(:(@MMatrix Float32[i*j*k for i = 1:2, j=2:3, k=3:4])); isa(ex, Expr) && ex.head == :error)
4546
@test (ex = macroexpand(:(@MMatrix fill(2.3, 4, 5, 6))); isa(ex, Expr) && ex.head == :error)

test/SArray.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
@test (ex = macroexpand(:(@SArray Float64[1 2; 3])); isa(ex, Expr) && ex.head == :error)
4343
@test (ex = macroexpand(:(@SArray ones)); isa(ex, Expr) && ex.head == :error)
4444
@test (ex = macroexpand(:(@SArray fill)); isa(ex, Expr) && ex.head == :error)
45+
@test (ex = macroexpand(:(@SArray ones())); isa(ex, Expr) && ex.head == :error)
46+
@test (ex = macroexpand(:(@SArray fill())); isa(ex, Expr) && ex.head == :error)
4547
@test (ex = macroexpand(:(@SArray fill(1))); isa(ex, Expr) && ex.head == :error)
4648
@test (ex = macroexpand(:(@SArray eye(5,6,7,8,9))); isa(ex, Expr) && ex.head == :error)
4749

test/SMatrix.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,14 @@
3838
@test ((@SMatrix [i*j for i = 1:2, j=2:3])::SMatrix{2,2}).data === (2, 4, 3, 6)
3939
@test ((@SMatrix Float64[i*j for i = 1:2, j=2:3])::SMatrix{2,2}).data === (2.0, 4.0, 3.0, 6.0)
4040
@test (ex = macroexpand(:(@SMatrix [1 2; 3])); isa(ex, Expr) && ex.head == :error)
41+
@test (ex = macroexpand(:(@SMatrix Float64[1 2; 3])); isa(ex, Expr) && ex.head == :error)
4142
@test (ex = macroexpand(:(@SMatrix [i*j*k for i = 1:2, j=2:3, k=3:4])); isa(ex, Expr) && ex.head == :error)
4243
@test (ex = macroexpand(:(@SMatrix Float64[i*j*k for i = 1:2, j=2:3, k=3:4])); isa(ex, Expr) && ex.head == :error)
4344
@test (ex = macroexpand(:(@SMatrix fill(1.5, 2, 3, 4))); isa(ex, Expr) && ex.head == :error)
4445
@test (ex = macroexpand(:(@SMatrix ones(2, 3, 4, 5))); isa(ex, Expr) && ex.head == :error)
4546
@test (ex = macroexpand(:(@SMatrix eye(2, 3, 4, 5))); isa(ex, Expr) && ex.head == :error)
4647

48+
@test ((@SMatrix fill(1.3, 2,2))::SMatrix{2, 2, Float64}).data === (1.3, 1.3, 1.3, 1.3)
4749
@test ((@SMatrix zeros(2,2))::SMatrix{2, 2, Float64}).data === (0.0, 0.0, 0.0, 0.0)
4850
@test ((@SMatrix ones(2,2))::SMatrix{2, 2, Float64}).data === (1.0, 1.0, 1.0, 1.0)
4951
@test ((@SMatrix eye(2))::SMatrix{2, 2, Float64}).data === (1.0, 0.0, 0.0, 1.0)

0 commit comments

Comments
 (0)