Skip to content

Commit c4ce908

Browse files
committed
LowPrecArray tests
1 parent c557bc8 commit c4ce908

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

test/lowprecarrays.jl

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
@testset "lowprecarrays" begin
2+
A = rand(Float32, 10,10)
3+
lpA = LowPrecArray(A)
4+
5+
@test lpA isa LowPrecArray
6+
@test size(A) == size(lpA)
7+
8+
lpA[3] = 4
9+
@test lpA[3] == A[3]
10+
11+
a = rand(Float32)
12+
ab = BFloat16s.ExpandingBFloat16(a)
13+
b = rand(Float32)
14+
bb = BFloat16s.ExpandingBFloat16(b)
15+
16+
@test ab isa BFloat16s.ExpandingBFloat16
17+
@test ab.a isa BFloat16
18+
@test ab * bb isa Float32
19+
20+
B = LowPrecArray(rand(Float32, 10,10))
21+
C = LowPrecArray(rand(Float32, 10,10))
22+
23+
lpA .= B*C
24+
25+
end # @testset "lowprecarrays"

test/runtests.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,5 +243,6 @@ end
243243

244244
include("structure.jl")
245245
include("mathfuncs.jl")
246+
include("lowprecarrays.jl")
246247

247248
end # @testset "BFloat16s"

0 commit comments

Comments
 (0)