factor/basis/hash2/hash2-tests.factor

18 lines
490 B
Factor
Raw Normal View History

2007-09-20 18:09:08 -04:00
USING: tools.test hash2 kernel ;
2008-03-08 05:27:19 -05:00
IN: hash2.tests
2007-09-20 18:09:08 -04:00
2009-02-02 15:26:54 -05:00
[ t ] [ 1 2 { 1 2 } 2= ] unit-test
[ f ] [ 1 3 { 1 2 } 2= ] unit-test
2009-04-17 15:44:08 -04:00
: sample-hash ( -- hash )
2007-09-20 18:09:08 -04:00
5 <hash2>
dup 2 3 "foo" roll set-hash2
dup 4 2 "bar" roll set-hash2
dup 4 7 "other" roll set-hash2 ;
[ "foo" ] [ 2 3 sample-hash hash2 ] unit-test
[ "bar" ] [ 4 2 sample-hash hash2 ] unit-test
[ "other" ] [ 4 7 sample-hash hash2 ] unit-test
[ f ] [ 4 12 sample-hash hash2 ] unit-test
[ f ] [ 1 1 sample-hash hash2 ] unit-test