Genetic Turmit Evolver
python
c
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

test_rpnsymbol.py 553B

1234567891011121314151617181920
  1. import unittest
  2. from gte.turmit import Turmit
  3. from gte.rpnlib import _op_list, RpnSymbol
  4. class RpnSymbolTestCase(unittest.TestCase):
  5. def test_operations(self):
  6. add_idx = list(_op_list.keys()).index('add')
  7. sym = RpnSymbol(add_idx, RpnSymbol.OPERATION)
  8. self.assertEqual(str(sym), 'ADD')
  9. def test_value(self):
  10. sym = RpnSymbol(42, RpnSymbol.VALUE)
  11. self.assertEqual(str(sym), '0x2A')
  12. def test_op(self):
  13. sym = RpnSymbol(0, RpnSymbol.OPERATION)
  14. self.assertEqual(str(sym), 'MEM_SZ')