Skip to content

Commit

Permalink
LowPrecArray tests
Browse files Browse the repository at this point in the history
  • Loading branch information
christiangnrd committed Mar 6, 2025
1 parent c557bc8 commit c4ce908
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test/lowprecarrays.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
@testset "lowprecarrays" begin
A = rand(Float32, 10,10)
lpA = LowPrecArray(A)

@test lpA isa LowPrecArray
@test size(A) == size(lpA)

lpA[3] = 4
@test lpA[3] == A[3]

a = rand(Float32)
ab = BFloat16s.ExpandingBFloat16(a)
b = rand(Float32)
bb = BFloat16s.ExpandingBFloat16(b)

@test ab isa BFloat16s.ExpandingBFloat16
@test ab.a isa BFloat16
@test ab * bb isa Float32

B = LowPrecArray(rand(Float32, 10,10))
C = LowPrecArray(rand(Float32, 10,10))

lpA .= B*C

end # @testset "lowprecarrays"
1 change: 1 addition & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -243,5 +243,6 @@ end

include("structure.jl")
include("mathfuncs.jl")
include("lowprecarrays.jl")

end # @testset "BFloat16s"

0 comments on commit c4ce908

Please sign in to comment.