Skip to content

Commit

Permalink
Deactivate set and multiset tests
Browse files Browse the repository at this point in the history
  • Loading branch information
barche committed Jun 6, 2024
1 parent c863f05 commit b3b1bd8
Show file tree
Hide file tree
Showing 3 changed files with 124 additions and 124 deletions.
4 changes: 2 additions & 2 deletions src/CxxWrap.jl
Original file line number Diff line number Diff line change
Expand Up @@ -940,8 +940,8 @@ ConstCxxPtr, ConstCxxRef, CxxRef, CxxPtr,
CppEnum, ConstArray, CxxBool, CxxLong, CxxULong, CxxChar, CxxChar16, CxxChar32, CxxWchar, CxxUChar, CxxSignedChar,
CxxLongLong, CxxULongLong, ptrunion, gcprotect, gcunprotect, isnull

using .StdLib: StdVector, StdString, StdWString, StdValArray, StdThread, StdDeque, StdQueue, StdSet, StdMultiset
using .StdLib: StdVector, StdString, StdWString, StdValArray, StdThread, StdDeque, StdQueue #, StdSet, StdMultiset

export StdLib, StdVector, StdString, StdWString, StdValArray, StdThread, StdDeque, StdQueue, StdSet, StdMultiset
export StdLib, StdVector, StdString, StdWString, StdValArray, StdThread, StdDeque, StdQueue #, StdSet, StdMultiset

end # module
32 changes: 16 additions & 16 deletions src/StdLib.jl
Original file line number Diff line number Diff line change
Expand Up @@ -209,22 +209,22 @@ Base.push!(v::StdQueue, x) = push_back!(v, x)
Base.first(v::StdQueue) = front(v)
Base.pop!(v::StdQueue) = pop_front!(v)

Base.size(v::StdSet) = (Int(cppsize(v)),)
Base.length(v::StdSet) = Int(cppsize(v))
Base.isempty(v::StdSet) = set_isempty(v)
Base.empty!(v::StdSet) = (set_empty!(v); v)
Base.push!(v::StdSet, x) = (set_insert!(v, x); v)
Base.in(x, v::StdSet) = set_in(v, x)
Base.delete!(v::StdSet, x) = (set_delete!(v, x); v)

Base.size(v::StdMultiset) = (Int(cppsize(v)),)
Base.length(v::StdMultiset) = Int(cppsize(v))
Base.isempty(v::StdMultiset) = multiset_isempty(v)
Base.empty!(v::StdMultiset) = (multiset_empty!(v); v)
Base.push!(v::StdMultiset, x) = (multiset_insert!(v, x); v)
Base.in(x, v::StdMultiset) = multiset_in(v, x)
Base.delete!(v::StdMultiset, x) = (multiset_delete!(v, x); v)
Base.count(x, v::StdMultiset) = multiset_count(v, x)
# Base.size(v::StdSet) = (Int(cppsize(v)),)
# Base.length(v::StdSet) = Int(cppsize(v))
# Base.isempty(v::StdSet) = set_isempty(v)
# Base.empty!(v::StdSet) = (set_empty!(v); v)
# Base.push!(v::StdSet, x) = (set_insert!(v, x); v)
# Base.in(x, v::StdSet) = set_in(v, x)
# Base.delete!(v::StdSet, x) = (set_delete!(v, x); v)

# Base.size(v::StdMultiset) = (Int(cppsize(v)),)
# Base.length(v::StdMultiset) = Int(cppsize(v))
# Base.isempty(v::StdMultiset) = multiset_isempty(v)
# Base.empty!(v::StdMultiset) = (multiset_empty!(v); v)
# Base.push!(v::StdMultiset, x) = (multiset_insert!(v, x); v)
# Base.in(x, v::StdMultiset) = multiset_in(v, x)
# Base.delete!(v::StdMultiset, x) = (multiset_delete!(v, x); v)
# Base.count(x, v::StdMultiset) = multiset_count(v, x)

function Base.fill!(v::T, x) where T <: Union{StdVector, StdValArray, StdDeque}
StdFill(v, x)
Expand Down
212 changes: 106 additions & 106 deletions test/stdlib.jl
Original file line number Diff line number Diff line change
Expand Up @@ -327,112 +327,112 @@ let
@test length(queue) == 1
end

@testset "StdSet" begin
@testset "Set with integers" begin
set = StdSet{Int64}()
@test isempty(set) == true
@test length(set) == 0
set = push!(set, 10)
push!(set, 20)
@test isempty(set) == false
@test length(set) == 2
@test (10 set) == true
@test (20 set) == true
set = delete!(set, 20)
@test length(set) == 1
@test (20 set) == false
@test (30 set) == false
empty!(set)
@test isempty(set) == true
end

@testset "Set with bools" begin
set = StdSet{CxxBool}()
@test isempty(set) == true
@test length(set) == 0
push!(set, true)
push!(set, false)
@test isempty(set) == false
@test length(set) == 2
@test (true set) == true
@test (false set) == true
set = empty!(set)
@test isempty(set) == true
end

@testset "Set with floats" begin
set = StdSet{Float64}()
@test isempty(set) == true
@test length(set) == 0
push!(set, 1.4)
push!(set, 2.2)
@test isempty(set) == false
@test length(set) == 2
@test (1.4 set) == true
@test (10.0 set) == false
@test (2.2 set) == true
empty!(set)
@test isempty(set) == true
end
end

