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
IN: serialize.tests
: test-serialize-cell ( a -- ? )
2^ random dup
: (test-serialize-cell) ( n -- ? )
dup
binary [ serialize-cell ] with-byte-writer
binary [ deserialize-cell ] with-byte-reader = ;
: test-serialize-cell ( a -- ? )
2^ random (test-serialize-cell) ;
{ t } [
100 [
drop
@ -26,6 +29,11 @@ IN: serialize.tests
] all-integers?
] unit-test
{ t } [ 2000 [
2^ 3 [ 1 - + (test-serialize-cell) ] with all-integers?
] all-integers?
] unit-test
TUPLE: serialize-test a b ;
C: <serialize-test> serialize-test