Skip to content

Commit f93ee9b

Browse files
committed
more tests. comments
1 parent 4d9bfa9 commit f93ee9b

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

test/func.jl

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,26 +105,28 @@ end
105105

106106
A = Diagonal(p * t)
107107

108+
# test that output isn't accidentally mutated by passing an internal cache.
109+
108110
u1 = rand(N, K)
109111
u2 = rand(N, K)
110112

111-
v1 = L * u1
112-
v2 = L * u2
113+
v1 = L * u1; @test v1 A * u1
114+
v2 = L * u2; @test v2 A * u2; @test v1 A * u1
113115
@test v1 + v2 A * (u1 + u2)
114116

115117
v1 .= 0.0
116118
v2 .= 0.0
117119

118-
mul!(v1, L, u1)
119-
mul!(v2, L, u2)
120+
mul!(v1, L, u1); @test v1 A * u1
121+
mul!(v2, L, u2); @test v2 A * u2; @test v1 A * u1
120122
@test v1 + v2 A * (u1 + u2)
121123

122124
v1 = rand(N, K); w1 = copy(v1)
123125
v2 = rand(N, K); w2 = copy(v2)
124126
a1, a2, b1, b2 = rand(4)
125127

126-
mul!(v1, L, u1, a1, b1)
127-
mul!(v2, L, u2, a2, b2)
128+
mul!(v1, L, u1, a1, b1); @test v1 a1*A*u1 + b1*w1
129+
mul!(v2, L, u2, a2, b2); @test v2 a2*A*u2 + b2*w2; @test v1 a1*A*u1 + b1*w1
128130
@test v1 + v2 (a1*A*u1 + b1*w1) + (a2*A*u2 + b2*w2)
129131
end
130132
#

0 commit comments

Comments
 (0)