示例#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")