2021-01-14 05:50:38 +00:00
|
|
|
# print msg to screen if a != b, otherwise print "."
|
|
|
|
fn check-ints-equal _a: int, b: int, msg: (addr array byte) {
|
|
|
|
var a/eax: int <- copy _a
|
|
|
|
compare a, b
|
|
|
|
{
|
|
|
|
break-if-!=
|
2021-02-07 23:50:16 +00:00
|
|
|
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ".", 3/fg/cyan, 0/bg
|
2021-02-10 05:53:24 +00:00
|
|
|
return
|
2021-01-14 05:50:38 +00:00
|
|
|
}
|
2021-02-10 05:53:24 +00:00
|
|
|
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, msg, 3/fg/cyan, 0/bg
|
2021-03-09 07:49:07 +00:00
|
|
|
move-cursor-to-left-margin-of-next-line 0/screen
|
2021-02-10 05:53:24 +00:00
|
|
|
count-test-failure
|
2021-01-14 05:50:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn test-check-ints-equal {
|
|
|
|
check-ints-equal 0, 0, "abc"
|
|
|
|
}
|
2021-02-10 05:56:55 +00:00
|
|
|
|
|
|
|
fn check _a: boolean, msg: (addr array byte) {
|
|
|
|
var a/eax: int <- copy _a
|
|
|
|
compare a, 0/false
|
|
|
|
{
|
|
|
|
break-if-=
|
|
|
|
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ".", 3/fg/cyan, 0/bg
|
|
|
|
return
|
|
|
|
}
|
|
|
|
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, msg, 3/fg/cyan, 0/bg
|
2021-03-09 07:49:07 +00:00
|
|
|
move-cursor-to-left-margin-of-next-line 0/screen
|
2021-02-10 05:56:55 +00:00
|
|
|
count-test-failure
|
|
|
|
}
|
|
|
|
|
|
|
|
fn check-not _a: boolean, msg: (addr array byte) {
|
|
|
|
var a/eax: int <- copy _a
|
|
|
|
compare a, 0/false
|
|
|
|
{
|
|
|
|
break-if-!=
|
|
|
|
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ".", 3/fg/cyan, 0/bg
|
|
|
|
return
|
|
|
|
}
|
|
|
|
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, msg, 3/fg/cyan, 0/bg
|
2021-03-09 07:49:07 +00:00
|
|
|
move-cursor-to-left-margin-of-next-line 0/screen
|
2021-02-10 05:56:55 +00:00
|
|
|
count-test-failure
|
|
|
|
}
|