summaryrefslogtreecommitdiff
path: root/tests/integration.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/integration.sh')
-rwxr-xr-xtests/integration.sh47
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/integration.sh b/tests/integration.sh
new file mode 100755
index 0000000..e31ae4d
--- /dev/null
+++ b/tests/integration.sh
@@ -0,0 +1,47 @@
+#!/bin/sh
+set -eu
+
+. tests/lib.sh
+
+
+test_needs_minimum_salt_length() {
+ testing 'needs minimum salt length'
+
+ N="$LINENO"
+ OUT="$(mkstemp)"
+ ERR="$(mkstemp)"
+ trap 'rm -f "$OUT" "$ERR"' EXIT
+ STATUS=0
+ ./scrypt.bin password salt 1>"$OUT" 2>"$ERR" || STATUS=$?
+ assert_status 2
+ assert_empty_stdout
+ assert_fgrep_stderr 'salt is too small'
+ rm -f "$OUT" "$ERR"
+
+ test_ok
+}
+
+test_same_input_same_output() {
+ testing 'same input, same output'
+
+ N="$LINENO"
+ OUT="$(mkstemp)"
+ ERR="$(mkstemp)"
+ trap 'rm -f "$OUT" "$ERR"' EXIT
+ STATUS=0
+ # 8 16 24 32
+ # v v v v
+ SALT='saltsaltsaltsaltsaltsaltsaltsalti'
+ HASH='969a539633fd531309197c26a671d593da0eadbd31c1194c23bd1b143a0ecb5e'
+ ./scrypt.bin password "$SALT" 1>"$OUT" 2>"$ERR" || STATUS=$?
+ assert_status 0
+ assert_stdout "$HASH"
+ assert_empty_stderr
+ rm -f "$OUT" "$ERR"
+
+ test_ok
+}
+
+
+test_needs_minimum_salt_length
+test_same_input_same_output