Skip to content

Commit 980d492

Browse files
Merge pull request #214 from ChevronETC/wask/more-cso-tests
add more FloatX tests
2 parents 9781c96 + ee67dbe commit 980d492

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

test/devitoprotests.jl

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,34 @@ end
114114
@test eltype(data(f)) == dtype
115115
data(f) .= 1.5f0
116116
@test all(data(f) .== 1.5f0)
117+
118+
# addition
119+
a = dtype(1.5f0)
120+
b = dtype(1.5f0)
121+
@test Base.:+(a,b) dtype(1.5f0 + 1.5f0).value
122+
@test Base.:+(1.5f0,b) dtype(1.5f0 + 1.5f0).value
123+
@test Base.:+(a,1.5f0) dtype(1.5f0 + 1.5f0).value
124+
125+
# subtraction
126+
a = dtype(3.0f0)
127+
b = dtype(1.5f0)
128+
@test Base.:-(a,b) dtype(3.0f0 - 1.5f0).value
129+
@test Base.:-(3.0f0,b) dtype(3.0f0 - 1.5f0).value
130+
@test Base.:-(a,1.5f0) dtype(3.0f0 - 1.5f0).value
131+
132+
# multiplication
133+
a = dtype(1.5f0)
134+
b = dtype(1.5f0)
135+
@test Base.:*(a,b) dtype(1.5f0 * 1.5f0).value
136+
@test Base.:*(1.5f0,b) dtype(1.5f0 * 1.5f0).value
137+
@test Base.:*(a,1.5f0) dtype(1.5f0 * 1.5f0).value
138+
139+
# division
140+
a = dtype(3.0f0)
141+
b = dtype(1.5f0)
142+
@test Base.:/(a,b) dtype(3.0f0 / 1.5f0).value
143+
@test Base.:/(3.0f0,b) dtype(3.0f0 / 1.5f0).value
144+
@test Base.:/(a,1.5f0) dtype(3.0f0 / 1.5f0).value
117145
end
118146

119147
@testset "FloatX eps with $(mytype), $(DT), $(CT)" for mytype [Float32, Float64], (DT, CT) in zip([FloatX8, FloatX16], [UInt8, UInt16])

0 commit comments

Comments
 (0)