Skip to content

Commit

Permalink
Fix occasionally broken test
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielVandH committed Jul 8, 2024
1 parent 1bc0fd3 commit cea95ca
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ concurrency:
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} - ExactPredicates ${{ matrix.preferences }}
name: Julia ${{ matrix.version }} - ${{ matrix.arch }} - ${{ github.event_name }} - ExactPredicates ${{ matrix.preferences }} - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
env:
JULIA_NUM_THREADS: ${{ matrix.julia-threads }}
Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function safe_include(filename; name=filename, push=true, verbose = true) # Work
push && push!(ALL_TEST_SCRIPTS, normpath(filename))
mod = @eval module $(gensym()) end
@info "[$(ct())] Testing $name"
@testset verbose = verbose "$name" begin
@testset verbose = verbose "$(basename(name))" begin
@eval mod using ..HelperFunctions
@eval mod using ..Test
Base.include(mod, filename)
Expand Down
24 changes: 13 additions & 11 deletions test/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1224,17 +1224,19 @@ end
end

@testset "replace_(boundary/ghost)_triangle_with_(ghost/boundary)_triangle" begin
tri = triangulate(rand(2, 5000), delete_ghosts=false)
_tri = triangulate_rectangle(0.0, 1.0, 0.0, 1.0, 25, 25, delete_ghosts=false)
for tri in (tri, _tri)
for T in each_ghost_triangle(tri)
T = DT.sort_triangle(T)
i, j, k = triangle_vertices(T)
w = get_adjacent(tri, j, i)
V = (j, i, w)
@test DT.replace_boundary_triangle_with_ghost_triangle(tri, V) == T
@test DT.replace_ghost_triangle_with_boundary_triangle(tri, T) == V
if (i, j) ((624, 625), (1, 26), (2, 1), (625, 600)) # corners of the lattice have two associated ghosts
for _ in 1:10
tri = triangulate(rand(2, 5000), delete_ghosts=false)
_tri = triangulate_rectangle(0.0, 1.0, 0.0, 1.0, 25, 25, delete_ghosts=false)
for tri in (tri, _tri)
for T in each_ghost_triangle(tri)
T = DT.sort_triangle(T)
i, j, k = triangle_vertices(T)
w = get_adjacent(tri, j, i)
V = (j, i, w)
kr = count(e -> DT.is_boundary_edge(tri, e...), DT.triangle_edges(V))
kr == 2 && continue # two associated ghosts, test is not clear
@test DT.replace_boundary_triangle_with_ghost_triangle(tri, V) == T
@test DT.replace_ghost_triangle_with_boundary_triangle(tri, T) == V
V = (i, w, j)
@test DT.replace_boundary_triangle_with_ghost_triangle(tri, V) == T
@test DT.replace_ghost_triangle_with_boundary_triangle(tri, T) == (j, i, w)
Expand Down

0 comments on commit cea95ca

Please sign in to comment.