def test_construction_2(self):
        root = MutationNode(None, None, None)

        mutation = CubeMutation.e
        mut_seq = root.make_mut_seq(mutation)
        child = MutationNode(root, mutation, mut_seq)

        assert root.parent is None
        assert root.mutation is None
        assert len(root.children) == 1
        assert root.children[0] == child
        assert len(root.mut_seq) == 0

        assert child.parent is root
        assert child.mutation == mutation
        assert len(child.children) == 0
        assert len(child.mut_seq) == 1
        assert child.mut_seq[0] == mutation
Beispiel #2
0
    def test_print_layer_expansion_info(self):
        cube = Cube(N=3)

        unique_cubes = LayeredArray()
        mutation_node = MutationNode(None, None, None)
        unique_cubes.append(MutatedCube(cube, mutation_node))
        unique_cubes.close_layer()

        dup_mut_seqs = LayeredArray()
        dup_mut_seqs.close_layer()

        _print_layer_expansion_info(True, 0, unique_cubes, dup_mut_seqs)
        _print_layer_expansion_info(False, 0, unique_cubes, dup_mut_seqs)
Beispiel #3
0
    def test_expand_layer(self):
        cube = Cube(N=2)
        mutation_basis = cube.get_nonisomorphic_mutations()

        unique_cubes = LayeredArray()
        mutation_node = MutationNode(None, None, None)
        unique_cubes.append(MutatedCube(cube, mutation_node))
        unique_cubes.close_layer()

        dup_mut_seqs = LayeredArray()
        dup_mut_seqs.close_layer()

        _expand_layer(1, mutation_basis, unique_cubes, dup_mut_seqs)

        assert unique_cubes.get_layer_size(1) == 9
        assert dup_mut_seqs.get_layer_size(1) == 9
    def test_make_mut_seq_2(self):
        root = MutationNode(None, None, None)

        mutation = CubeMutation.e
        mut_seq = root.make_mut_seq(mutation)
        child = MutationNode(root, mutation, mut_seq)
        mut_seq_2 = child.make_mut_seq(mutation)

        assert len(mut_seq_2) == 2
        assert mut_seq_2[0] == mutation
        assert mut_seq_2[1] == mutation
 def test_construction_1(self):
     MutationNode(None, None, None)
 def test_make_mut_seq_1(self):
     root = MutationNode(None, None, None)
     mut_seq = root.make_mut_seq(CubeMutation.e)
     assert len(mut_seq) == 1
     assert mut_seq[0] == CubeMutation.e
 def test_construction(self):
     cube = Cube(N=2)
     mutation_node = MutationNode(None, None, None)
     MutatedCube(cube, mutation_node)