Add CI and test (#1)

Add CI and test
This commit is contained in:
Maier Johannes
2024-01-12 04:02:30 +01:00
committed by GitHub
parent d0f0ea6e56
commit 338f0eda4d
5 changed files with 174 additions and 0 deletions

15
tests/test_add.py Normal file
View File

@@ -0,0 +1,15 @@
import unittest
from common import *
class BasicInstructionTest(unittest.TestCase):
def test_addi(self):
for val in [0, 1, 50, 256, 0x543210, 0xFFFFFFFF]:
program = instr_i(Opcode.ADDI, Register.A, val)
exit_code = exec_program(program)
self.assertIsNotNone(exit_code, "Connection timeout!")
self.assertEqual(exit_code, val & 0xFF, "Computed the wrong result!")
if __name__ == '__main__':
unittest.main()