From 61c63ef70ebae2d357ecf01e08d2d7ef907dc384 Mon Sep 17 00:00:00 2001 From: s2 Date: Mon, 25 Nov 2019 16:19:08 +0100 Subject: [PATCH] refactor test --- tests/test.sh | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/tests/test.sh b/tests/test.sh index afea559..77ded4b 100755 --- a/tests/test.sh +++ b/tests/test.sh @@ -10,24 +10,15 @@ plaintext=$(cat sometext) echo -n 'testing multiple pubkeys: ' ../sshenc.sh -p id_rsa-1.pub -p id_rsa-2.pub -p id_rsa-3.pub < sometext > $tempfile -cyph=$(../sshenc.sh -s id_rsa-1 < $tempfile) -if [ "$cyph" == "$plaintext" ]; then - echo -n "key1: ✓ " -else - echo -n "key1: ⛝ " -fi -cyph=$(../sshenc.sh -s id_rsa-2 < $tempfile) -if [ "$cyph" == "$plaintext" ]; then - echo -n "key2: ✓ " -else - echo -n "key2: ⛝ " -fi -cyph=$(../sshenc.sh -s id_rsa-3 < $tempfile) -if [ "$cyph" == "$plaintext" ]; then - echo -n "key3: ✓ " -else - echo -n "key4: ⛝ " -fi + +for i in {1..3}; do + cyph=$(../sshenc.sh -s id_rsa-$i < $tempfile) + if [ "$cyph" == "$plaintext" ]; then + echo -n "key$i: ✓ " + else + echo -n "key$i: ⛝ " + fi +done echo echo done.