Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
barche committed Mar 7, 2024
1 parent 166996c commit 63daec0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/CxxWrap.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ConstCxxPtr, ConstCxxRef, CxxRef, CxxPtr,
CppEnum, ConstArray, CxxBool, CxxLong, CxxULong, CxxChar, CxxChar16, CxxChar32, CxxWchar, CxxUChar, CxxSignedChar,
CxxLongLong, CxxULongLong, ptrunion, gcprotect, gcunprotect, isnull, libcxxwrapversion

const libcxxwrap_version_range = (v"0.12.0", v"0.13")
const libcxxwrap_version_range = (v"0.12.1", v"0.13")

using libcxxwrap_julia_jll # for libcxxwrap_julia and libcxxwrap_julia_stl

Expand Down
12 changes: 11 additions & 1 deletion test/basic_types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,19 @@ end

@testset "$(basename(@__FILE__)[1:end-3])" begin

function compare_collections(a, b)
equalities = a .== b
result = all(equalities)
if !result
neqs = (!).(equalities)
println("collections differ: $(a[neqs])$(b[neqs])")
end
return result
end

let funcs = CxxWrap.CxxWrapCore.get_module_functions(CxxWrap.StdLib)
@test CxxWrap.StdLib.__cxxwrap_methodkeys[1] == CxxWrap.CxxWrapCore.methodkey(funcs[1])
@test all(CxxWrap.StdLib.__cxxwrap_methodkeys .== CxxWrap.CxxWrapCore.methodkey.(funcs))
@test compare_collections(CxxWrap.StdLib.__cxxwrap_methodkeys, CxxWrap.CxxWrapCore.methodkey.(funcs))
end

let a = BasicTypes.A(2,3)
Expand Down
6 changes: 5 additions & 1 deletion test/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,11 @@ empty!(warr1)

@test bench_greet() == 1000*length(CppTypes.greet(CppTypes.World()))
_, _, _, _, memallocs = @timed bench_greet()
@test 0 < memallocs.poolalloc < 100
@show memallocs.poolalloc
@test 0 < memallocs.poolalloc < 400 # Jumped from +/- 6 to 360 in Julia 1.12
if memallocs.poolalloc > 100
@warn "Abnormally high number of allocations: $(memallocs.poolalloc)"
end

if isdefined(CppTypes, :IntDerived)
Base.promote_rule(::Type{<:CppTypes.IntDerived}, ::Type{<:Number}) = Int
Expand Down

0 comments on commit 63daec0

Please sign in to comment.