Skip to content

Commit

Permalink
Merge pull request #1 from mattknox/master
Browse files Browse the repository at this point in the history
gen-byte needed to be modulus'd
  • Loading branch information
mcandre committed Aug 26, 2011
2 parents a6c9d4d + 7533bcc commit cb12abd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions factcheck/factcheck.factor
Expand Up @@ -8,7 +8,7 @@ IN: factcheck
: gen-bool ( -- ? ) gen-integer even? ;

! A quotation generating a random byte.
: gen-byte ( -- n ) gen-integer 256 ;
: gen-byte ( -- n ) gen-integer 256 mod ;

! A quotation generating a random character.
: gen-char ( -- ch ) gen-integer 128 mod ;
Expand All @@ -22,9 +22,9 @@ IN: factcheck
! If the fact holds true for the generated values, print success.
! Otherwise, print the offending values.
:: for-all ( fact: ( ..a -- ? ) generator: ( -- ..a ) -- )
100 iota [ drop
100 iota [ drop
generator { } output>sequence :> generated
generated fact input<sequence :> ok?
ok? [ "*** Failed!" print generated . ] unless
ok? not
] find drop not [ "+++ OK, passed 100 tests." print ] when ; inline
] find drop not [ "+++ OK, passed 100 tests." print ] when ; inline

0 comments on commit cb12abd

Please sign in to comment.