fixed the pattern function and the memoization thereof

This commit is contained in:
Stephen Mardson McQuay
2011-05-04 21:09:15 -06:00
parent 08f898d83a
commit 2e7391f573
2 changed files with 78 additions and 43 deletions
+14 -14
View File
@@ -13,35 +13,35 @@ class Test(unittest.TestCase):
from interp.baker import pattern
def test_baker_eq_8(self):
b = sorted([tuple(sorted(i)) for i in ((1,2),(2,3),(3,1))])
p = sorted(pattern(power = 2, phicount = 3))
b = sorted([tuple(sorted(i)) for i in ((0,1),(1,2),(2,0))])
p = sorted(pattern(3,2))
self.assertEqual(b,p)
def test_baker_eq_17(self):
b = sorted([tuple(sorted(i)) for i in ((1,2,2), (1,3,3), (2,1,1), (2,3,3), (3,1,1), (3,2,2), (1,2,3))])
p = sorted(pattern(power = 3, phicount = 3))
b = sorted([tuple(sorted(i)) for i in ((0,1,1), (0,2,2), (1,0,0), (1,2,2), (2,0,0), (2,1,1), (0,1,2))])
p = sorted(pattern(3,3))
self.assertEqual(b,p)
def test_baker_eq_15(self):
b = sorted([tuple(sorted(i)) for i in (
(1,2), (1,3), (1,4),
(2,3), (2,4), (3,4))])
(0,1), (0,2), (0,3),
(1,2), (1,3), (2,3))])
p = sorted(pattern(power = 2, phicount = 4))
p = sorted(pattern(4,2))
self.assertEqual(b,p)
def test_smcquay_(self):
b = sorted([tuple(sorted(i)) for i in (
(1,2,3), (2,3,4), (1,2,4), (1,3,4),
(1,1,2), (1,2,2),
(2,3,3), (2,2,3),
(0,1,2), (1,2,3), (0,1,3), (0,2,3),
(0,0,1), (0,1,1),
(1,2,2), (1,1,2),
(0,2,2), (0,0,2),
(1,3,3), (1,1,3),
(2,4,4), (2,2,4),
(3,3,4), (3,4,4),
(1,4,4), (1,1,4))])
(2,2,3), (2,3,3),
(0,3,3), (0,0,3))])
p = sorted(pattern(power = 3, phicount = 4))
p = sorted(pattern(4,3))
self.assertEqual(b,p)