Skip to content

Commit 2b51e08

Browse files
committed
Added tests for similar, fill!, any and all
1 parent 2e259a1 commit 2b51e08

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

test/interface_tests.jl

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,29 @@ testa = cat(3, recs...)
4242
recs = [[1, 2, 3], [3 5; 6 7], [8, 9, 10, 11]]
4343
testva = VectorOfArray(recs)
4444
@test size(convert(Array,testva)) == (3,3)
45+
46+
# create similar VectorOfArray
47+
recs = [rand(6) for i = 1:4]
48+
testva = VectorOfArray(recs)
49+
testva2 = similar(testva)
50+
@test typeof(testva2) == typeof(testva)
51+
@test size(testva2) == size(testva)
52+
53+
# Fill AbstractVectorOfArray and check all
54+
testval = 3.0
55+
fill!(testva2, testval)
56+
@test all(x->(x==testval), testva2)
57+
testts = rand(size(testva.u))
58+
testda = DiffEqArray(recursivecopy(testva.u), testts)
59+
fill!(testda, testval)
60+
@test all(x->(x==testval), testda)
61+
62+
# check any
63+
recs = [collect(1:5), collect(6:10), collect(11:15)]
64+
testts = rand(5)
65+
testva = VectorOfArray(recs)
66+
testda = DiffEqArray(recs, testts)
67+
testval1 = 4
68+
testval2 = 17
69+
@test any(x->(x==testval1), testva)
70+
@test !any(x->(x==testval2), testda)

0 commit comments

Comments
 (0)