示例#1
0
    def test_tperm_success(self):
        """
        When variations of the T-perm algorithm is provided...
        Then the Algorithm class should initialise with no errors...
        And the output algorithm should match the expected alg....
        And the inverted algorithm should match the expected inverted alg.
        """
        t = Algorithm("R U R' U' R' F R2 U' R' U' R U R' F'")
        t_shorthand = Algorithm("[R,U] R' F R2 U' [R': U'] U R' F'")
        t_complex = Algorithm("[R,U] (R' F R2) U' [R': U'] U R' F'")

        t_expected = [
            "R", "U", "R'", "U'", "R'", "F", "R2", "U'", "R'", "U'", "R", "U",
            "R'", "F'"
        ]
        t_expected_inverse = [
            "F", "R", "U'", "R'", "U", "R", "U", "R2", "F'", "R", "U", "R",
            "U'", "R'"
        ]

        self.assertListEqual(t.alg(), t_expected)
        self.assertListEqual(t_shorthand.alg(), t_expected)
        self.assertListEqual(t_complex.alg(), t_expected)

        self.assertListEqual(t.invert(), t_expected_inverse)
        self.assertListEqual(t_shorthand.invert(), t_expected_inverse)
        self.assertListEqual(t_complex.invert(), t_expected_inverse)
示例#2
0
    def test_vanilla_success(self):
        """
        When simple algorithms are passed as inputs...
        Then the Algorithm class should initialise with no errors...
        And the output algorithm should match the expected alg.
        """
        v1 = Algorithm("RUR'U'")
        v2 = Algorithm("U")

        self.assertListEqual(v1.alg(), ["R", "U", "R'", "U'"])
        self.assertListEqual(v1.invert(), ["U", "R", "U'", "R'"])
        self.assertListEqual(v2.alg(), ["U"])
        self.assertListEqual(v2.invert(), ["U'"])