@testset "StdMultiset" begin
@testset "Multiset with integers" begin
multiset = StdMultiset{Int64}()
@test isempty(multiset) == true
@test length(multiset) == 0
multiset = push!(multiset, 10)
push!(multiset, 20)
push!(multiset, 20)
count(20, multiset) == 2
@test isempty(multiset) == false
@test length(multiset) == 3
@test (10 multiset) == true
@test (20 multiset) == true
multiset = delete!(multiset, 20)
@test length(multiset) == 1
@test (20 multiset) == false
@test (30 multiset) == false
empty!(multiset)
@test isempty(multiset) == true
end

@testset "Multiset with bools" begin
multiset = StdMultiset{CxxBool}()
push!(multiset, true)
push!(multiset, true)
push!(multiset, true)
push!(multiset, false)
@test isempty(multiset) == false
@test count(true, multiset) == 3
@test count(false, multiset) == 1
@test length(multiset) == 4
multiset = delete!(multiset, true)
@test length(multiset) == 1
multiset = empty!(multiset)
@test length(multiset) == 0
@test isempty(multiset) == true
end

@testset "Multiset with floats" begin
multiset = StdMultiset{Float64}()
@test isempty(multiset) == true
@test length(multiset) == 0
push!(multiset, 1.4)
push!(multiset, 2.2)
push!(multiset, 2.2)
@test isempty(multiset) == false
@test length(multiset) == 3
@test (1.4 multiset) == true
@test count(1.4, multiset) == 1
@test (10.0 multiset) == false
@test count(10.0, multiset) == 0
@test (2.2 multiset) == true
@test count(2.2, multiset) == 2
empty!(multiset)
@test isempty(multiset) == true
end
end
# @testset "StdSet" begin
# @testset "Set with integers" begin
# set = StdSet{Int64}()
# @test isempty(set) == true
# @test length(set) == 0
# set = push!(set, 10)
# push!(set, 20)
# @test isempty(set) == false
# @test length(set) == 2
# @test (10 ∈ set) == true
# @test (20 ∈ set) == true
# set = delete!(set, 20)
# @test length(set) == 1
# @test (20 ∈ set) == false
# @test (30 ∈ set) == false
# empty!(set)
# @test isempty(set) == true
# end

# @testset "Set with bools" begin
# set = StdSet{CxxBool}()
# @test isempty(set) == true
# @test length(set) == 0
# push!(set, true)
# push!(set, false)
# @test isempty(set) == false
# @test length(set) == 2
# @test (true ∈ set) == true
# @test (false ∈ set) == true
# set = empty!(set)
# @test isempty(set) == true
# end

# @testset "Set with floats" begin
# set = StdSet{Float64}()
# @test isempty(set) == true
# @test length(set) == 0
# push!(set, 1.4)
# push!(set, 2.2)
# @test isempty(set) == false
# @test length(set) == 2
# @test (1.4 ∈ set) == true
# @test (10.0 ∈ set) == false
# @test (2.2 ∈ set) == true
# empty!(set)
# @test isempty(set) == true
# end
# end

# @testset "StdMultiset" begin
# @testset "Multiset with integers" begin
# multiset = StdMultiset{Int64}()
# @test isempty(multiset) == true
# @test length(multiset) == 0
# multiset = push!(multiset, 10)
# push!(multiset, 20)
# push!(multiset, 20)
# count(20, multiset) == 2
# @test isempty(multiset) == false
# @test length(multiset) == 3
# @test (10 ∈ multiset) == true
# @test (20 ∈ multiset) == true
# multiset = delete!(multiset, 20)
# @test length(multiset) == 1
# @test (20 ∈ multiset) == false
# @test (30 ∈ multiset) == false
# empty!(multiset)
# @test isempty(multiset) == true
# end

# @testset "Multiset with bools" begin
# multiset = StdMultiset{CxxBool}()
# push!(multiset, true)
# push!(multiset, true)
# push!(multiset, true)
# push!(multiset, false)
# @test isempty(multiset) == false
# @test count(true, multiset) == 3
# @test count(false, multiset) == 1
# @test length(multiset) == 4
# multiset = delete!(multiset, true)
# @test length(multiset) == 1
# multiset = empty!(multiset)
# @test length(multiset) == 0
# @test isempty(multiset) == true
# end

# @testset "Multiset with floats" begin
# multiset = StdMultiset{Float64}()
# @test isempty(multiset) == true
# @test length(multiset) == 0
# push!(multiset, 1.4)
# push!(multiset, 2.2)
# push!(multiset, 2.2)
# @test isempty(multiset) == false
# @test length(multiset) == 3
# @test (1.4 ∈ multiset) == true
# @test count(1.4, multiset) == 1
# @test (10.0 ∈ multiset) == false
# @test count(10.0, multiset) == 0
# @test (2.2 ∈ multiset) == true
# @test count(2.2, multiset) == 2
# empty!(multiset)
# @test isempty(multiset) == true
# end
# end

@static if isdefined(StdLib, :HAS_RANGES)

Expand Down

0 comments on commit b3b1bd8

Please sign in to comment.