diff options
| author | andromeda <andromeda@lenovo> | 2026-03-23 17:00:32 +0100 |
|---|---|---|
| committer | andromeda <andromeda@lenovo> | 2026-03-23 17:00:32 +0100 |
| commit | b952210561ab64ce6af22ab53f2fd3f5d1fa0985 (patch) | |
| tree | 315f528432f9653b62269d872050ab45091576ef /twasm/asm/tests.asm | |
| parent | 50e635332ce581df14d596afb6bbe6d821196877 (diff) | |
add hash
Diffstat (limited to 'twasm/asm/tests.asm')
| -rw-r--r-- | twasm/asm/tests.asm | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/twasm/asm/tests.asm b/twasm/asm/tests.asm index 5df2152..ab1cc5c 100644 --- a/twasm/asm/tests.asm +++ b/twasm/asm/tests.asm @@ -14,6 +14,9 @@ run_tests: call print.test call clear_test_arena + call test_djb2 + + call clear_test_arena call test_elemb call clear_test_arena @@ -110,6 +113,68 @@ test_elemb: .msg db "test_elemb...", 0x00 ; ------------------------------------------------------------------------------ +; test_djb2 +; +; description: +; tests djb2 described functionality +; ------------------------------------------------------------------------------ + +test_djb2: + mov rsi, .msg + call print.test + + mov rsi, .case0 + mov rdi, 0 + call djb2 + cmp rax, 5381 + jne .fail + + mov rsi, .case1 + mov rdi, 1 + call djb2 + cmp rax, 177670 + jne .fail + + mov rsi, .case2 + mov rdi, 2 + call djb2 + cmp rax, 5863208 + jne .fail + + ; why am I testing this, of course it's without side effects xD + + mov rsi, .case0 + mov rdi, 0 + call djb2 + cmp rax, 5381 + jne .fail + + mov rsi, .case1 + mov rdi, 1 + call djb2 + cmp rax, 177670 + jne .fail + + mov rsi, .case2 + mov rdi, 2 + call djb2 + cmp rax, 5863208 + jne .fail + + .pass: + mov rsi, msg_pass + call print + ret + .fail: + mov rsi, msg_fail + call print + ret + .case0 db "" + .case1 db "a" + .case2 db "ab" + .msg db "test_djb2...", 0x00 + +; ------------------------------------------------------------------------------ ; test_get_tte_type ; ; description: |
