pixie/tests/test_qoi.nim

18 lines
556 B
Nim
Raw Normal View History

2022-05-21 23:27:38 +00:00
import pixie, 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
2022-05-21 23:27:38 +00:00
input = readImage("tests/fileformats/qoi/" & name & ".qoi")
control = readImage("tests/fileformats/qoi/" & name & ".png")
2022-01-03 23:41:36 +00:00
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
2022-05-21 23:27:38 +00:00
input = decodeQoi(readFile("tests/fileformats/qoi/" & name & ".qoi"))
output = decodeQoi(encodeQoi(input))
2022-01-03 23:41:36 +00:00
doAssert output.data.len == input.data.len
doAssert output.data == input.data