From 48a0a39209a760b3936312acf2f3081017d3c789 Mon Sep 17 00:00:00 2001 From: Eugene Medvedev Date: Sun, 25 Jun 2023 12:54:03 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=AA=20More=20detailed=20testing.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test.sh | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/test.sh b/test.sh index 88edc68..514717c 100755 --- a/test.sh +++ b/test.sh @@ -2,22 +2,40 @@ # This is a preliminary smoke test engine, and not a proper integration test framework. # Yet. It lets people run tests without ever touching their real key file though. +# Currently will not work properly on Windows: text mode tests assume +# starting with a Linux line endings file. CACHE=testcases/keys/cache KEY=testcases/keys/N0CALL.p12 SRC=testcases/files DST=testcases/results -# Straightforward signature. +echo === Straightforward test: must pass. go run *.go sign -c $CACHE -p changeme $KEY $SRC/sstv.jpg $DST/sstv-signed.jpg go run *.go verify -c $CACHE $DST/sstv-signed.jpg $DST/sstv-unsigned.jpg cmp -l $SRC/sstv.jpg $DST/sstv-unsigned.jpg -# Uncompressed signature. +echo === Uncompressed signature test: must pass. go run *.go sign -c $CACHE -p changeme -u -a $KEY $SRC/sstv.jpg $DST/sstv-signed-unc.jpg go run *.go verify -c $CACHE $DST/sstv-signed-unc.jpg $DST/sstv-unsigned.jpg cmp -l $SRC/sstv.jpg $DST/sstv-unsigned.jpg -# Text mode signing. +echo === Detached signature test: must pass. +go run *.go sign -c $CACHE -p changeme -s $DST/sstv.jpg.sig -a $KEY $SRC/sstv.jpg +go run *.go verify -c $CACHE $DST/sstv-signed-unc.jpg + +echo === Damaged file: must fail. +printf "00000c: %02x" $b_dec | xxd -r - $DST/sstv-signed.jpg +go run *.go verify -c $CACHE $DST/sstv-signed.jpg + +echo === Text mode tests -- native line endings: must pass. go run *.go sign -t -c $CACHE -p changeme $KEY $SRC/lipsum.txt $DST/lipsum-signed.txt go run *.go verify -t -c $CACHE $DST/lipsum-signed.txt $DST/lipsum-unsigned.txt + +echo === Text mode tests -- mac line endings: must pass. +unix2mac -n $DST/lipsum-signed.txt $DST/lipsum-signed-mac.txt +go run *.go verify -t -c $CACHE $DST/lipsum-signed-mac.txt $DST/lipsum-unsigned-mac.txt + +echo === Text mode tests -- dos line endings: must pass. +unix2dos -n $DST/lipsum-signed.txt $DST/lipsum-signed-dos.txt +go run *.go verify -t -c $CACHE $DST/lipsum-signed-dos.txt $DST/lipsum-unsigned-dos.txt