Skip to content

Commit df19477

Browse files
gostevehowardandyferris
authored andcommitted
add simple unit tests for SizedArray inner constructors
Per request on PR #151. I'm not familiar with this codebase so this may not be the ideal unit test or the ideal location, but I've tried to follow local convention.
1 parent bc93479 commit df19477

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

test/SizedArray.jl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
@testset "SizedArray" begin
2+
@testset "Inner Constructors" begin
3+
@test SizedArray{Tuple{2}, Int, 1}([3, 4]).data == [3, 4]
4+
@test SizedArray{Tuple{2, 2}, Int, 2}(collect(3:6)).data == collect(3:6)
5+
@test size(SizedArray{Tuple{4, 5}, Int, 2}().data) == (4, 5)
6+
@test size(SizedArray{Tuple{4, 5}, Int}().data) == (4, 5)
7+
8+
# Bad input
9+
@test_throws Exception SArray{Tuple{1},Int,1}([2 3])
10+
11+
# Bad parameters
12+
@test_throws Exception SizedArray{Tuple{1},Int,2}()
13+
@test_throws Exception SArray{Tuple{3, 4},Int,1}()
14+
end
15+
end

test/runtests.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ using Base.Test
1111
include("FieldVector.jl")
1212
include("Scalar.jl")
1313
include("SUnitRange.jl")
14+
include("SizedArray.jl")
1415
include("custom_types.jl")
1516

1617
include("core.jl")

0 commit comments

Comments
 (0)