Add TEST clampu, better test result overview
This commit is contained in:
@@ -115,8 +115,8 @@ section .rodata
|
||||
testMsg_assertUMore db "\t\tassert(output > %u):\n\t\t\tExpected:\t%u\n\t\t\tGot:\t\t%u\n\t\t\t%s",NL,EOS
|
||||
testMsg_assertUMoreE db "\t\tassert(output >= %u):\n\t\t\tExpected:\t%u\n\t\t\tGot:\t\t%u\n\t\t\t%s",NL,EOS
|
||||
testMsg_False db "<!> FAIL",EOS
|
||||
testMsg_True db "< > OK",EOS
|
||||
testMsg_Results db "\n*** Test Results ***\n* Total tests:\t\t%d\n* Succeeded tests:\t%d\n* Failed tests:\t\t%d\n",EOS
|
||||
testMsg_True db "< > PASS",EOS
|
||||
testMsg_Results db "\n*** Test Results ***\n* Total tests:\t%d\n* Passed tests:\t%d\n* Failed tests:\t%d\n",EOS
|
||||
|
||||
;;;
|
||||
;;; Specific test data
|
||||
@@ -178,6 +178,12 @@ section .rodata
|
||||
addTest(clamp3, "clamp(1337, -1000, 1000)")
|
||||
addTest(clamp4, "clamp(MAX_INT64, -10, 10)")
|
||||
addTest(clamp5, "clamp(-1, MIN_UINT32, MAX_UINT32)")
|
||||
;clampu()
|
||||
addTestHeader(_clampu, "clampu")
|
||||
addTest(clampu1, "clampu(50, 1, 1000)")
|
||||
addTest(clampu2, "clampu(0, 1, 1000)")
|
||||
addTest(clampu3, "clampu(1337, 1, 1000)")
|
||||
addTest(clampu4, "clampu(MAX_UINT64, 0, MAX_UINT32)")
|
||||
|
||||
section .data
|
||||
|
||||
@@ -504,6 +510,40 @@ _start:
|
||||
assert MIN_UINT32, je, testMsg_assertIEqual
|
||||
%endif
|
||||
|
||||
;--- clampu()
|
||||
%if TEST_clampu
|
||||
printTestHeader(_clampu)
|
||||
|
||||
; TEST 1: clampu(50, 1, 1000)
|
||||
printTest(clampu1)
|
||||
mov rdi, 50
|
||||
mov rsi, 1
|
||||
mov rdx, 1000
|
||||
call clampu
|
||||
assert 50, je, testMsg_assertUEqual
|
||||
; TEST 2: clampu(0, 1, 1000)
|
||||
printTest(clampu2)
|
||||
xor rdi, rdi
|
||||
mov rsi, 1
|
||||
mov rdx, 1000
|
||||
call clampu
|
||||
assert 1, je, testMsg_assertUEqual
|
||||
; TEST 3: clampu(1337, 1, 1000)
|
||||
printTest(clampu3)
|
||||
mov rdi, 1337
|
||||
mov rsi, 1
|
||||
mov rdx, 1000
|
||||
call clampu
|
||||
assert 1000, je, testMsg_assertUEqual
|
||||
; TEST 4: clampu(MAX_UINT64, 0, MAX_UINT32)
|
||||
printTest(clampu4)
|
||||
mov rdi, MAX_UINT64
|
||||
xor rsi, rsi
|
||||
mov rdx, MAX_UINT32
|
||||
call clampu
|
||||
assert MAX_UINT32, je, testMsg_assertUEqual
|
||||
%endif
|
||||
|
||||
;;;
|
||||
;;; TEST RESULTS
|
||||
;;;
|
||||
|
Reference in New Issue
Block a user