diff options
Diffstat (limited to 'twasm/asm/tests.asm')
| -rw-r--r-- | twasm/asm/tests.asm | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/twasm/asm/tests.asm b/twasm/asm/tests.asm index b7a9bec..e2dd79e 100644 --- a/twasm/asm/tests.asm +++ b/twasm/asm/tests.asm @@ -40,6 +40,9 @@ run_tests: call clear_test_arena call test_identify_operator + call clear_test_arena + call test_evaluate_operand + ret .msg db "running test suite...", 0x0A, 0x00 @@ -499,6 +502,52 @@ test_identify_operator: ret .msg db "test_identify_operator...", 0x00 +; ------------------------------------------------------------------------------ +; test_evaluate_operand +; +; description: +; tests evaluate_operand described funtionality +; ------------------------------------------------------------------------------ + +test_evaluate_operand: + mov rsi, .msg + call print.test + + mov rdi, .case0 + mov rsi, 3 + call evaluate_operand + cmp dl, 0x00 + jne .fail + cmp ax, 0x0000 + jne .fail + + mov rdi, .case1 + mov rsi, 0 + call evaluate_operand + cmp dl, 0xFF + jne .fail + + mov rdi, .case2 + mov rsi, 3 + call evaluate_operand + cmp dl, 0x00 + jne .fail + cmp ax, 0x0003 + jne .fail + + .pass: + mov rsi, msg_pass + call print + ret + .fail: + mov rsi, msg_fail + call print + ret + .case0 db "rax" + .case1: ; intentionally blank + .case2 db "rdx" + .msg db "test_evaluate_operand...", 0x00 + msg_pass: db 0x0A times (TEST_LINE_LENGTH + .start - .end) db " ", ; right align |
