Skip to content

Commit

Permalink
Merge pull request #148 from fingolfin/mh/cov
Browse files Browse the repository at this point in the history
Add test for LibGAP.jl, fix bug in Base.string method
  • Loading branch information
sebasguts authored Nov 12, 2018
2 parents 7fa8432 + 575ac79 commit 62f2751
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 6 deletions.
8 changes: 3 additions & 5 deletions .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ comment:
behavior: default

ignore:
- "PackageInfo.g"
- "init.g"
- "read.g"
- "tst/*" # ignore test harness code
- "tst/**/*" # ignore test harness code
- "*/PackageInfo.g"
- "*/tst/*" # ignore test harness code
- "*/tst/**/*" # ignore test harness code
2 changes: 1 addition & 1 deletion LibGAP.jl/src/gap.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function Base.show( io::IO, obj::Union{MPtr,GAP.GapFFE} )
end

function Base.string( obj::Union{MPtr,GAP.GapFFE} )
str = GAP.String( obj )
str = GAP.Globals.String( obj )
return CSTR_STRING( str )
end

Expand Down
29 changes: 29 additions & 0 deletions LibGAP.jl/test/basics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

@test l[1] == 1
@test l[end] == 3
@test firstindex(l) == 1
@test lastindex(l) == 3

@test Symbol("Print") in propertynames(GAP.Globals,false)

Expand All @@ -19,4 +21,31 @@

xx = GAP.to_gap([1,2,3])
@test_throws ErrorException xx[4]

@test_throws ErrorException GAP.Globals.FOOBARQUX

str = GAP.from_gap(GAP.ValueGlobalVariable("IdentifierLetters"), AbstractString);
@test str == "0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz"

@test string(GAP.Globals) == "\"table of global GAP objects\""

@test string(GAP.to_gap("x")) == "x"
end

@testset "gapcalls" begin
f = GAP.EvalString("{x...} -> x;")[1][2]

@test GAP.to_gap([]) == f()
@test GAP.to_gap([1]) == f(1)
@test GAP.to_gap([1,2]) == f(1,2)
@test GAP.to_gap([1,2,3]) == f(1,2,3)
@test GAP.to_gap([1,2,3,4]) == f(1,2,3,4)
@test GAP.to_gap([1,2,3,4,5]) == f(1,2,3,4,5)
@test GAP.to_gap([1,2,3,4,5,6]) == f(1,2,3,4,5,6)
@test GAP.to_gap([1,2,3,4,5,6,7]) == f(1,2,3,4,5,6,7)

# check to see if a non-basic object (here: a tuple) can be
# passed and then extracted again
@test f( (1,2,3) )[1] == (1,2,3)

end
1 change: 1 addition & 0 deletions LibGAP.jl/test/conversion.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
x = GAP.EvalString("[1,2,3];")[1][2]
@test GAP.to_gap([1,2,3]) == x

@test GAP.to_gap(:x) == GAP.to_gap("x")
end

@testset "conversion from GAP" begin
Expand Down

0 comments on commit 62f2751

Please sign in to comment.