diff --git a/src/tests/testGo.py b/src/tests/testGo.py new file mode 100644 --- /dev/null +++ b/src/tests/testGo.py @@ -0,0 +1,25 @@ +from unittest import TestCase + +from go import isLegalPosition + + +class TestLegal(TestCase): + def testLegal(self): + board=[ + [0,0,0,0,0], + [1,1,1,1,1], + [-1,-1,0,1,0], + [0,0,0,-1,-1], + [0,-1,0,-1,0] + ] + self.assertTrue(isLegalPosition(board)) + + def testIllegal(self): + board=[ + [0,1,0,0,0], + [1,-1,1,0,0], + [0,1,0,0,0], + [0,0,0,0,0], + [0,0,0,0,0] + ] + self.assertFalse(isLegalPosition(board))