blob: a85371b5dc9892407929852f7fbdcbec2ac00bc6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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")
|