本文整理汇总了Python中Interpreter.Interpreter.execute方法的典型用法代码示例。如果您正苦于以下问题:Python Interpreter.execute方法的具体用法?Python Interpreter.execute怎么用?Python Interpreter.execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Interpreter.Interpreter
的用法示例。
在下文中一共展示了Interpreter.execute方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_4dn_should_multiply_d_by_n
# 需要导入模块: from Interpreter import Interpreter [as 别名]
# 或者: from Interpreter.Interpreter import execute [as 别名]
def test_4dn_should_multiply_d_by_n(self):
interpreter = Interpreter(['408', '100'])
instruction_count = interpreter.execute()
self.assertEqual('000', interpreter.get_register_value(0))
self.assertEqual(2, instruction_count)
##
interpreter = Interpreter(['302', '407', '100'])
instruction_count = interpreter.execute()
self.assertEqual('014', interpreter.get_register_value(0))
self.assertEqual(3, instruction_count)
示例2: test_2dn_should_set_register_d_to_n
# 需要导入模块: from Interpreter import Interpreter [as 别名]
# 或者: from Interpreter.Interpreter import execute [as 别名]
def test_2dn_should_set_register_d_to_n(self):
interpreter = Interpreter(['201', '100'])
instruction_count = interpreter.execute()
self.assertEqual('001', interpreter.get_register_value(0))
self.assertEqual(2, instruction_count)
##
interpreter = Interpreter(['299', '100'])
instruction_count = interpreter.execute()
self.assertEqual('009', interpreter.get_register_value(9))
self.assertEqual(2, instruction_count)
示例3: test_3dn_should_add_n_to_register_d
# 需要导入模块: from Interpreter import Interpreter [as 别名]
# 或者: from Interpreter.Interpreter import execute [as 别名]
def test_3dn_should_add_n_to_register_d(self):
interpreter = Interpreter(['308', '100'])
instruction_count = interpreter.execute()
self.assertEqual('008', interpreter.get_register_value(0))
self.assertEqual(2, instruction_count)
##
interpreter = Interpreter(['308', '302', '100'])
instruction_count = interpreter.execute()
self.assertEqual('010', interpreter.get_register_value(0))
self.assertEqual(3, instruction_count)
示例4: test_0ds_should_not_go_to_location_d_when_s_is_zero
# 需要导入模块: from Interpreter import Interpreter [as 别名]
# 或者: from Interpreter.Interpreter import execute [as 别名]
def test_0ds_should_not_go_to_location_d_when_s_is_zero(self):
interpreter = Interpreter(['200', '214', '010', '201', '100'])
instruction_count = interpreter.execute()
self.assertEqual('001', interpreter.get_register_value(0))
self.assertEqual(5, instruction_count)
示例5: test_9sa_set_the_value_in_ram
# 需要导入模块: from Interpreter import Interpreter [as 别名]
# 或者: from Interpreter.Interpreter import execute [as 别名]
def test_9sa_set_the_value_in_ram(self):
interpreter = Interpreter(['209', '215', '901', '100'])
instruction_count = interpreter.execute()
self.assertEqual('009', interpreter.get_ram_value(5))
self.assertEqual(4, instruction_count)
示例6: test_5ds_should_set_register_d_to_the_value_of_register_s
# 需要导入模块: from Interpreter import Interpreter [as 别名]
# 或者: from Interpreter.Interpreter import execute [as 别名]
def test_5ds_should_set_register_d_to_the_value_of_register_s(self):
interpreter = Interpreter(['209', '510', '100'])
instruction_count = interpreter.execute()
self.assertEqual('009', interpreter.get_register_value(0))
self.assertEqual('009', interpreter.get_register_value(1))
self.assertEqual(3, instruction_count)
示例7: test_8da_should_set_register_d_to_the_value_in_ram_whose_address_is_in_register_a
# 需要导入模块: from Interpreter import Interpreter [as 别名]
# 或者: from Interpreter.Interpreter import execute [as 别名]
def test_8da_should_set_register_d_to_the_value_in_ram_whose_address_is_in_register_a(self):
interpreter = Interpreter(['203', '810', '100', '999'])
instruction_count = interpreter.execute()
self.assertEqual('003', interpreter.get_register_value(0))
self.assertEqual('999', interpreter.get_register_value(1))
self.assertEqual(3, instruction_count)
示例8: test_7ds_should_multiply_register_d_to_the_value_of_register_s
# 需要导入模块: from Interpreter import Interpreter [as 别名]
# 或者: from Interpreter.Interpreter import execute [as 别名]
def test_7ds_should_multiply_register_d_to_the_value_of_register_s(self):
interpreter = Interpreter(['209', '212', '710', '100'])
instruction_count = interpreter.execute()
self.assertEqual('009', interpreter.get_register_value(0))
self.assertEqual('018', interpreter.get_register_value(1))
self.assertEqual(4, instruction_count)
示例9: test_should_do_nothing_given_single_halt_value
# 需要导入模块: from Interpreter import Interpreter [as 别名]
# 或者: from Interpreter.Interpreter import execute [as 别名]
def test_should_do_nothing_given_single_halt_value(self):
interpreter = Interpreter(['100'])
interpreter.execute()
for index in range(10) :
self.assertEqual('000', interpreter.get_register_value(index))
示例10: test_sample_test_case2
# 需要导入模块: from Interpreter import Interpreter [as 别名]
# 或者: from Interpreter.Interpreter import execute [as 别名]
def test_sample_test_case2(self):
interpreter = Interpreter(['299','233','255','990','803','301','050','100'])
instruction_count = interpreter.execute()
self.assertEqual(26, instruction_count)
示例11: test_sample_test_case
# 需要导入模块: from Interpreter import Interpreter [as 别名]
# 或者: from Interpreter.Interpreter import execute [as 别名]
def test_sample_test_case(self):
interpreter = Interpreter(['299','492','495','399','492','495','399','283','279','689','078','100','000','000','000'])
instruction_count = interpreter.execute()
self.assertEqual(16, instruction_count)