pixie/tests/test_qoi.nim

18 lines
605 B
Nim
Raw Normal View History

2022-01-03 23:41:36 +00:00
import pixie, pixie/fileformats/png, pixie/fileformats/qoi
2022-01-01 22:50:23 +00:00
const tests = ["testcard", "testcard_rgba"]
for name in tests:
2022-01-03 23:41:36 +00:00
let
input = decodeQoi(readFile("tests/fileformats/qoi/" & name & ".qoi"))
control = decodePng(readFile("tests/fileformats/qoi/" & name & ".png"))
doAssert input.data == control.data, "input mismatch of " & name
2022-01-04 01:14:48 +00:00
discard encodeQoi(control)
2022-01-03 23:41:36 +00:00
2022-01-01 22:50:23 +00:00
for name in tests:
2022-01-03 23:41:36 +00:00
let
input = decodeQoiRaw(readFile("tests/fileformats/qoi/" & name & ".qoi"))
output = decodeQoiRaw(encodeQoi(input))
doAssert output.data.len == input.data.len
doAssert output.data == input.data