Skip to content

Commit

Permalink
Add more unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottPJones committed Jan 30, 2017
1 parent 26aace5 commit 4964739
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,26 @@ const testfile = joinpath(Pkg.dir("StrTables"), "test", "test.dat")
ST.save(testfile, testout)
@test ST.load(testfile) == testout
end
@testset "PackedTable" begin
teststrs = [b"AA", b"AAAAA", b"Alex", b"David", b"Gandalf",
b"Jules", b"Julia", b"JuliaDB", b"JuliaIO", b"JuliaLang", b"JuliaString",
b"Scott", b"Zulima", b"\U1f596 Spock Hands"]
stab = PackedTable(teststrs)

@test length(stab) == length(teststrs)
@test stab == teststrs
@test stab[1] == b"AA"
@test stab[end] == b"\U1f596 Spock Hands"
@test ST.matchfirstrng(stab, b"A") == 1:3
@test ST.matchfirstrng(stab, b"Julia") == 7:11
@test ST.matchfirst(stab, b"A") == [b"AA", b"AAAAA", b"Alex"]
@test ST.matchfirst(stab, b"Julia") ==
[b"Julia", b"JuliaDB", b"JuliaIO", b"JuliaLang", b"JuliaString"]
testout = [stab, 0x1, 2%UInt16, 3%UInt32, 4%UInt64,
5%Int8, 6%Int16, 7%Int32, 8%Int64,
Float32(9.87654321), 1.23456789,
"New test",
"\U1f595"]
# ST.save(testfile, testout)
# @test ST.load(testfile) == testout
end

0 comments on commit 4964739

Please sign in to comment.