-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathadapter.jl
61 lines (53 loc) · 1.44 KB
/
adapter.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
@testset "iteration" begin
l = GAP.evalstr("[1, 2, 3]")
lj = collect(l)
@test lj isa Vector{Any}
@test lj == [1, 2, 3]
lj = collect(Int, l)
@test lj isa Vector{Int}
@test lj == [1, 2, 3]
s = GAP.Globals.SymmetricGroup(3)
xs = []
for x in s
push!(xs, x)
end
@test length(xs) == 6
end
@testset "deepcopy" begin
p = GAP.evalstr("(1,2,3)")
@test copy(p) === p
l = GAP.evalstr("[[]]")
@test !(copy(l) === l)
@test copy(l)[1] === l[1]
@test !(deepcopy(l)[1] === l[1])
l = [p, p]
cp = deepcopy(l)
@test !(l === cp)
@test cp[1] === cp[2]
# The following is NOT what we want,
# eventually we want that `deepcopy` to be applied
# also to Julia subobjects of GAP objects.
# As soon as this changed behaviour is available,
# `deepcopy` for GAP objects should become documented.
l = GAP.evalstr("[]")
li = [1, 2, 3]
l[1] = li
cp = deepcopy(l)
@test !(deepcopy( li ) === li)
@test cp[1] === l[1]
end
@testset "GapObj" begin
io = IOBuffer();
print(io, GAP.GapObj)
@test String(take!(io)) == "GapObj"
L = [ GAP.evalstr( "()" ) ]
print(io, L)
@test String(take!(io)) == "GapObj[GAP: ()]"
ioc = IOContext(io, :module => nothing);
print(ioc, GAP.GapObj)
if GAP.use_jl_reinit_foreign_type()
@test String(take!(io)) == "GAP.GapObj"
else
@test String(take!(io)) == "GAP_jll.GapObj"
end
end