Turned original test puzzle into a real testcase.
authorEevee <eevee@nyarumaa.(none)>
Sat, 13 Dec 2008 04:02:00 +0000 (20:02 -0800)
committerEevee <eevee@nyarumaa.(none)>
Sat, 13 Dec 2008 04:02:00 +0000 (20:02 -0800)
Runnable via setuptools, too: python setup.py test

pseudoku/tests/__init__.py [new file with mode: 0644]
pseudoku/tests/integrity/__init__.py [new file with mode: 0644]
pseudoku/tests/integrity/simple.py [new file with mode: 0644]
setup.py

diff --git a/pseudoku/tests/__init__.py b/pseudoku/tests/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/pseudoku/tests/integrity/__init__.py b/pseudoku/tests/integrity/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/pseudoku/tests/integrity/simple.py b/pseudoku/tests/integrity/simple.py
new file mode 100644 (file)
index 0000000..c85f206
--- /dev/null
@@ -0,0 +1,24 @@
+from unittest import TestCase
+
+from pseudoku.grid import Grid
+
+class SimpleGridTestCase(TestCase):
+    """Tests the solving integrity of some puzzles that can be solved using
+    only elimination and uniqueness.
+    """
+
+    def _test_single_puzzle(self, puzzle, msg=None):
+        """Solves a single puzzle and verifies that the result is, at least,
+        not incorrect.
+        """
+        
+        grid = Grid.from_string(puzzle)
+        grid.solve()
+        self.assertTrue(grid.is_filled(), msg)
+
+    def test_simple(self):
+        self._test_single_puzzle("""
+            ...69.... 9.5..876. ..4..1.2.
+            6...5...3 38.....49 7...3...2
+            .7.9..3.. .231..4.8 ....83...
+        """)
index 8d834ec..76cf91c 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -2,7 +2,9 @@ from setuptools import setup, find_packages
 setup(
     name = 'Pseudoku',
     version = '0.0',
-    packages = find_packages(exclude=['tests', 'tests.*']),
+    packages = find_packages(exclude=['pseudoku.tests', 'pseudoku.tests.*']),
+
+    test_suite = 'pseudoku.tests',
 
     entry_points = {
         'console_scripts': [