serialize, test cells around first 2000 powers of 2

db4
Jon Harper 2015-08-08 01:19:14 +02:00 committed by John Benediktsson
parent a51f2a32d0
commit b5c3252d1d
1 changed files with 10 additions and 2 deletions

View File

@ -9,11 +9,14 @@ combinators.short-circuit ;
SPECIALIZED-ARRAY: double SPECIALIZED-ARRAY: double
IN: serialize.tests IN: serialize.tests
: test-serialize-cell ( a -- ? ) : (test-serialize-cell) ( n -- ? )
2^ random dup dup
binary [ serialize-cell ] with-byte-writer binary [ serialize-cell ] with-byte-writer
binary [ deserialize-cell ] with-byte-reader = ; binary [ deserialize-cell ] with-byte-reader = ;
: test-serialize-cell ( a -- ? )
2^ random (test-serialize-cell) ;
{ t } [ { t } [
100 [ 100 [
drop drop
@ -26,6 +29,11 @@ IN: serialize.tests
] all-integers? ] all-integers?
] unit-test ] unit-test
{ t } [ 2000 [
2^ 3 [ 1 - + (test-serialize-cell) ] with all-integers?
] all-integers?
] unit-test
TUPLE: serialize-test a b ; TUPLE: serialize-test a b ;
C: <serialize-test> serialize-test C: <serialize-test> serialize-test