minor changes to make the test suite green again
This commit is contained in:
parent
57fe3e8c41
commit
1ba31f8df7
3 changed files with 7 additions and 14 deletions
|
|
@ -30,18 +30,13 @@ template colorOp(op: expr) {.immediate.} =
|
||||||
extract(b, br, bg, bb)
|
extract(b, br, bg, bb)
|
||||||
result = rawRGB(op(ar, br), op(ag, bg), op(ab, bb))
|
result = rawRGB(op(ar, br), op(ag, bg), op(ab, bb))
|
||||||
|
|
||||||
template satPlus(a, b: expr): expr =
|
proc satPlus(a, b: int): int {.inline.} =
|
||||||
# saturated plus:
|
result = a +% b
|
||||||
block:
|
|
||||||
var result = a +% b
|
|
||||||
if result > 255: result = 255
|
if result > 255: result = 255
|
||||||
result
|
|
||||||
|
|
||||||
template satMinus(a, b: expr): expr =
|
proc satMinus(a, b: int): int {.inline.} =
|
||||||
block:
|
result = a -% b
|
||||||
var result = a -% b
|
|
||||||
if result < 0: result = 0
|
if result < 0: result = 0
|
||||||
result
|
|
||||||
|
|
||||||
proc `+`*(a, b: TColor): TColor =
|
proc `+`*(a, b: TColor): TColor =
|
||||||
## adds two colors: This uses saturated artithmetic, so that each color
|
## adds two colors: This uses saturated artithmetic, so that each color
|
||||||
|
|
|
||||||
|
|
@ -1738,7 +1738,6 @@ when isMainModule:
|
||||||
else:
|
else:
|
||||||
assert false
|
assert false
|
||||||
|
|
||||||
var matches: array[0..5, string]
|
|
||||||
if match("abcdefg", peg"c {d} ef {g}", matches, 2):
|
if match("abcdefg", peg"c {d} ef {g}", matches, 2):
|
||||||
assert matches[0] == "d"
|
assert matches[0] == "d"
|
||||||
assert matches[1] == "g"
|
assert matches[1] == "g"
|
||||||
|
|
|
||||||
|
|
@ -1734,7 +1734,6 @@ when isMainModule:
|
||||||
else:
|
else:
|
||||||
doAssert false
|
doAssert false
|
||||||
|
|
||||||
var matches: array[0..5, string]
|
|
||||||
if match("abcdefg", peg"c {d} ef {g}", matches, 2):
|
if match("abcdefg", peg"c {d} ef {g}", matches, 2):
|
||||||
doAssert matches[0] == "d"
|
doAssert matches[0] == "d"
|
||||||
doAssert matches[1] == "g"
|
doAssert matches[1] == "g"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue