Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Prometheus3375 committed Jul 19, 2024
1 parent 6e1315f commit 8767214
Show file tree
Hide file tree
Showing 5 changed files with 497 additions and 0 deletions.
Empty file added tests/__init__.py
Empty file.
193 changes: 193 additions & 0 deletions tests/combos.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
from solve.combo import Combination, Node
from solve.shapes import circle, square, triangle

_all_combinations_n = 3 * 1 * 3 * 2 * 1 * 2 * 1 * 1 * 1
_all_combinations = [
Combination(
left=Node.from_inner_and_other(circle, circle),
middle=Node.from_inner_and_other(triangle, triangle),
right=Node.from_inner_and_other(square, square),
),
Combination(
left=Node.from_inner_and_other(circle, circle),
middle=Node.from_inner_and_other(triangle, square),
right=Node.from_inner_and_other(square, triangle),
),
Combination(
left=Node.from_inner_and_other(circle, triangle),
middle=Node.from_inner_and_other(triangle, circle),
right=Node.from_inner_and_other(square, square),
),
Combination(
left=Node.from_inner_and_other(circle, triangle),
middle=Node.from_inner_and_other(triangle, square),
right=Node.from_inner_and_other(square, circle),
),
Combination(
left=Node.from_inner_and_other(circle, square),
middle=Node.from_inner_and_other(triangle, circle),
right=Node.from_inner_and_other(square, triangle),
),
Combination(
left=Node.from_inner_and_other(circle, square),
middle=Node.from_inner_and_other(triangle, triangle),
right=Node.from_inner_and_other(square, circle),
),
Combination(
left=Node.from_inner_and_other(circle, circle),
middle=Node.from_inner_and_other(square, triangle),
right=Node.from_inner_and_other(triangle, square),
),
Combination(
left=Node.from_inner_and_other(circle, circle),
middle=Node.from_inner_and_other(square, square),
right=Node.from_inner_and_other(triangle, triangle),
),
Combination(
left=Node.from_inner_and_other(circle, triangle),
middle=Node.from_inner_and_other(square, circle),
right=Node.from_inner_and_other(triangle, square),
),
Combination(
left=Node.from_inner_and_other(circle, triangle),
middle=Node.from_inner_and_other(square, square),
right=Node.from_inner_and_other(triangle, circle),
),
Combination(
left=Node.from_inner_and_other(circle, square),
middle=Node.from_inner_and_other(square, circle),
right=Node.from_inner_and_other(triangle, triangle),
),
Combination(
left=Node.from_inner_and_other(circle, square),
middle=Node.from_inner_and_other(square, triangle),
right=Node.from_inner_and_other(triangle, circle),
),
Combination(
left=Node.from_inner_and_other(triangle, circle),
middle=Node.from_inner_and_other(circle, triangle),
right=Node.from_inner_and_other(square, square),
),
Combination(
left=Node.from_inner_and_other(triangle, circle),
middle=Node.from_inner_and_other(circle, square),
right=Node.from_inner_and_other(square, triangle),
),
Combination(
left=Node.from_inner_and_other(triangle, triangle),
middle=Node.from_inner_and_other(circle, circle),
right=Node.from_inner_and_other(square, square),
),
Combination(
left=Node.from_inner_and_other(triangle, triangle),
middle=Node.from_inner_and_other(circle, square),
right=Node.from_inner_and_other(square, circle),
),
Combination(
left=Node.from_inner_and_other(triangle, square),
middle=Node.from_inner_and_other(circle, circle),
right=Node.from_inner_and_other(square, triangle),
),
Combination(
left=Node.from_inner_and_other(triangle, square),
middle=Node.from_inner_and_other(circle, triangle),
right=Node.from_inner_and_other(square, circle),
),
Combination(
left=Node.from_inner_and_other(triangle, circle),
middle=Node.from_inner_and_other(square, triangle),
right=Node.from_inner_and_other(circle, square),
),
Combination(
left=Node.from_inner_and_other(triangle, circle),
middle=Node.from_inner_and_other(square, square),
right=Node.from_inner_and_other(circle, triangle),
),
Combination(
left=Node.from_inner_and_other(triangle, triangle),
middle=Node.from_inner_and_other(square, circle),
right=Node.from_inner_and_other(circle, square),
),
Combination(
left=Node.from_inner_and_other(triangle, triangle),
middle=Node.from_inner_and_other(square, square),
right=Node.from_inner_and_other(circle, circle),
),
Combination(
left=Node.from_inner_and_other(triangle, square),
middle=Node.from_inner_and_other(square, circle),
right=Node.from_inner_and_other(circle, triangle),
),
Combination(
left=Node.from_inner_and_other(triangle, square),
middle=Node.from_inner_and_other(square, triangle),
right=Node.from_inner_and_other(circle, circle),
),
Combination(
left=Node.from_inner_and_other(square, circle),
middle=Node.from_inner_and_other(circle, triangle),
right=Node.from_inner_and_other(triangle, square),
),
Combination(
left=Node.from_inner_and_other(square, circle),
middle=Node.from_inner_and_other(circle, square),
right=Node.from_inner_and_other(triangle, triangle),
),
Combination(
left=Node.from_inner_and_other(square, triangle),
middle=Node.from_inner_and_other(circle, circle),
right=Node.from_inner_and_other(triangle, square),
),
Combination(
left=Node.from_inner_and_other(square, triangle),
middle=Node.from_inner_and_other(circle, square),
right=Node.from_inner_and_other(triangle, circle),
),
Combination(
left=Node.from_inner_and_other(square, square),
middle=Node.from_inner_and_other(circle, circle),
right=Node.from_inner_and_other(triangle, triangle),
),
Combination(
left=Node.from_inner_and_other(square, square),
middle=Node.from_inner_and_other(circle, triangle),
right=Node.from_inner_and_other(triangle, circle),
),
Combination(
left=Node.from_inner_and_other(square, circle),
middle=Node.from_inner_and_other(triangle, triangle),
right=Node.from_inner_and_other(circle, square),
),
Combination(
left=Node.from_inner_and_other(square, circle),
middle=Node.from_inner_and_other(triangle, square),
right=Node.from_inner_and_other(circle, triangle),
),
Combination(
left=Node.from_inner_and_other(square, triangle),
middle=Node.from_inner_and_other(triangle, circle),
right=Node.from_inner_and_other(circle, square),
),
Combination(
left=Node.from_inner_and_other(square, triangle),
middle=Node.from_inner_and_other(triangle, square),
right=Node.from_inner_and_other(circle, circle),
),
Combination(
left=Node.from_inner_and_other(square, square),
middle=Node.from_inner_and_other(triangle, circle),
right=Node.from_inner_and_other(circle, triangle),
),
Combination(
left=Node.from_inner_and_other(square, square),
middle=Node.from_inner_and_other(triangle, triangle),
right=Node.from_inner_and_other(circle, circle),
),
]

