diff options
author | Sébastien Dailly <sebastien@chimrod.com> | 2014-09-27 12:13:38 +0200 |
---|---|---|
committer | Sébastien Dailly <sebastien@chimrod.com> | 2014-09-27 12:13:38 +0200 |
commit | 5049d4c8a05d3f9b72f4c7e048e94b753713beda (patch) | |
tree | da43b04f8eec2309ae16a9869bc92a0be055e424 /qml/python/tests | |
parent | aceb0d301274962289d62a41421e3cf0c8738053 (diff) |
Added navigation tree management
Diffstat (limited to 'qml/python/tests')
-rw-r--r-- | qml/python/tests/test2.sgf | 6 | ||||
-rw-r--r-- | qml/python/tests/test_transformations.py | 14 |
2 files changed, 19 insertions, 1 deletions
diff --git a/qml/python/tests/test2.sgf b/qml/python/tests/test2.sgf new file mode 100644 index 0000000..292a61f --- /dev/null +++ b/qml/python/tests/test2.sgf @@ -0,0 +1,6 @@ +(;GM[1]FF[3] +;AW[ok][qk][rl][mm][ln][pn][op][pp][rp][qq][rq][pr][qr][sr] +AB[qn][qo][ro][np][qp][mq][oq][pq];B[on] +(;W[po];B[pm];W[no];B[oo]) +(;W[oo];B[no];W[pm];B[po]) +) diff --git a/qml/python/tests/test_transformations.py b/qml/python/tests/test_transformations.py index b802b9f..d244e48 100644 --- a/qml/python/tests/test_transformations.py +++ b/qml/python/tests/test_transformations.py @@ -3,7 +3,7 @@ import unittest -from python.transformations import Rotation, Translation, Symmetry +from python.transformations import Rotation, Translation, Symmetry, ToIndex class FakeBoard(): @@ -132,3 +132,15 @@ class TestRotation(unittest.TestCase): symmetry.y_flip = False self.assertFalse(symmetry.is_valid()) + +class TestToIndex(unittest.TestCase): + """ Test the toIndex transformation. + """ + + def test_apply_points(self): + """ Test the points index. + """ + toIndex = ToIndex(FakeBoard(2, 1, 8, 5)) + self.assertEqual(0, toIndex.apply_points((2, 1))) + self.assertEqual(7, toIndex.apply_points((2, 2))) + self.assertEqual(8, toIndex.apply_points((3, 2))) |