Skip to content

Commit

Permalink
new tests
Browse files Browse the repository at this point in the history
  • Loading branch information
martinheida authored Sep 12, 2024
1 parent 01c8d3b commit 5d0fdc0
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 12 deletions.
1 change: 1 addition & 0 deletions test/basics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
vd2d = VoronoiData(vg2c)
@test abs(sum( abs, vd2d.volume .- map(x->x[1],vd2d.bulk_integral)))<1.0E-1
HighVoronoi.vp_print(HighVoronoi.Raycast(VoronoiNodes(rand(2,10))),mirrors=true)

end

@testset "improving" begin
Expand Down
12 changes: 1 addition & 11 deletions test/fraud.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#HighVoronoi._nn(btree,zeros(Float64,5))
#HighVoronoi._inrange(btree,zeros(Float64,5),0.1)
#println("-------- 3 ---------------------------------------------------")
vg = VoronoiGeometry(xs,integrate=false,silence=global_silence)
vg = VoronoiGeometry(xs,cuboid(5,periodic=[]),integrate=false,silence=global_silence)
vd = VoronoiData(vg)
values(vd.boundary_nodes)
vd2 = VoronoiData(vg,copyall=true)
Expand All @@ -36,16 +36,6 @@
end
@test test_2000()
@test test_fraud()
function test_VoronoiData()
vg = VoronoiGeometry(VoronoiNodes(rand(3,100)),integrate=false,silence=global_silence)
vd = VoronoiData(vg)
values(vd.boundary_nodes)
vd2 = VoronoiData(vg,copyall=true)
return true
end
# @test test_fast_poly()
@test test_VoronoiData()

end


26 changes: 25 additions & 1 deletion test/jld.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,31 @@
mysum = abs.(vd1.volume-vd2.volume)
return sum(mysum)<0.00001
end
@test test_write()
function test_jld(db)
vg = VoronoiGeometry(xs,cuboid(5,periodic=[1]),vertex_storage=db,search_settings=(method=RCOriginal,),integrate=true,integrator=VI_FAST_POLYGON,integrand=x->[x[1]],silence=false)
println("Step 1")
jldopen("geometry5d.jld2","w") do file
file["geo"] = vg
end
println("Step 2")
b = false
jldopen("geometry5d.jld2","r") do file
try
vg2 = file["geo"]
b = HighVoronoi.compare(HighVoronoi.mesh(vg.domain),HighVoronoi.mesh(vg.domain))
catch e
open("error_open_log.txt", "w") do f
# Stacktrace speichern
Base.showerror(f, e, catch_backtrace())
end
end
end
return b
end
@test test_write()
@test test_jld(DatabaseVertexStorage())
@test test_jld(ReferencedVertexStorage())
@test test_jld(ClassicVertexStorage())

end

Expand Down
6 changes: 6 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
using Test
using Revise
using HighVoronoi

using SpecialFunctions
using LinearAlgebra
using SparseArrays
using StaticArrays
using JLD2


const global_silence = false
Expand All @@ -13,9 +15,13 @@ const global_silence = false
@testset "HighVoronoi.jl" begin
@testset "various" begin
@test HighVoronoi.testboundary()
@test HighVoronoi.test_EdgeHashTable()
@test HighVoronoi.test_VertexHashTable()
@test HighVoronoi.test_queuehashing()
end
include("tools.jl")
include("basics.jl")
include("voronoidata.jl")
include("statistics.jl")
include("fraud.jl")
include("periodicgrids.jl")
Expand Down
2 changes: 2 additions & 0 deletions test/tools.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@

tft2 = HighVoronoi.group_last(test_tuple,Int,mycollectlast,StaticArrays.Size(2))
tft4 = HighVoronoi.cut_off_last(test_tuple,Int,mycollectlast)
tft4 = HighVoronoi.cut_off_first(test_tuple,Int)
HighVoronoi.remove_first_entry(test_tuple)
HighVoronoi.split_tuple_at_A_sequence(("a",1,2,3,"b"),Int64)
# Return the value of the last entry of the new tuple
#return transformed_tuple[end]==[4,6,8] && tft2[end]==[6,8]
return tft2[end]==[6,8]
Expand Down
34 changes: 34 additions & 0 deletions test/voronoidata.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@


@testset "VoronoiData" begin
function test_VoronoiData()
vg = VoronoiGeometry(VoronoiNodes(rand(3,100)),cuboid(3,periodic=[1]),integrate=true,silence=global_silence,integrand=x->[x[1]],integrator=VI_POLYGON)
vd = VoronoiData(vg)
values(vd.boundary_nodes)
for a in vd.boundary_vertices
break
end

vg2 = VoronoiGeometry(VoronoiNodes(rand(3,100)),cuboid(3,periodic=[1]),integrate=true,silence=global_silence,integrand=x->[x[1]],integrator=VI_POLYGON)
vd2 = VoronoiData(vg2,copyall=true)
vd3 = VoronoiData(vg2,copyall=true,sorted=true)
deepcopy(vd.nodes)
deepcopy(vd.vertices)
deepcopy(vd.boundary_nodes)
deepcopy(vd.boundary_vertices)
deepcopy(vd.neighbors)
deepcopy(vd.orientations)
deepcopy(vd.volume)
deepcopy(vd.area)
deepcopy(vd.bulk_integral)
deepcopy(vd.interface_integral)
deepcopy(vd.references)
deepcopy(vd.reference_shifts)
return true
end
# @test test_fast_poly()
@test test_VoronoiData()

end


0 comments on commit 5d0fdc0

Please sign in to comment.