Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/usr.bin/argon2 added test cases



details:   https://anonhg.NetBSD.org/src/rev/4db65a101166
branches:  trunk
changeset: 455324:4db65a101166
user:      jhigh <jhigh%NetBSD.org@localhost>
date:      Mon Oct 14 14:48:48 2019 +0000

description:
added test cases
        invalid version specification
        salt too short

diffstat:

 tests/usr.bin/argon2/t_argon2.sh |  20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diffs (35 lines):

diff -r 2bc88b9aa24e -r 4db65a101166 tests/usr.bin/argon2/t_argon2.sh
--- a/tests/usr.bin/argon2/t_argon2.sh  Mon Oct 14 14:37:31 2019 +0000
+++ b/tests/usr.bin/argon2/t_argon2.sh  Mon Oct 14 14:48:48 2019 +0000
@@ -112,6 +112,24 @@
                'echo -n 'password' | argon2 somesalt -e -d -k 2096 -p 1 -v 13'
 }
 
+atf_test_case argon2_argon2id_k2096_p1_v19_inver
+argon2_argon2id_k2096_p1_v19_inver_head() {
+       atf_set "descr" "ATF test for argon2 argon2d,k=2096,p=1 invalid version specification"
+}
+argon2_argon2id_k2096_p1_v19_inver_body() {
+       atf_check -s exit:1 -e match:"Error: invalid Argon2 version" -x \
+               'echo -n 'password' | argon2 somesalt -e -d -k 2096 -p 1 -v 19'
+}
+
+atf_test_case argon2_argon2id_k2096_p1_sts
+argon2_argon2id_k2096_p1_sts_head() {
+       atf_set "descr" "ATF test for argon2 argon2d,k=2096,p=1 salt too short"
+}
+argon2_argon2id_k2096_p1_sts_body() {
+       atf_check -s exit:1 -e match:"Error: Salt is too short" -x \
+               'echo -n 'password' | argon2 tshort -e -d -k 2096 -p 1'
+}
+
 atf_init_test_cases()
 {
        atf_add_test_case argon2_argon2id
@@ -126,4 +144,6 @@
        atf_add_test_case argon2_argon2i_k2096_p1_v13
        atf_add_test_case argon2_argon2d_k2096_p1_v10
        atf_add_test_case argon2_argon2d_k2096_p1_v13
+       atf_add_test_case argon2_argon2id_k2096_p1_v19_inver
+       atf_add_test_case argon2_argon2id_k2096_p1_sts
 }



Home | Main Index | Thread Index | Old Index