コード例 #1
0
 def test_doubleIdentity(self):
     '''
     Test the ccm for double identity functions. It should pass.
     '''
     N, M, T = 3, 3, 3
     iden = (p(0, 0), (p(0, 1), p(0, 2), p(0, 3)),
             (p(1, 1), p(1, 2), p(1, 3)), (p(2, 1), p(2, 2), p(2, 3)))
     self.assertTrue(ccm(iden, iden, N, M, T))
コード例 #2
0
 def test_basePoint(self):
     '''
     Test to make sure that any two mappings which share a basepoint will
     be caught correctly
     '''
     N, M, T = 3, 3, 3
     map1 = (p(0, 0), (), (), ())
     self.assertFalse(cpd(map1, map1, N, M, T))
     map2 = (p(2, 0), (), (), ())
     self.assertFalse(cpd(map1, map2, N, M, T))
コード例 #3
0
 def test_1(self):
     '''
     test connectivity for triods of size 1
     '''
     N = 1
     self.assertEqual(con(p(0, 0), N), (p(0, 0), p(0, 1), p(1, 1), p(2, 1)))
     for t in range(3):
         self.assertEqual(con(p(t, 1), N), (p(t, 1), p(0, 0)))
コード例 #4
0
 def test_following(self):
     '''
     Make sure cpd does not flag the occasion where one map follows behind 
     the other map.
     '''
     N, M, T = 3, 3, 3
     #map2 follows map1
     map1 = (p(0, 0), (p(1, 1), p(1, 2), p(1, 3)), (), ())
     map2 = (p(2, 1), (p(2, 0), p(1, 1), p(1, 2)), (), ())
     self.assertTrue(cpd(map1, map2, N, M, T))
コード例 #5
0
 def test_crossing(self):
     '''
     Test to make sure that cpd catches non-disjointness when two points
     cross eachother.
     '''
     N, M, T = 3, 3, 3
     map1 = (p(0, 0), (p(0, 1), p(0, 2), p(0, 3)), (), ())
     map2 = (p(0, 3), (p(0, 2), p(0, 1), p(0, 0)), (), ())
     #the maps cross at (0, 1.5)
     self.assertFalse(cpd(map1, map2, N, M, T))
コード例 #6
0
 def test_2(self):
     '''
     test connectivity for triods of size 2
     '''
     N = 2
     #test branch point
     branchmap = (p(0, 0), p(0, 1), p(1, 1), p(2, 1))
     self.assertEqual(con(p(0, 0), N), branchmap)
     #test midpoint
     for t in range(3):
         midmap = (p(t, 1), p(t, 0), p(t, 2))
         self.assertEqual(con(p(t, 1), N), midmap)
     #test endpoints
     for t in range(3):
         endmap = (p(t, 2), p(t, 1))
         self.assertEqual(con(p(t, 2), N), endmap)