def test_intermediate_three_other(self):
     cell_matrix = ['3..41', '.22..', '..1.1', '.2.2.', '3...3']
     width = len(cell_matrix[0])
     height = len(cell_matrix)
     graph = tisn.Graph(cell_matrix, width, height)
     solutions = tisn.find_sol_main(graph)
     self.assertEquals(12, len(solutions))
 def test_intermediate_three(self):
     print >> sys.stderr, 'Testing intermediate 3'
     cell_matrix = ['25.1', '47.4', '..1.', '3344']
     width = 4
     height = 4
     graph = tisn.Graph(cell_matrix, width, height)
     solutions = tisn.find_sol_main(graph)
     self.assertTrue(solutions is not None)
 def test_basic(self):
     cell_matrix = ['14.3', '....', '.4.4']
     width = 4
     height = 3
     graph = tisn.Graph(cell_matrix, width, height)
     solutions = tisn.find_sol_main(graph)
     n1 = graph.get_point(0, 3)
     n2 = graph.get_point(2, 3)
     self.assertEquals(8, len(solutions))
 def test_advanced_two(self):
     cell_matrix = [
         '3.....1..', '.2..4..21', '.3.2..1..', '..2.5.3..', '.3...3.3.',
         '......2..', '..2..3..3', '.3..3.3..', '3......44'
     ]
     width = len(cell_matrix[0])
     height = len(cell_matrix)
     graph = tisn.Graph(cell_matrix, width, height)
     solutions = tisn.find_sol_main(graph)
     self.assertNotEquals(None, solutions)
 def test_cg(self):
     print >> sys.stderr, 'Testing CG...'
     cell_matrix = [
         '22221', '2....', '2....', '2....', '2....', '22321', '.....',
         '.....', '22321', '2....', '2....', '2.131', '2..2.', '2222.'
     ]
     width = len(cell_matrix[0])
     height = len(cell_matrix)
     graph = tisn.Graph(cell_matrix, width, height)
     start = time.clock()
     solutions = tisn.find_sol_main(graph)
     time_sol = time.clock() - start
     self.assertTrue(time_sol < 1)
 def test_simple(self):
     cell_matrix = ['1.3', '...', '123']
     width = len(cell_matrix[0])
     height = len(cell_matrix)
     graph = tisn.Graph(cell_matrix, width, height)
     solutions = tisn.find_sol_main(graph)
     n1 = graph.get_point(0, 0)
     n2 = graph.get_point(2, 0)
     self.assertEquals(
         1, graph.nb_links(n1,
                           n2), 'There should be only one link between ' +
         str(n1) + ' and ' + str(n2))
     self.assertEquals(
         5, len(solutions),
         'There should be only 5 links to place, found ' +
         str(len(solutions)))