Skip to content

Commit fe84658

Browse files
committed
Add some tests
1 parent 30e7e43 commit fe84658

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test/basictests.jl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ function matmul!!(y, x, z)
2424
return y
2525
end
2626

27+
function get_similar(x)
28+
@bb z = similar(x)
29+
return z
30+
end
31+
2732
@testset "copyto!" begin
2833
x = [1.0, 1.0]
2934
y = [0.0, 0.0]
@@ -88,3 +93,15 @@ end
8893
@test matmul!!(y, x, z) == @SVector[2.0, 2.0]
8994
@test y == @SVector[0.0, 0.0]
9095
end
96+
97+
@testset "similar" begin
98+
x = [1.0, 1.0]
99+
z = get_similar(x)
100+
101+
@test_nowarn z[1]
102+
103+
x = BigFloat[1.0, 1.0]
104+
z = get_similar(x)
105+
106+
@test_nowarn z[1] # Without correct similar this would throw UndefRefError
107+
end

0 commit comments

Comments
 (0)