소스 검색

Added a basic unit test for strategy (needs to be extended).

Taddeus Kroes 14 년 전
부모
커밋
00241cdd63
1개의 변경된 파일15개의 추가작업 그리고 0개의 파일을 삭제
  1. 15 0
      tests/test_strategy.py

+ 15 - 0
tests/test_strategy.py

@@ -0,0 +1,15 @@
+from src.rules.factors import match_expand, expand_double, expand_single
+from src.node import Scope
+from src.possibilities import Possibility as P
+from src.strategy import find_possibilities
+from tests.rulestestcase import RulesTestCase, tree
+
+
+class TestStrategy(RulesTestCase):
+
+    def test_find_possibilities_sort(self):
+        (ab, cd), e = root = tree('(a + b)(c + d)e')
+        self.assertEqualPos(find_possibilities(root),
+                [P(root, expand_single, (Scope(root), cd, e)),
+                 P(root, expand_single, (Scope(root), ab, e)),
+                 P(root, expand_double, (Scope(root), ab, cd))])