예제 #1
0
 def test_nested_loop2(self):
     result = interpreter("[[*[>***>>[>>>[]>>>]>>[>>>]>[>>>]>]>]*]*", "110")
     self.assertEqual(result, "000")
예제 #2
0
 def test_simple_loop(self):
     result = interpreter("*[>*]", "00000000000")
     self.assertEqual(result, "11111111111")
예제 #3
0
 def test_skip_loop(self):
     result = interpreter("[[*[>***>>>>>>]>]*]", "110")
     self.assertEqual(result, "000")
예제 #4
0
 def test_nested_loop(self):
     result = interpreter("*[>*[*]]", "00101100")
     self.assertEqual(result, "10101100")
예제 #5
0
 def test80(self):
     # Flips the leftmost cell of the tape
     result = interpreter("*", "00101100")
     self.assertEqual(result, "10101100")
예제 #6
0
 def test3(self):
     result = interpreter("[[*]]", "00101100")
     self.assertEqual(result, "00101100")
예제 #7
0
 def test_run_loop(self):
     result = interpreter("*[>*]", "00101100")
     self.assertEqual(result, "11001100")
예제 #8
0
 def test1(self):
     result = interpreter("*[*[*]]", "0")
     self.assertEqual(result, "0")
예제 #9
0
 def test11(self):
     # Goes somewhere to the right of the tape and then flips all bits
     # that are initialized to 1, progressing leftwards through the tape
     result = interpreter(">>>>>*<*<<*", "00101100")
     self.assertEqual(result, "00000000")
예제 #10
0
 def test10(self):
     # Flips all the bits that are initialized to 0
     result = interpreter("*>*>>*>>>*>*", "00101100")
     self.assertEqual(result, "11111111")
예제 #11
0
 def test60(self):
     # Flips all the bits in the tape
     result = interpreter("*>*>*>*>*>*>*>*", "00101100")
     self.assertEqual(result, "11010011")
예제 #12
0
 def test71(self):
     # Flips the second and third cell of the tape
     result = interpreter(">*>*", "00101100")
     self.assertEqual(result, "01001100")