7706
This commit is contained in:
parent
dfa61e6299
commit
f3f6bc3f01
|
@ -14,3 +14,27 @@ fn check-ints-equal _a: int, b: int, msg: (addr array byte) {
|
|||
fn test-check-ints-equal {
|
||||
check-ints-equal 0, 0, "abc"
|
||||
}
|
||||
|
||||
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
|
||||
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
|
||||
count-test-failure
|
||||
}
|
||||
|
|
|
@ -283,9 +283,8 @@ fn test-gap-buffer-equal-from-end {
|
|||
add-grapheme-at-gap g, c
|
||||
add-grapheme-at-gap g, c
|
||||
# gap is at end (right is empty)
|
||||
var _result/eax: boolean <- gap-buffer-equal? g, "aaa"
|
||||
var result/eax: int <- copy _result
|
||||
check-ints-equal result, 1, "F - test-gap-buffer-equal-from-end"
|
||||
var result/eax: boolean <- gap-buffer-equal? g, "aaa"
|
||||
check result, "F - test-gap-buffer-equal-from-end"
|
||||
}
|
||||
|
||||
fn test-gap-buffer-equal-from-middle {
|
||||
|
@ -299,9 +298,8 @@ fn test-gap-buffer-equal-from-middle {
|
|||
add-grapheme-at-gap g, c
|
||||
var dummy/eax: grapheme <- gap-left g
|
||||
# gap is in the middle
|
||||
var _result/eax: boolean <- gap-buffer-equal? g, "aaa"
|
||||
var result/eax: int <- copy _result
|
||||
check-ints-equal result, 1, "F - test-gap-buffer-equal-from-middle"
|
||||
var result/eax: boolean <- gap-buffer-equal? g, "aaa"
|
||||
check result, "F - test-gap-buffer-equal-from-middle"
|
||||
}
|
||||
|
||||
fn test-gap-buffer-equal-from-start {
|
||||
|
@ -317,9 +315,8 @@ fn test-gap-buffer-equal-from-start {
|
|||
dummy <- gap-left g
|
||||
dummy <- gap-left g
|
||||
# gap is at the start
|
||||
var _result/eax: boolean <- gap-buffer-equal? g, "aaa"
|
||||
var result/eax: int <- copy _result
|
||||
check-ints-equal result, 1, "F - test-gap-buffer-equal-from-start"
|
||||
var result/eax: boolean <- gap-buffer-equal? g, "aaa"
|
||||
check result, "F - test-gap-buffer-equal-from-start"
|
||||
}
|
||||
|
||||
fn copy-gap-buffer _src-ah: (addr handle gap-buffer), _dest-ah: (addr handle gap-buffer) {
|
||||
|
|
Loading…
Reference in New Issue