diff --git a/nimPNG.nimble b/nimPNG.nimble index 4a2354c..42fe99e 100644 --- a/nimPNG.nimble +++ b/nimPNG.nimble @@ -13,3 +13,7 @@ task tests, "Run tests": exec "nim c -r test.nim" exec "nim c -r testCodec.nim" exec "nim c -r testSuite.nim" + + exec "nim c -r -d:release test.nim" + exec "nim c -r -d:release testCodec.nim" + exec "nim c -r -d:release testSuite.nim" diff --git a/tester/testSuite.nim b/tester/testSuite.nim index d85af31..c89954b 100644 --- a/tester/testSuite.nim +++ b/tester/testSuite.nim @@ -1,6 +1,6 @@ import streams, os, strutils, nimPNG, minibmp -proc loadPNG(fileName: string): BMP = +proc loadPNG2BMP(fileName: string): BMP = var settings = makePNGDecoder() settings.readTextChunks = true var png = loadPNG24(fileName, settings) @@ -13,7 +13,7 @@ proc loadPNG(fileName: string): BMP = result.data[px + 1] = png.data[px + 1] result.data[px + 2] = png.data[px + 2] -proc write(bmp: BMP): string = +proc toString(bmp: BMP): string = var s = newStringStream() s.writeBMP(bmp) result = s.data @@ -30,9 +30,9 @@ proc convert(dir: string) = let bmpName = path.dir & DirSep & path.name & ExtSep & "bmp" echo fileName, " vs. ", bmpName - var bmp = loadPNG(fileName) + var bmp = loadPNG2BMP(fileName) if bmp != nil: - let data1 = bmp.write() + let data1 = bmp.toString() let data2 = readFile(bmpName) assert data1 == data2