Skip to content

Commit

Permalink
Made code formatter happy; added test fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
yuce committed Oct 26, 2024
1 parent e243432 commit ef65f6a
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 3 deletions.
64 changes: 64 additions & 0 deletions tests/examples/hanoi_fixture.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@

Step 0

1
2
3
---------
L C R

Step 1


2
3 1
---------
L C R

Step 2



3 2 1
---------
L C R

Step 3


1
3 2
---------
L C R

Step 4


1
2 3
---------
L C R

Step 5



1 2 3
---------
L C R

Step 6


2
1 3
---------
L C R

Step 7

1
2
3
---------
L C R
7 changes: 7 additions & 0 deletions tests/examples/hanoi_simple_fixture.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
1. Move disk from left pole to right pole.
2. Move disk from left pole to center pole.
3. Move disk from right pole to center pole.
4. Move disk from left pole to right pole.
5. Move disk from center pole to left pole.
6. Move disk from center pole to right pole.
7. Move disk from left pole to right pole.
2 changes: 1 addition & 1 deletion tests/examples/test_coins.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

from pyswip.examples.coins import solve, prolog_source

class CoinsTestCase(unittest.TestCase):

class CoinsTestCase(unittest.TestCase):
def test_solve(self):
fixture = [{1: 3, 5: 0, 10: 30, 50: 0, 100: 0}]
soln = solve(coin_count=33, total_cents=303, max_solutions=1)
Expand Down
1 change: 0 additions & 1 deletion tests/examples/test_hanoi.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class HanoiTestCase(unittest.TestCase):

def test_solve(self):
fixture = load_fixture("hanoi_fixture.txt")
sio = StringIO()
Expand Down
2 changes: 1 addition & 1 deletion tests/examples/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
def load_fixture(filename: str) -> str:
path = Path(__file__).parent / filename
with open(path) as f:
return f.read()
return f.read()

0 comments on commit ef65f6a

Please sign in to comment.