]> gitweb.factorcode.org Git - factor.git/blob - basis/checksums/murmur/murmur-tests.factor
core: map-integers -> map-integers-as
[factor.git] / basis / checksums / murmur / murmur-tests.factor
1 USING: byte-arrays checksums checksums.murmur kernel math
2 sequences tools.test ;
3
4 { 455139366 } [ "asdf" >byte-array 0 <murmur3-32> checksum-bytes ] unit-test
5 { 417250299 } [ "asdf" >byte-array 156 <murmur3-32> checksum-bytes ] unit-test
6 { 3902511862 } [ "abcde" >byte-array 0 <murmur3-32> checksum-bytes ] unit-test
7 { 2517562459 } [ "abcde" >byte-array 156 <murmur3-32> checksum-bytes ] unit-test
8 { 2444432334 } [ "12345678" >byte-array 0 <murmur3-32> checksum-bytes ] unit-test
9 { 2584512840 } [ "12345678" >byte-array 156 <murmur3-32> checksum-bytes ] unit-test
10 { 3560398725 } [ "hello, world!!!" >byte-array 156 <murmur3-32> checksum-bytes ] unit-test
11
12 {
13     {
14         3903553677
15         3120384252
16         3928660296
17         2995164002
18         500661690
19         2764333444
20         1941147762
21         161439790
22         2584512840
23         3803370487
24         626154228
25     }
26 } [
27     "1234567890" [ length 1 + ] keep 156 <murmur3-32>
28     '[ _ swap head _ checksum-bytes ] map-integers
29 ] unit-test
30
31
32 { t } [
33     "1234567890" dup >byte-array [
34         [ length 1 + ] keep 156 <murmur3-32>
35         '[ _ swap head _ checksum-bytes ] map-integers
36     ] bi@ =
37 ] unit-test