assert len(_all_combinations) == _all_combinations_n, \
f'number of all combination must be {_all_combinations_n}'
all_combinations = {c.code: c for c in _all_combinations}
del _all_combinations, _all_combinations_n

__all__ = 'all_combinations',
125 changes: 125 additions & 0 deletions tests/move_count_dissection.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
number_of_moves_mixed = {
'0[00]-3[33]-4[44]': 6,
'0[00]-3[34]-4[43]': 4,
'0[03]-3[30]-4[44]': 4,
'0[03]-3[34]-4[40]': 4,
'0[04]-3[30]-4[43]': 4,
'0[04]-3[33]-4[40]': 4,
'0[00]-4[43]-3[34]': 4,
'0[00]-4[44]-3[33]': 6,
'0[03]-4[40]-3[34]': 4,
'0[03]-4[44]-3[30]': 4,
'0[04]-4[40]-3[33]': 4,
'0[04]-4[43]-3[30]': 4,
'3[30]-0[03]-4[44]': 4,
'3[30]-0[04]-4[43]': 4,
'3[33]-0[00]-4[44]': 6,
'3[33]-0[04]-4[40]': 4,
'3[34]-0[00]-4[43]': 4,
'3[34]-0[03]-4[40]': 4,
'3[30]-4[43]-0[04]': 4,
'3[30]-4[44]-0[03]': 4,
'3[33]-4[40]-0[04]': 4,
'3[33]-4[44]-0[00]': 6,
'3[34]-4[40]-0[03]': 4,
'3[34]-4[43]-0[00]': 4,
'4[40]-0[03]-3[34]': 4,
'4[40]-0[04]-3[33]': 4,
'4[43]-0[00]-3[34]': 4,
'4[43]-0[04]-3[30]': 4,
'4[44]-0[00]-3[33]': 6,
'4[44]-0[03]-3[30]': 4,
'4[40]-3[33]-0[04]': 4,
'4[40]-3[34]-0[03]': 4,
'4[43]-3[30]-0[04]': 4,
'4[43]-3[34]-0[00]': 4,
'4[44]-3[30]-0[03]': 4,
'4[44]-3[33]-0[00]': 6,
}
"""
Combination code to the number of moves required to solve statues using ``KSMixed``.
"""

