]> gitweb.factorcode.org Git - factor.git/blob - basis/checksums/openssl/openssl-tests.factor
3fb223caecca609e366445bcca2237f2b11385ee
[factor.git] / basis / checksums / openssl / openssl-tests.factor
1 USING: accessors byte-arrays checksums checksums.openssl
2 combinators.short-circuit kernel system tools.test ;
3 IN: checksums.openssl.tests
4
5 {
6     B{ 201 238 222 100 92 200 182 188 138 255 129 163 115 88 240 136 }
7 }
8 [
9     "Hello world from the openssl binding" >byte-array
10     "md5" <openssl-checksum> checksum-bytes
11 ] unit-test
12
13 {
14   B{ 63 113 237 255 181 5 152 241 136 181 43 95 160 105 44 87 49 82 115 0 }
15 }
16 [
17     "Hello world from the openssl binding" >byte-array
18     "sha1" <openssl-checksum> checksum-bytes
19 ] unit-test
20
21 [
22     "Bad checksum test" >byte-array
23     "no such checksum" <openssl-checksum>
24     checksum-bytes
25 ] [ { [ unknown-digest? ] [ name>> "no such checksum" = ] } 1&& ]
26 must-fail-with
27
28 { } [ image openssl-sha1 checksum-file drop ] unit-test