From bed3744207fa0a5601f207d6b1297baecb1b6dd5 Mon Sep 17 00:00:00 2001 From: Laurent Mazet Date: Thu, 10 Oct 2024 07:59:49 +0200 Subject: [PATCH] add tests --- ndisplay.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ndisplay.c b/ndisplay.c index 1092048..0030a06 100644 --- a/ndisplay.c +++ b/ndisplay.c @@ -200,9 +200,9 @@ int main (int argc, char *argv[]) for (y = 0; y < height; y++) { int ind = x + xcursor + images[scale]->width * (y + ycursor); - if (ind >= images[scale]->width * images[scale]->height) { - continue; - } + //if (ind >= images[scale]->width * images[scale]->height) { + // continue; + //} color_t *color = findncolor (correction (images[scale]->red[ind], gf[0]), correction (images[scale]->green[ind], gf[1]), correction (images[scale]->blue[ind], gf[2]), COLORS); @@ -328,6 +328,11 @@ int main (int argc, char *argv[]) /* test: TERM=vt100 ndisplay.exe image/laurent4p.ppm 2>&1 | grep 'no color avaliable' */ /* test: ndisplay.exe -h | grep usage */ /* test: ndisplay.exe -v 2>&1 | grep missing */ +/* test: ndisplay.exe -g 2>&1 | grep 'no gamma specified' */ +/* test: ndisplay.exe -g -1.0 2>&1 | grep 'incorrect gamma' */ +/* test: ndisplay.exe -g 1.1:0:1.1 2>&1 | grep 'incorrect gamma' */ +/* test: ndisplay.exe -g 1.1:1.2 2>&1 | grep 'incorrect gamma' */ +/* test: ndisplay.exe -g 1.1,1.2,1.0 2>&1 | grep 'incorrect gamma' */ /* test: ndisplay.exe image/bogus1.ppm 2>&1 | grep "can't read PNM file" */ /* test: ndisplay.exe image/bogus2.ppm 2>&1 | grep "can't read PNM file" */ /* test: ndisplay.exe image/bogus3.pbm 2>&1 | grep "can't read PNM file" */ @@ -341,6 +346,7 @@ int main (int argc, char *argv[]) /* test: { echo u; sleep 1; echo lll; sleep 1; echo j; sleep 1; echo q; } | ndisplay.exe image/laurent4p.pgm */ /* test: { echo o; sleep 1; echo o; sleep 1; echo q; } | ndisplay.exe image/laurent4p.ppm */ /* test: { echo oooo; sleep 1; echo u; sleep 1; echo q; } | ndisplay.exe image/laurent4.pbm */ +/* test: { echo kklluLK; sleep 1; echo LLIJ; sleep 1; echo LLLLLKKKKooo; sleep 1; echo ijJI; sleep 1; echo q; } | ndisplay.exe image/laurent4.ppm -w */ /* test: { sleep 1; echo q; } | ndisplay.exe image/laurent4.pgm */ /* test: { sleep 1; echo q; } | ndisplay.exe image/laurent4b.pgm */ /* test: { sleep 1; echo q; } | ndisplay.exe image/laurent4.ppm -g 1.2:3:1 */ -- 2.30.2