Skip to content

Commit

Permalink
Slightly better test
Browse files Browse the repository at this point in the history
  • Loading branch information
kmp5VT committed May 20, 2024
1 parent f20a818 commit 9dee2da
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions NDTensors/src/lib/UnallocatedArrays/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ using .NDTensorsTestUtils: devices_list
@testset "Basic funcitonality" begin
z = Zeros{elt}((2, 3))
Z = UnallocatedZeros(z, dev(Matrix{elt}))
Z = UnallocatedZeros{elt}(z, dev(Matrix{elt}))

@test Z isa AbstractFill
@test size(Z) == (2, 3)
Expand All @@ -23,6 +22,8 @@ using .NDTensorsTestUtils: devices_list
@test iszero(norm(Z))
@test iszero(Z[2, 3])
@test allocate(Z) isa dev(Matrix{elt})
Zp = UnallocatedZeros{elt}(Zeros(2, 3), dev(Matrix{elt}))
@test Zp == Z
Zp = set_alloctype(z, dev(Matrix{elt}))
@test Zp == Z
Zc = copy(Z)
Expand All @@ -45,7 +46,6 @@ using .NDTensorsTestUtils: devices_list
# UnallocatedFill
f = Fill{elt}(3, (2, 3, 4))
F = UnallocatedFill(f, Array{elt,ndims(f)})
F = UnallocatedFill{elt}(f, Array{elt,ndims(f)})

@test F isa AbstractFill
@test size(F) == (2, 3, 4)
Expand All @@ -54,6 +54,8 @@ using .NDTensorsTestUtils: devices_list
@test norm(F) sqrt(elt(3)^2 * 24)
@test F[2, 3, 1] == elt(3)
@test allocate(F) isa Array{elt,3}
Fp = UnallocatedFill{elt}(Fill(3, (2, 3, 4)), Array{elt,ndims(f)})
@test Fp == F
Fp = allocate(F)
@test norm(Fp) norm(F)
Fs = similar(F)
Expand Down

0 comments on commit 9dee2da

Please sign in to comment.