Skip to content

Commit

Permalink
increase the test coverage slightly
Browse files Browse the repository at this point in the history
  • Loading branch information
mweastwood committed Nov 14, 2017
1 parent c75e839 commit f8c2335
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 15 deletions.
5 changes: 5 additions & 0 deletions test/measures.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

@testset "Measures" begin

@testset "errors" begin
@test repr(CasaCoreMeasuresError("hello")) == "CasaCoreMeasuresError: hello"
end

@testset "sexagesimal" begin
@test sexagesimal("12h34m56.78s") π/12.*(12.+34/60.+56.78/3600)
@test sexagesimal("12h34m56s") π/12.*(12.+34/60.+56./3600)
Expand Down
42 changes: 27 additions & 15 deletions test/tables.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,31 @@
@test repr(table) == "Table: "*path*" (read/write)"
Tables.close(table)

@test_throws CasaCoreTablesError Tables.create(path)
@test_throws CasaCoreTablesError Tables.open("/tmp/does-not-exist.ms")

table = Tables.open("Table: "*path)
@test table.path == path
@test table.status[] === Tables.readonly
@test repr(table) == "Table: "*path*" (read only)"
Tables.close(table)

rm(path, force=true, recursive=true)

# Issue #58
# This will create a temporary table in the user's home directory so only run this test if
# we are running tests from a CI service
if get(ENV, "CI", "false") == "true"
println("Running test for issue #58")
ms1 = Tables.create("~/issue58.ms")
Tables.add_rows!(ms1, 1)
ms1["col"] = [1.0]
Tables.close(ms1)
ms2 = Tables.open("~/issue58.ms")
@test ms2["col"] == [1.0]
Tables.close(ms2)
rm("~/issue58.ms", force=true, recursive=true)
end
end

@testset "basic rows" begin
Expand Down Expand Up @@ -86,6 +110,9 @@
table = Tables.create(path)
Tables.add_rows!(table, 10)

@test_throws CasaCoreTablesError Tables.add_column!(table, "test", Float64, (11,))
@test_throws CasaCoreTablesError Tables.add_column!(table, "test", Float64, (10, 11))

names = ("bools", "ints", "floats", "doubles", "complex", "strings")
types = (Bool, Int32, Float32, Float64, Complex64, String)
types_nostring = types[1:end-1]
Expand Down Expand Up @@ -407,20 +434,5 @@

rm(path, force=true, recursive=true)
end

# Issue #58
# This will create a temporary table in the user's home directory so only run this test if we
# are running tests from a CI service
if get(ENV, "CI", "false") == "true"
println("Running test for issue #58")
ms1 = Tables.create("~/issue58.ms")
Tables.add_rows!(ms1, 1)
ms1["col"] = [1.0]
Tables.close(ms1)
ms2 = Tables.open("~/issue58.ms")
@test ms2["col"] == [1.0]
Tables.close(ms2)
rm("~/issue58.ms", force=true, recursive=true)
end
end

0 comments on commit f8c2335

Please sign in to comment.