number_of_moves_double1 = {
'0[00]-3[33]-4[44]': 8,
'0[00]-3[34]-4[43]': 6,
'0[03]-3[30]-4[44]': 6,
'0[03]-3[34]-4[40]': 6,
'0[04]-3[30]-4[43]': 4,
'0[04]-3[33]-4[40]': 6,
'0[00]-4[43]-3[34]': 6,
'0[00]-4[44]-3[33]': 8,
'0[03]-4[40]-3[34]': 6,
'0[03]-4[44]-3[30]': 6,
'0[04]-4[40]-3[33]': 6,
'0[04]-4[43]-3[30]': 4,
'3[30]-0[03]-4[44]': 6,
'3[30]-0[04]-4[43]': 4,
'3[33]-0[00]-4[44]': 8,
'3[33]-0[04]-4[40]': 6,
'3[34]-0[00]-4[43]': 6,
'3[34]-0[03]-4[40]': 6,
'3[30]-4[43]-0[04]': 4,
'3[30]-4[44]-0[03]': 6,
'3[33]-4[40]-0[04]': 6,
'3[33]-4[44]-0[00]': 8,
'3[34]-4[40]-0[03]': 6,
'3[34]-4[43]-0[00]': 6,
'4[40]-0[03]-3[34]': 6,
'4[40]-0[04]-3[33]': 6,
'4[43]-0[00]-3[34]': 6,
'4[43]-0[04]-3[30]': 4,
'4[44]-0[00]-3[33]': 8,
'4[44]-0[03]-3[30]': 6,
'4[40]-3[33]-0[04]': 6,
'4[40]-3[34]-0[03]': 6,
'4[43]-3[30]-0[04]': 4,
'4[43]-3[34]-0[00]': 6,
'4[44]-3[30]-0[03]': 6,
'4[44]-3[33]-0[00]': 8,
}
"""
Combination code to the number of moves required to solve statues using ``KSDouble1``.
"""

number_of_moves_double2 = {
'0[00]-3[33]-4[44]': 8,
'0[00]-3[34]-4[43]': 6,
'0[03]-3[30]-4[44]': 6,
'0[03]-3[34]-4[40]': 4,
'0[04]-3[30]-4[43]': 6,
'0[04]-3[33]-4[40]': 6,
'0[00]-4[43]-3[34]': 6,
'0[00]-4[44]-3[33]': 8,
'0[03]-4[40]-3[34]': 4,
'0[03]-4[44]-3[30]': 6,
'0[04]-4[40]-3[33]': 6,
'0[04]-4[43]-3[30]': 6,
'3[30]-0[03]-4[44]': 6,
'3[30]-0[04]-4[43]': 6,
'3[33]-0[00]-4[44]': 8,
'3[33]-0[04]-4[40]': 6,
'3[34]-0[00]-4[43]': 6,
'3[34]-0[03]-4[40]': 4,
'3[30]-4[43]-0[04]': 6,
'3[30]-4[44]-0[03]': 6,
'3[33]-4[40]-0[04]': 6,
'3[33]-4[44]-0[00]': 8,
'3[34]-4[40]-0[03]': 4,
'3[34]-4[43]-0[00]': 6,
'4[40]-0[03]-3[34]': 4,
'4[40]-0[04]-3[33]': 6,
'4[43]-0[00]-3[34]': 6,
'4[43]-0[04]-3[30]': 6,
'4[44]-0[00]-3[33]': 8,
'4[44]-0[03]-3[30]': 6,
'4[40]-3[33]-0[04]': 6,
'4[40]-3[34]-0[03]': 4,
'4[43]-3[30]-0[04]': 6,
'4[43]-3[34]-0[00]': 6,
'4[44]-3[30]-0[03]': 6,
'4[44]-3[33]-0[00]': 8,
}
"""
Combination code to the number of moves required to solve statues using ``KSDouble2``.
"""
Loading

0 comments on commit 8767214

Please sign in to comment.