smbinterp/test/pattern.py
2011-09-17 15:38:49 -06:00

51 lines
1.5 KiB
Python

#!/usr/bin/env python
import unittest
from interp.baker import pattern
class Test(unittest.TestCase):
def setUp(self):
pass
def testImports(self):
from interp.baker import pattern as ppp
ppp
def test_baker_eq_8(self):
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 ((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 (
(0, 1), (0, 2), (0, 3),
(1, 2), (1, 3), (2, 3))])
p = sorted(pattern(4, 2))
self.assertEqual(b, p)
def test_smcquay_(self):
b = sorted([tuple(sorted(i)) for i in (
(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, 2, 3), (2, 3, 3),
(0, 3, 3), (0, 0, 3))])
p = sorted(pattern(4, 3))
self.assertEqual(b, p)
if __name__ == '__main__':
suite = unittest.TestLoader().loadTestsFromTestCase(Test)
unittest.TextTestRunner(verbosity=3).run(suite)