@ -24,32 +24,33 @@ fn check-screen-row-from _screen: (addr screen), x: int, y: int, expected: (addr
var unused?/eax: boolean <- screen-cell-unused-at-index? screen, i n d e x
compare unused?, 0 / f a l s e
b r e a k - i f - ! =
var _g/eax: grapheme <- screen-grapheme -at-index screen, i n d e x
var g/ebx: grapheme <- copy _ g
var _c/eax: code-point <- screen-code-point -at-index screen, i n d e x
var c/ebx: code-point <- copy _ c
var expected-grapheme/eax: grapheme <- read-grapheme e - a d d r
var expected-code-point/eax: code-point <- to-code-point e x p e c t e d - g r a p h e m e
# compare g r a p h e m e s
$c heck-screen-row-from:compare-graphemes: {
# if expected-grapheme is space, null grapheme is also o k
# if expected-code-point is space, null grapheme is also o k
{
compare expected-grapheme , 0 x 20
compare expected-code-point , 0 x 20
b r e a k - i f - ! =
compare g, 0
compare c, 0
break-if-= $c h e c k - s c r e e n - r o w - f r o m : c o m p a r e - g r a p h e m e s
}
# if (g == expected-grapheme ) print " . "
compare g, e x p e c t e d - g r a p h e m e
# if (c == expected-code-point ) print " . "
compare c, e x p e c t e d - c o d e - p o i n t
b r e a k - i f - =
# otherwise print an e r r o r
failure-count <- i n c r e m e n t
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 /screen, msg, 3 /fg/cyan, 0 / b g
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 /screen, ": expected '", 3 /fg/cyan, 0 / b g
draw-grapheme -at-cursor-over-full-screen 0 /screen, expected-grapheme , 3 /cyan, 0 / b g
draw-code-point -at-cursor-over-full-screen 0 /screen, expected-code-point , 3 /cyan, 0 / b g
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 /screen, "' at (", 3 /fg/cyan, 0 / b g
draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0 /screen, x, 3 /fg/cyan, 0 / b g
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 /screen, ", ", 3 /fg/cyan, 0 / b g
draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0 /screen, y, 3 /fg/cyan, 0 / b g
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 /screen, ") but observed '", 3 /fg/cyan, 0 / b g
draw-grapheme -at-cursor-over-full-screen 0 /screen, g, 3 /cyan, 0 / b g
draw-code-point -at-cursor-over-full-screen 0 /screen, c, 3 /cyan, 0 / b g
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 /screen, "'", 3 /fg/cyan, 0 / b g
move-cursor-to-left-margin-of-next-line 0 / s c r e e n
}
@ -90,21 +91,22 @@ fn check-screen-row-in-color-from _screen: (addr screen), fg: int, y: int, x: in
var unused?/eax: boolean <- screen-cell-unused-at-index? screen, i n d e x
compare unused?, 0 / f a l s e
b r e a k - i f - ! =
var _g/eax: grapheme <- screen-grapheme-at-index screen, i n d e x
var g/ebx: grapheme <- copy _ g
var _expected-grapheme/eax: grapheme <- read-grapheme e - a d d r
var expected-grapheme/edi: grapheme <- copy _ e x p e c t e d - g r a p h e m e
var _c/eax: code-point <- screen-code-point-at-index screen, i n d e x
var c/ebx: code-point <- copy _ c
var expected-grapheme/eax: grapheme <- read-grapheme e - a d d r
var _expected-code-point/eax: code-point <- to-code-point e x p e c t e d - g r a p h e m e
var expected-code-point/edi: code-point <- copy _ e x p e c t e d - c o d e - p o i n t
$c heck-screen-row-in-color-from:compare-cells: {
# if expected-grapheme is space, null grapheme is also o k
# if expected-code-point is space, null grapheme is also o k
{
compare expected-grapheme , 0 x 20
compare expected-code-point , 0 x 20
b r e a k - i f - ! =
compare g, 0
compare c, 0
break-if-= $c h e c k - s c r e e n - r o w - i n - c o l o r - f r o m : c o m p a r e - c e l l s
}
# if expected-grapheme is space, a different color is o k
# if expected-code-point is space, a different color is o k
{
compare expected-grapheme , 0 x 20
compare expected-code-point , 0 x 20
b r e a k - i f - ! =
var color/eax: int <- screen-color-at-index screen, i n d e x
compare color, f g
@ -112,8 +114,8 @@ fn check-screen-row-in-color-from _screen: (addr screen), fg: int, y: int, x: in
}
# compare g r a p h e m e s
$c heck-screen-row-in-color-from:compare-graphemes: {
# if (g == expected-grapheme ) print " . "
compare g, e x p e c t e d - g r a p h e m e
# if (c == expected-code-point ) print " . "
compare c, e x p e c t e d - c o d e - p o i n t
{
b r e a k - i f - ! =
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 /screen, ".", 3 /fg/cyan, 0 / b g
@ -123,13 +125,13 @@ fn check-screen-row-in-color-from _screen: (addr screen), fg: int, y: int, x: in
c o u n t - t e s t - f a i l u r e
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 /screen, msg, 3 /fg/cyan, 0 / b g
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 /screen, ": expected '", 3 /fg/cyan, 0 / b g
draw-grapheme -at-cursor-over-full-screen 0 /screen, expected-grapheme , 3 /cyan, 0 / b g
draw-code-point -at-cursor-over-full-screen 0 /screen, expected-code-point , 3 /cyan, 0 / b g
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 /screen, "' at (", 3 /fg/cyan, 0 / b g
draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0 /screen, x, 3 /fg/cyan, 0 / b g
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 /screen, ", ", 3 /fg/cyan, 0 / b g
draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0 /screen, y, 3 /fg/cyan, 0 / b g
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 /screen, ") but observed '", 3 /fg/cyan, 0 / b g
draw-grapheme -at-cursor-over-full-screen 0 /screen, g, 3 /cyan, 0 / b g
draw-code-point -at-cursor-over-full-screen 0 /screen, c, 3 /cyan, 0 / b g
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 /screen, "'", 3 /fg/cyan, 0 / b g
move-cursor-to-left-margin-of-next-line 0 / s c r e e n
}
@ -145,7 +147,7 @@ fn check-screen-row-in-color-from _screen: (addr screen), fg: int, y: int, x: in
c o u n t - t e s t - f a i l u r e
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 /screen, msg, 3 /fg/cyan, 0 / b g
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 /screen, ": expected '", 3 /fg/cyan, 0 / b g
draw-grapheme -at-cursor-over-full-screen 0 /screen, expected-grapheme , 3 /cyan, 0 / b g
draw-code-point -at-cursor-over-full-screen 0 /screen, expected-code-point , 3 /cyan, 0 / b g
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 /screen, "' at (", 3 /fg/cyan, 0 / b g
draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0 /screen, x, 3 /fg/cyan, 0 / b g
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 /screen, ", ", 3 /fg/cyan, 0 / b g
@ -183,21 +185,22 @@ fn check-screen-row-in-background-color-from _screen: (addr screen), bg: int, y:
var unused?/eax: boolean <- screen-cell-unused-at-index? screen, i n d e x
compare unused?, 0 / f a l s e
b r e a k - i f - ! =
var _g/eax: grapheme <- screen-grapheme-at-index screen, i n d e x
var g/ebx: grapheme <- copy _ g
var _expected-grapheme/eax: grapheme <- read-grapheme e - a d d r
var expected-grapheme/edi: grapheme <- copy _ e x p e c t e d - g r a p h e m e
var _g/eax: code-point <- screen-code-point-at-index screen, i n d e x
var g/ebx: code-point <- copy _ g
var expected-grapheme/eax: grapheme <- read-grapheme e - a d d r
var _expected-code-point/eax: code-point <- to-code-point e x p e c t e d - g r a p h e m e
var expected-code-point/edi: code-point <- copy _ e x p e c t e d - c o d e - p o i n t
$c heck-screen-row-in-background-color-from:compare-cells: {
# if expected-grapheme is space, null grapheme is also o k
# if expected-code-point is space, null grapheme is also o k
{
compare expected-grapheme , 0 x 20
compare expected-code-point , 0 x 20
b r e a k - i f - ! =
compare g, 0
break-if-= $c h e c k - s c r e e n - r o w - i n - b a c k g r o u n d - c o l o r - f r o m : c o m p a r e - c e l l s
}
# if expected-grapheme is space, a different background-color is o k
# if expected-code-point is space, a different background-color is o k
{
compare expected-grapheme , 0 x 20
compare expected-code-point , 0 x 20
b r e a k - i f - ! =
var background-color/eax: int <- screen-background-color-at-index screen, i n d e x
compare background-color, b g
@ -205,8 +208,8 @@ fn check-screen-row-in-background-color-from _screen: (addr screen), bg: int, y:
}
# compare g r a p h e m e s
$c heck-screen-row-in-background-color-from:compare-graphemes: {
# if (g == expected-grapheme ) print " . "
compare g, e x p e c t e d - g r a p h e m e
# if (g == expected-code-point ) print " . "
compare g, e x p e c t e d - c o d e - p o i n t
{
b r e a k - i f - ! =
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 /screen, ".", 3 /fg/cyan, 0 / b g
@ -216,13 +219,13 @@ fn check-screen-row-in-background-color-from _screen: (addr screen), bg: int, y:
c o u n t - t e s t - f a i l u r e
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 /screen, msg, 3 /fg/cyan, 0 / b g
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 /screen, ": expected '", 3 /fg/cyan, 0 / b g
draw-grapheme -at-cursor-over-full-screen 0 /screen, expected-grapheme , 3 /cyan, 0 / b g
draw-code-point -at-cursor-over-full-screen 0 /screen, expected-code-point , 3 /cyan, 0 / b g
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 /screen, "' at (", 3 /fg/cyan, 0 / b g
draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0 /screen, x, 3 /fg/cyan, 0 / b g
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 /screen, ", ", 3 /fg/cyan, 0 / b g
draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0 /screen, y, 3 /fg/cyan, 0 / b g
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 /screen, ") but observed '", 3 /fg/cyan, 0 / b g
draw-grapheme -at-cursor-over-full-screen 0 /screen, g, 3 /cyan, 0 / b g
draw-code-point -at-cursor-over-full-screen 0 /screen, g, 3 /cyan, 0 / b g
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 /screen, "'", 3 /fg/cyan, 0 / b g
move-cursor-to-left-margin-of-next-line 0 / s c r e e n
break $c h e c k - s c r e e n - r o w - i n - b a c k g r o u n d - c o l o r - f r o m : c o m p a r e - g r a p h e m e s
@ -239,7 +242,7 @@ fn check-screen-row-in-background-color-from _screen: (addr screen), bg: int, y:
c o u n t - t e s t - f a i l u r e
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 /screen, msg, 3 /fg/cyan, 0 / b g
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 /screen, ": expected '", 3 /fg/cyan, 0 / b g
draw-grapheme -at-cursor-over-full-screen 0 /screen, expected-grapheme , 3 /cyan, 0 / b g
draw-code-point -at-cursor-over-full-screen 0 /screen, expected-code-point , 3 /cyan, 0 / b g
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 /screen, "' at (", 3 /fg/cyan, 0 / b g
draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0 /screen, x, 3 /fg/cyan, 0 / b g
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 /screen, ", ", 3 /fg/cyan, 0 / b g