def test_big_binary_tree(): "Testing a big binary tree generated" topo = list(bin_tree(DIM)) triples = [] # the parent of every node is just given by the inverse # we can generate the conditions to verify pretty easily for x, y in topo: triples.append((y, "EasyRoutingP.parent", x)) for x in range(2**DIM - 1): triples.append((x, "EasyRoutingP.HOP_COUNTS",[255, 1, 2, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255])) assert(_test_generic(topo, ("Routing",), [], [], var_triples=triples, max_cycles=MAX_CYCLES))
def make_bin_tree(self, len): "Creates a binary tree structure for the topology" for vals in bin_tree(len): self.add_connection(*vals) print self.topology