def test_buildGraph(self): G = jetstreams.buildGraph(self.G, 0, 24) for e in G: print e self.assertEqual(G[0], (0,0,0)) self.assertEqual(G[-1], (24,24,0)) self.assertEqual(G[1], (0,5,10)) self.assertEqual(G[-2], (21,22,2))
def test_dag(self): G = jetstreams.buildGraph(self.G, 0, 24) pred, cost, start, end = jetstreams.dag(G, self.constEnergy) t = end while True: print t,'->', pred[t] t = pred[t] if t == start: break self.assertEqual(cost, 352)