-
Notifications
You must be signed in to change notification settings - Fork 17
/
lists.jl
25 lines (21 loc) · 851 Bytes
/
lists.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
@testset "Polymake.StdList" begin
@testset "Constructors" begin
l = Polymake.StdList{Polymake.StdPair{CxxWrap.CxxLong, CxxWrap.CxxLong}}()
@test l isa Polymake.StdList
k = Polymake.StdList{Polymake.StdPair{CxxWrap.CxxLong, CxxWrap.CxxLong}}(l)
@test k isa Polymake.StdList
end
@testset "List operations" begin
l = Polymake.StdList{Polymake.StdPair{CxxWrap.CxxLong, CxxWrap.CxxLong}}()
p = Polymake.StdPair{CxxWrap.CxxLong, CxxWrap.CxxLong}(4,2)
push!(l,p)
@test Polymake.length(l) == 1;
q = Polymake.StdPair{CxxWrap.CxxLong, CxxWrap.CxxLong}(1,2)
Polymake.pushfirst!(l, q)
a = collect(l)
@test a[1] == (1=>2)
@test a[2] == (4=>2)
Polymake.empty!(l)
@test Polymake.isempty(l) == true;
end
end