Genetic Turmit Evolver
python
c
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

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')