Skip to content

Commit 5679cd6

Browse files
committed
Add unittests for extra utils
1 parent a4763ef commit 5679cd6

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

test/unittests.jl

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,30 @@ end
615615
@test x != xc
616616
end
617617

618+
@testset "Array resizing" begin
619+
qa = QuantityArray([1., 2., 3.], u"m/s")
620+
621+
@test size(qa) == (3,)
622+
@test size(empty(qa)) == (0,)
623+
@test typeof(empty(qa)) == typeof(qa)
624+
625+
push!(qa, 4.0u"m/s")
626+
627+
@test qa[4] == 4.0u"m/s"
628+
629+
@test size(zero(qa)) == (4,)
630+
@test dimension(zero(qa)) == dimension(qa)
631+
@test dimension(empty(qa)) == dimension(qa)
632+
633+
empty!(qa)
634+
635+
@test size(qa) == (0,)
636+
637+
resize!(qa, 3)
638+
639+
@test size(qa) == (3,)
640+
end
641+
618642
@testset "Utilities" begin
619643
@test fill(u"m/s", 10) == QuantityArray(fill(1.0, 10) .* u"m/s")
620644
@test ndims(fill(u"m/s", ())) == 0

0 commit comments

Comments
 (0)