using Scapin.Grid

@testset "Grid module" begin
    @testset "Connectivity" begin
        @testset "Connectivity, 2d" begin
            """
            1┬────────┬────────┬────────┐
             │        │        │        │
             │ (1, 4) │ (2, 4) │ (3, 4) │
             │        │        │        │
            4┼────────┼────────┼────────│
             │        │        │        │
             │ (1, 3) │ (2, 3) │ (3, 3) │
             │        │        │        │
            3┼────────┼────────┼────────│
             │        │        │        │
             │ (1, 2) │ (2, 2) │ (3, 2) │
             │        │        │        │
            2┼────────┼────────┼────────│
             │        │        │        │
             │ (1, 1) │ (2, 1) │ (3, 1) │
             │        │        │        │
            1┼────────┼────────┼────────┤
             1        2        3        1
            """
            N = (3, 4)
            d = size(N, 1)
            dims = Tuple(1:n for n in N)
            linear = LinearIndices(dims)
            @test cell_vertices(CartesianIndex(1, 1), N) ==
                  map(CartesianIndex, [(1, 1) (1, 2); (2, 1) (2, 2)])
            @test cell_vertices(CartesianIndex(2, 1), N) ==
                  map(CartesianIndex, [(2, 1) (2, 2); (3, 1) (3, 2)])
            @test cell_vertices(CartesianIndex(3, 1), N) ==
                  map(CartesianIndex, [(3, 1) (3, 2); (1, 1) (1, 2)])
            @test cell_vertices(CartesianIndex(1, 2), N) ==
                  map(CartesianIndex, [(1, 2) (1, 3); (2, 2) (2, 3)])
            @test cell_vertices(CartesianIndex(2, 2), N) ==
                  map(CartesianIndex, [(2, 2) (2, 3); (3, 2) (3, 3)])
            @test cell_vertices(CartesianIndex(3, 2), N) ==
                  map(CartesianIndex, [(3, 2) (3, 3); (1, 2) (1, 3)])
            @test cell_vertices(CartesianIndex(1, 3), N) ==
                  map(CartesianIndex, [(1, 3) (1, 4); (2, 3) (2, 4)])
            @test cell_vertices(CartesianIndex(2, 3), N) ==
                  map(CartesianIndex, [(2, 3) (2, 4); (3, 3) (3, 4)])
            @test cell_vertices(CartesianIndex(3, 3), N) ==
                  map(CartesianIndex, [(3, 3) (3, 4); (1, 3) (1, 4)])
            @test cell_vertices(CartesianIndex(1, 4), N) ==
                  map(CartesianIndex, [(1, 4) (1, 1); (2, 4) (2, 1)])
            @test cell_vertices(CartesianIndex(2, 4), N) ==
                  map(CartesianIndex, [(2, 4) (2, 1); (3, 4) (3, 1)])
            @test cell_vertices(CartesianIndex(3, 4), N) ==
                  map(CartesianIndex, [(3, 4) (3, 1); (1, 4) (1, 1)])
        end

        @testset "Connectivity, 3d" begin
            """
            1───────────2───────────3───────────4
            │           │           │           │
            │ (1, 4, 1) │ (2, 4, 1) │ (3, 4, 1) │
            │           │           │           │
            10─────────11───────────12─────────10
            │           │           │           │
            │ (1, 3, 1) │ (2, 3, 1) │ (3, 3, 1) │
            │           │           │           │
            7───────────8───────────9───────────7
            │           │           │           │
            │ (1, 2, 1) │ (2, 2, 1) │ (3, 2, 1) │
            │           │           │           │
            4───────────5───────────6───────────4
            │           │           │           │
            │ (1, 1, 1) │ (2, 1, 1) │ (3, 1, 1) │
            │           │           │           │
            1───────────2───────────3───────────1


            13─────────14───────────15─────────13
            │           │           │           │
            │ (1, 4, 2) │ (2, 4, 2) │ (3, 4, 2) │
            │           │           │           │
            22─────────23───────────24─────────22
            │           │           │           │
            │ (1, 3, 2) │ (2, 3, 2) │ (3, 3, 2) │
            │           │           │           │
            19─────────20───────────21─────────19
            │           │           │           │
            │ (1, 2, 2) │ (2, 2, 2) │ (3, 2, 2) │
            │           │           │           │
            16─────────17───────────18─────────16
            │           │           │           │
            │ (1, 1, 2) │ (2, 1, 2) │ (3, 1, 2) │
            │           │           │           │
            13─────────14───────────15─────────13


            25─────────26───────────27─────────25
            │           │           │           │
            │ (1, 4, 3) │ (2, 4, 3) │ (3, 4, 3) │
            │           │           │           │
            34─────────35───────────36─────────34
            │           │           │           │
            │ (1, 3, 3) │ (2, 3, 3) │ (3, 3, 3) │
            │           │           │           │
            31─────────32───────────33─────────31
            │           │           │           │
            │ (1, 2, 3) │ (2, 2, 3) │ (3, 2, 3) │
            │           │           │           │
            28─────────29───────────30─────────28
            │           │           │           │
            │ (1, 1, 3) │ (2, 1, 3) │ (3, 1, 3) │
            │           │           │           │
            25─────────26───────────27─────────25


            37─────────38───────────39─────────37
            │           │           │           │
            │ (1, 4, 4) │ (2, 4, 4) │ (3, 4, 4) │
            │           │           │           │
            46─────────47───────────48─────────46
            │           │           │           │
            │ (1, 3, 4) │ (2, 3, 4) │ (3, 3, 4) │
            │           │           │           │
            43─────────44───────────45─────────43
            │           │           │           │
            │ (1, 2, 4) │ (2, 2, 4) │ (3, 2, 4) │
            │           │           │           │
            40─────────41───────────42─────────40
            │           │           │           │
            │ (1, 1, 4) │ (2, 1, 4) │ (3, 1, 4) │
            │           │           │           │
            37─────────38───────────39─────────37


            49─────────50───────────51─────────49
            │           │           │           │
            │ (1, 4, 5) │ (2, 4, 5) │ (3, 4, 5) │
            │           │           │           │
            58─────────59───────────60─────────58
            │           │           │           │
            │ (1, 3, 5) │ (2, 3, 5) │ (3, 3, 5) │
            │           │           │           │
            55─────────56───────────57─────────55
            │           │           │           │
            │ (1, 2, 5) │ (2, 2, 5) │ (3, 2, 5) │
            │           │           │           │
            52─────────53───────────54─────────52
            │           │           │           │
            │ (1, 1, 5) │ (2, 1, 5) │ (3, 1, 5) │
            │           │           │           │
            49─────────50───────────51─────────49


            1───────────2───────────3───────────4
            │           │           │           │
            │           │           │           │
            │           │           │           │
            10─────────11───────────12─────────10
            │           │           │           │
            │           │           │           │
            │           │           │           │
            7───────────8───────────9───────────7
            │           │           │           │
            │           │           │           │
            │           │           │           │
            4───────────5───────────6───────────4
            │           │           │           │
            │           │           │           │
            │           │           │           │
            1───────────2───────────3───────────1

            """
            N = (3, 4, 5)
            d = size(N, 1)
            dims = Tuple(1:n for n in N)
            linear = LinearIndices(dims)
            transform(a) = reshape(map(CartesianIndex, a), 2, 2, 2)
            do_test(cell, vertices) =
                cell_vertices(CartesianIndex(cell), N) == transform(vertices)

            @test do_test(
                (1, 1, 1),
                [
                    (1, 1, 1),
                    (2, 1, 1),
                    (1, 2, 1),
                    (2, 2, 1),
                    (1, 1, 2),
                    (2, 1, 2),
                    (1, 2, 2),
                    (2, 2, 2),
                ],
            )
            @test do_test(
                (2, 1, 1),
                [
                    (2, 1, 1),
                    (3, 1, 1),
                    (2, 2, 1),
                    (3, 2, 1),
                    (2, 1, 2),
                    (3, 1, 2),
                    (2, 2, 2),
                    (3, 2, 2),
                ],
            )
            @test do_test(
                (3, 1, 1),
                [
                    (3, 1, 1),
                    (1, 1, 1),
                    (3, 2, 1),
                    (1, 2, 1),
                    (3, 1, 2),
                    (1, 1, 2),
                    (3, 2, 2),
                    (1, 2, 2),
                ],
            )
            @test do_test(
                (1, 2, 1),
                [
                    (1, 2, 1),
                    (2, 2, 1),
                    (1, 3, 1),
                    (2, 3, 1),
                    (1, 2, 2),
                    (2, 2, 2),
                    (1, 3, 2),
                    (2, 3, 2),
                ],
            )
            @test do_test(
                (2, 2, 1),
                [
                    (2, 2, 1),
                    (3, 2, 1),
                    (2, 3, 1),
                    (3, 3, 1),
                    (2, 2, 2),
                    (3, 2, 2),
                    (2, 3, 2),
                    (3, 3, 2),
                ],
            )
            @test do_test(
                (3, 2, 1),
                [
                    (3, 2, 1),
                    (1, 2, 1),
                    (3, 3, 1),
                    (1, 3, 1),
                    (3, 2, 2),
                    (1, 2, 2),
                    (3, 3, 2),
                    (1, 3, 2),
                ],
            )
            @test do_test(
                (1, 3, 1),
                [
                    (1, 3, 1),
                    (2, 3, 1),
                    (1, 4, 1),
                    (2, 4, 1),
                    (1, 3, 2),
                    (2, 3, 2),
                    (1, 4, 2),
                    (2, 4, 2),
                ],
            )
            @test do_test(
                (2, 3, 1),
                [
                    (2, 3, 1),
                    (3, 3, 1),
                    (2, 4, 1),
                    (3, 4, 1),
                    (2, 3, 2),
                    (3, 3, 2),
                    (2, 4, 2),
                    (3, 4, 2),
                ],
            )
            @test do_test(
                (3, 3, 1),
                [
                    (3, 3, 1),
                    (1, 3, 1),
                    (3, 4, 1),
                    (1, 4, 1),
                    (3, 3, 2),
                    (1, 3, 2),
                    (3, 4, 2),
                    (1, 4, 2),
                ],
            )
            @test do_test(
                (1, 4, 1),
                [
                    (1, 4, 1),
                    (2, 4, 1),
                    (1, 1, 1),
                    (2, 1, 1),
                    (1, 4, 2),
                    (2, 4, 2),
                    (1, 1, 2),
                    (2, 1, 2),
                ],
            )
            @test do_test(
                (2, 4, 1),
                [
                    (2, 4, 1),
                    (3, 4, 1),
                    (2, 1, 1),
                    (3, 1, 1),
                    (2, 4, 2),
                    (3, 4, 2),
                    (2, 1, 2),
                    (3, 1, 2),
                ],
            )
            @test do_test(
                (3, 4, 1),
                [
                    (3, 4, 1),
                    (1, 4, 1),
                    (3, 1, 1),
                    (1, 1, 1),
                    (3, 4, 2),
                    (1, 4, 2),
                    (3, 1, 2),
                    (1, 1, 2),
                ],
            )

            @test do_test(
                (1, 1, 2),
                [
                    (1, 1, 2),
                    (2, 1, 2),
                    (1, 2, 2),
                    (2, 2, 2),
                    (1, 1, 3),
                    (2, 1, 3),
                    (1, 2, 3),
                    (2, 2, 3),
                ],
            )
            @test do_test(
                (2, 1, 2),
                [
                    (2, 1, 2),
                    (3, 1, 2),
                    (2, 2, 2),
                    (3, 2, 2),
                    (2, 1, 3),
                    (3, 1, 3),
                    (2, 2, 3),
                    (3, 2, 3),
                ],
            )
            @test do_test(
                (3, 1, 2),
                [
                    (3, 1, 2),
                    (1, 1, 2),
                    (3, 2, 2),
                    (1, 2, 2),
                    (3, 1, 3),
                    (1, 1, 3),
                    (3, 2, 3),
                    (1, 2, 3),
                ],
            )
            @test do_test(
                (1, 2, 2),
                [
                    (1, 2, 2),
                    (2, 2, 2),
                    (1, 3, 2),
                    (2, 3, 2),
                    (1, 2, 3),
                    (2, 2, 3),
                    (1, 3, 3),
                    (2, 3, 3),
                ],
            )
            @test do_test(
                (2, 2, 2),
                [
                    (2, 2, 2),
                    (3, 2, 2),
                    (2, 3, 2),
                    (3, 3, 2),
                    (2, 2, 3),
                    (3, 2, 3),
                    (2, 3, 3),
                    (3, 3, 3),
                ],
            )
            @test do_test(
                (3, 2, 2),
                [
                    (3, 2, 2),
                    (1, 2, 2),
                    (3, 3, 2),
                    (1, 3, 2),
                    (3, 2, 3),
                    (1, 2, 3),
                    (3, 3, 3),
                    (1, 3, 3),
                ],
            )
            @test do_test(
                (1, 3, 2),
                [
                    (1, 3, 2),
                    (2, 3, 2),
                    (1, 4, 2),
                    (2, 4, 2),
                    (1, 3, 3),
                    (2, 3, 3),
                    (1, 4, 3),
                    (2, 4, 3),
                ],
            )
            @test do_test(
                (2, 3, 2),
                [
                    (2, 3, 2),
                    (3, 3, 2),
                    (2, 4, 2),
                    (3, 4, 2),
                    (2, 3, 3),
                    (3, 3, 3),
                    (2, 4, 3),
                    (3, 4, 3),
                ],
            )
            @test do_test(
                (3, 3, 2),
                [
                    (3, 3, 2),
                    (1, 3, 2),
                    (3, 4, 2),
                    (1, 4, 2),
                    (3, 3, 3),
                    (1, 3, 3),
                    (3, 4, 3),
                    (1, 4, 3),
                ],
            )
            @test do_test(
                (1, 4, 2),
                [
                    (1, 4, 2),
                    (2, 4, 2),
                    (1, 1, 2),
                    (2, 1, 2),
                    (1, 4, 3),
                    (2, 4, 3),
                    (1, 1, 3),
                    (2, 1, 3),
                ],
            )
            @test do_test(
                (2, 4, 2),
                [
                    (2, 4, 2),
                    (3, 4, 2),
                    (2, 1, 2),
                    (3, 1, 2),
                    (2, 4, 3),
                    (3, 4, 3),
                    (2, 1, 3),
                    (3, 1, 3),
                ],
            )
            @test do_test(
                (3, 4, 2),
                [
                    (3, 4, 2),
                    (1, 4, 2),
                    (3, 1, 2),
                    (1, 1, 2),
                    (3, 4, 3),
                    (1, 4, 3),
                    (3, 1, 3),
                    (1, 1, 3),
                ],
            )

            @test do_test(
                (1, 1, 3),
                [
                    (1, 1, 3),
                    (2, 1, 3),
                    (1, 2, 3),
                    (2, 2, 3),
                    (1, 1, 4),
                    (2, 1, 4),
                    (1, 2, 4),
                    (2, 2, 4),
                ],
            )
            @test do_test(
                (2, 1, 3),
                [
                    (2, 1, 3),
                    (3, 1, 3),
                    (2, 2, 3),
                    (3, 2, 3),
                    (2, 1, 4),
                    (3, 1, 4),
                    (2, 2, 4),
                    (3, 2, 4),
                ],
            )
            @test do_test(
                (3, 1, 3),
                [
                    (3, 1, 3),
                    (1, 1, 3),
                    (3, 2, 3),
                    (1, 2, 3),
                    (3, 1, 4),
                    (1, 1, 4),
                    (3, 2, 4),
                    (1, 2, 4),
                ],
            )
            @test do_test(
                (1, 2, 3),
                [
                    (1, 2, 3),
                    (2, 2, 3),
                    (1, 3, 3),
                    (2, 3, 3),
                    (1, 2, 4),
                    (2, 2, 4),
                    (1, 3, 4),
                    (2, 3, 4),
                ],
            )
            @test do_test(
                (2, 2, 3),
                [
                    (2, 2, 3),
                    (3, 2, 3),
                    (2, 3, 3),
                    (3, 3, 3),
                    (2, 2, 4),
                    (3, 2, 4),
                    (2, 3, 4),
                    (3, 3, 4),
                ],
            )
            @test do_test(
                (3, 2, 3),
                [
                    (3, 2, 3),
                    (1, 2, 3),
                    (3, 3, 3),
                    (1, 3, 3),
                    (3, 2, 4),
                    (1, 2, 4),
                    (3, 3, 4),
                    (1, 3, 4),
                ],
            )
            @test do_test(
                (1, 3, 3),
                [
                    (1, 3, 3),
                    (2, 3, 3),
                    (1, 4, 3),
                    (2, 4, 3),
                    (1, 3, 4),
                    (2, 3, 4),
                    (1, 4, 4),
                    (2, 4, 4),
                ],
            )
            @test do_test(
                (2, 3, 3),
                [
                    (2, 3, 3),
                    (3, 3, 3),
                    (2, 4, 3),
                    (3, 4, 3),
                    (2, 3, 4),
                    (3, 3, 4),
                    (2, 4, 4),
                    (3, 4, 4),
                ],
            )
            @test do_test(
                (3, 3, 3),
                [
                    (3, 3, 3),
                    (1, 3, 3),
                    (3, 4, 3),
                    (1, 4, 3),
                    (3, 3, 4),
                    (1, 3, 4),
                    (3, 4, 4),
                    (1, 4, 4),
                ],
            )
            @test do_test(
                (1, 4, 3),
                [
                    (1, 4, 3),
                    (2, 4, 3),
                    (1, 1, 3),
                    (2, 1, 3),
                    (1, 4, 4),
                    (2, 4, 4),
                    (1, 1, 4),
                    (2, 1, 4),
                ],
            )
            @test do_test(
                (2, 4, 3),
                [
                    (2, 4, 3),
                    (3, 4, 3),
                    (2, 1, 3),
                    (3, 1, 3),
                    (2, 4, 4),
                    (3, 4, 4),
                    (2, 1, 4),
                    (3, 1, 4),
                ],
            )
            @test do_test(
                (3, 4, 3),
                [
                    (3, 4, 3),
                    (1, 4, 3),
                    (3, 1, 3),
                    (1, 1, 3),
                    (3, 4, 4),
                    (1, 4, 4),
                    (3, 1, 4),
                    (1, 1, 4),
                ],
            )
            @test do_test(
                (1, 1, 4),
                [
                    (1, 1, 4),
                    (2, 1, 4),
                    (1, 2, 4),
                    (2, 2, 4),
                    (1, 1, 5),
                    (2, 1, 5),
                    (1, 2, 5),
                    (2, 2, 5),
                ],
            )
            @test do_test(
                (2, 1, 4),
                [
                    (2, 1, 4),
                    (3, 1, 4),
                    (2, 2, 4),
                    (3, 2, 4),
                    (2, 1, 5),
                    (3, 1, 5),
                    (2, 2, 5),
                    (3, 2, 5),
                ],
            )
            @test do_test(
                (3, 1, 4),
                [
                    (3, 1, 4),
                    (1, 1, 4),
                    (3, 2, 4),
                    (1, 2, 4),
                    (3, 1, 5),
                    (1, 1, 5),
                    (3, 2, 5),
                    (1, 2, 5),
                ],
            )
            @test do_test(
                (1, 2, 4),
                [
                    (1, 2, 4),
                    (2, 2, 4),
                    (1, 3, 4),
                    (2, 3, 4),
                    (1, 2, 5),
                    (2, 2, 5),
                    (1, 3, 5),
                    (2, 3, 5),
                ],
            )
            @test do_test(
                (2, 2, 4),
                [
                    (2, 2, 4),
                    (3, 2, 4),
                    (2, 3, 4),
                    (3, 3, 4),
                    (2, 2, 5),
                    (3, 2, 5),
                    (2, 3, 5),
                    (3, 3, 5),
                ],
            )
            @test do_test(
                (3, 2, 4),
                [
                    (3, 2, 4),
                    (1, 2, 4),
                    (3, 3, 4),
                    (1, 3, 4),
                    (3, 2, 5),
                    (1, 2, 5),
                    (3, 3, 5),
                    (1, 3, 5),
                ],
            )
            @test do_test(
                (1, 3, 4),
                [
                    (1, 3, 4),
                    (2, 3, 4),
                    (1, 4, 4),
                    (2, 4, 4),
                    (1, 3, 5),
                    (2, 3, 5),
                    (1, 4, 5),
                    (2, 4, 5),
                ],
            )
            @test do_test(
                (2, 3, 4),
                [
                    (2, 3, 4),
                    (3, 3, 4),
                    (2, 4, 4),
                    (3, 4, 4),
                    (2, 3, 5),
                    (3, 3, 5),
                    (2, 4, 5),
                    (3, 4, 5),
                ],
            )
            @test do_test(
                (3, 3, 4),
                [
                    (3, 3, 4),
                    (1, 3, 4),
                    (3, 4, 4),
                    (1, 4, 4),
                    (3, 3, 5),
                    (1, 3, 5),
                    (3, 4, 5),
                    (1, 4, 5),
                ],
            )
            @test do_test(
                (1, 4, 4),
                [
                    (1, 4, 4),
                    (2, 4, 4),
                    (1, 1, 4),
                    (2, 1, 4),
                    (1, 4, 5),
                    (2, 4, 5),
                    (1, 1, 5),
                    (2, 1, 5),
                ],
            )
            @test do_test(
                (2, 4, 4),
                [
                    (2, 4, 4),
                    (3, 4, 4),
                    (2, 1, 4),
                    (3, 1, 4),
                    (2, 4, 5),
                    (3, 4, 5),
                    (2, 1, 5),
                    (3, 1, 5),
                ],
            )
            @test do_test(
                (3, 4, 4),
                [
                    (3, 4, 4),
                    (1, 4, 4),
                    (3, 1, 4),
                    (1, 1, 4),
                    (3, 4, 5),
                    (1, 4, 5),
                    (3, 1, 5),
                    (1, 1, 5),
                ],
            )
            @test do_test(
                (1, 1, 5),
                [
                    (1, 1, 5),
                    (2, 1, 5),
                    (1, 2, 5),
                    (2, 2, 5),
                    (1, 1, 1),
                    (2, 1, 1),
                    (1, 2, 1),
                    (2, 2, 1),
                ],
            )
            @test do_test(
                (2, 1, 5),
                [
                    (2, 1, 5),
                    (3, 1, 5),
                    (2, 2, 5),
                    (3, 2, 5),
                    (2, 1, 1),
                    (3, 1, 1),
                    (2, 2, 1),
                    (3, 2, 1),
                ],
            )
            @test do_test(
                (3, 1, 5),
                [
                    (3, 1, 5),
                    (1, 1, 5),
                    (3, 2, 5),
                    (1, 2, 5),
                    (3, 1, 1),
                    (1, 1, 1),
                    (3, 2, 1),
                    (1, 2, 1),
                ],
            )
            @test do_test(
                (1, 2, 5),
                [
                    (1, 2, 5),
                    (2, 2, 5),
                    (1, 3, 5),
                    (2, 3, 5),
                    (1, 2, 1),
                    (2, 2, 1),
                    (1, 3, 1),
                    (2, 3, 1),
                ],
            )
            @test do_test(
                (2, 2, 5),
                [
                    (2, 2, 5),
                    (3, 2, 5),
                    (2, 3, 5),
                    (3, 3, 5),
                    (2, 2, 1),
                    (3, 2, 1),
                    (2, 3, 1),
                    (3, 3, 1),
                ],
            )
            @test do_test(
                (3, 2, 5),
                [
                    (3, 2, 5),
                    (1, 2, 5),
                    (3, 3, 5),
                    (1, 3, 5),
                    (3, 2, 1),
                    (1, 2, 1),
                    (3, 3, 1),
                    (1, 3, 1),
                ],
            )
            @test do_test(
                (1, 3, 5),
                [
                    (1, 3, 5),
                    (2, 3, 5),
                    (1, 4, 5),
                    (2, 4, 5),
                    (1, 3, 1),
                    (2, 3, 1),
                    (1, 4, 1),
                    (2, 4, 1),
                ],
            )
            @test do_test(
                (2, 3, 5),
                [
                    (2, 3, 5),
                    (3, 3, 5),
                    (2, 4, 5),
                    (3, 4, 5),
                    (2, 3, 1),
                    (3, 3, 1),
                    (2, 4, 1),
                    (3, 4, 1),
                ],
            )
            @test do_test(
                (3, 3, 5),
                [
                    (3, 3, 5),
                    (1, 3, 5),
                    (3, 4, 5),
                    (1, 4, 5),
                    (3, 3, 1),
                    (1, 3, 1),
                    (3, 4, 1),
                    (1, 4, 1),
                ],
            )
            @test do_test(
                (1, 4, 5),
                [
                    (1, 4, 5),
                    (2, 4, 5),
                    (1, 1, 5),
                    (2, 1, 5),
                    (1, 4, 1),
                    (2, 4, 1),
                    (1, 1, 1),
                    (2, 1, 1),
                ],
            )
            @test do_test(
                (2, 4, 5),
                [
                    (2, 4, 5),
                    (3, 4, 5),
                    (2, 1, 5),
                    (3, 1, 5),
                    (2, 4, 1),
                    (3, 4, 1),
                    (2, 1, 1),
                    (3, 1, 1),
                ],
            )
            @test do_test(
                (3, 4, 5),
                [
                    (3, 4, 5),
                    (1, 4, 5),
                    (3, 1, 5),
                    (1, 1, 5),
                    (3, 4, 1),
                    (1, 4, 1),
                    (3, 1, 1),
                    (1, 1, 1),
                ],
            )
        end
    end
end
