diff options
Diffstat (limited to 'the-ideal-stocking-stuffer/tiss-test.scm')
-rw-r--r-- | the-ideal-stocking-stuffer/tiss-test.scm | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/the-ideal-stocking-stuffer/tiss-test.scm b/the-ideal-stocking-stuffer/tiss-test.scm new file mode 100644 index 0000000..a85371b --- /dev/null +++ b/the-ideal-stocking-stuffer/tiss-test.scm @@ -0,0 +1,40 @@ +;; -*- compile-command: "guix shell guile-hashing guile -- guile -L . tiss-test.scm"; -*- +(use-modules (srfi srfi-64) + (tiss)) + +(test-begin "harness") + + +(test-equal "hash ''" + "d41d8cd98f00b204e9800998ecf8427e" + (get-hash "" "")) + +(test-equal "hash 'ab' + 'c'" + "900150983cd24fb0d6963f7d28e17f72" + (get-hash "ab" "c")) + +(test-equal "hash 'abcdef' + '609043'" + "000001dbbfa3a5c83a2d506429c7b00e" + (get-hash "abcdef" "609043")) + +(test-assert "starts-with is false" + (not (starts-with? "prefix" "ref"))) + +(test-assert "starts-with is true" + (starts-with? "prefix" "pref")) + +(test-assert "hash starts with 00000" + (starts-with? "000001dbbfa3a5c83a2d506429c7b00e" "00000")) + +(test-assert "pre-picked correct (pre/suf)fix" + (starts-with? (get-hash "abcdef" "609043") "00000")) + +(test-equal "abcdef is 609043" + 609043 + (tiss "abcdef" "00000" 609030)) + +(test-equal "pqrstuv is 1048970" + 1048970 + (tiss "pqrstuv" "00000" 0)) + +(test-end "harness") |