2011-02-15 10:10:00 -08:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
import unittest
|
|
|
|
from interp.baker import pattern
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-02-15 10:27:45 -08:00
|
|
|
class Test(unittest.TestCase):
|
2011-02-15 10:10:00 -08:00
|
|
|
def setUp(self):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def testImports(self):
|
|
|
|
from interp.baker import pattern
|
|
|
|
|
2011-02-15 10:12:56 -08:00
|
|
|
def test_baker_eq_8(self):
|
2011-05-04 20:09:15 -07:00
|
|
|
b = sorted([tuple(sorted(i)) for i in ((0,1),(1,2),(2,0))])
|
|
|
|
p = sorted(pattern(3,2))
|
2011-02-15 10:10:00 -08:00
|
|
|
self.assertEqual(b,p)
|
|
|
|
|
2011-02-15 10:12:56 -08:00
|
|
|
def test_baker_eq_17(self):
|
2011-05-04 20:09:15 -07:00
|
|
|
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))
|
2011-02-15 10:10:00 -08:00
|
|
|
self.assertEqual(b,p)
|
|
|
|
|
2011-02-15 10:12:56 -08:00
|
|
|
def test_baker_eq_15(self):
|
2011-02-15 10:10:00 -08:00
|
|
|
b = sorted([tuple(sorted(i)) for i in (
|
2011-05-04 20:09:15 -07:00
|
|
|
(0,1), (0,2), (0,3),
|
|
|
|
(1,2), (1,3), (2,3))])
|
2011-02-15 10:10:00 -08:00
|
|
|
|
2011-05-04 20:09:15 -07:00
|
|
|
p = sorted(pattern(4,2))
|
2011-02-15 10:10:00 -08:00
|
|
|
|
|
|
|
self.assertEqual(b,p)
|
|
|
|
|
2011-02-15 10:12:56 -08:00
|
|
|
def test_smcquay_(self):
|
2011-02-15 10:10:00 -08:00
|
|
|
b = sorted([tuple(sorted(i)) for i in (
|
2011-05-04 20:09:15 -07:00
|
|
|
(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),
|
2011-02-15 10:10:00 -08:00
|
|
|
(1,3,3), (1,1,3),
|
2011-05-04 20:09:15 -07:00
|
|
|
(2,2,3), (2,3,3),
|
|
|
|
(0,3,3), (0,0,3))])
|
2011-02-15 10:10:00 -08:00
|
|
|
|
2011-05-04 20:09:15 -07:00
|
|
|
p = sorted(pattern(4,3))
|
2011-02-15 10:10:00 -08:00
|
|
|
self.assertEqual(b,p)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
2011-02-15 10:27:45 -08:00
|
|
|
suite = unittest.TestLoader().loadTestsFromTestCase(Test)
|
2011-02-15 10:10:00 -08:00
|
|
|
unittest.TextTestRunner(verbosity=3).run(suite)
|