Changeset 25390 in project


Ignore:
Timestamp:
10/19/11 23:39:01 (9 years ago)
Author:
svnwiki
Message:

Anonymous wiki edit for IP [129.174.190.17]:

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/4/cluckcheck

    r25388 r25390  
    2727Generate a random integer.
    2828
    29         > (use (prefix cluckcheck cluckcheck:))
    30         > (cluckcheck:gen-int)
     29        > (use cluckcheck)
     30        > (gen-int)
    3131        180
    3232
     
    3535Generate a random boolean.
    3636
    37         > (cluckcheck:gen-bool)
     37        > (gen-bool)
    3838        #t
    3939
     
    4242Generate a random character.
    4343
    44         > (cluckcheck:gen-char)
     44        > (gen-char)
    4545        #\g
    4646
     
    4949Generate a random list populated by gen.
    5050
    51         > (cluckcheck:gen-list cluckcheck:gen-int)
     51        > (gen-list gen-int)
    5252        (103 24 45 253 227 28 92 45 235 193 212 27 9 195 224 228 103 255)
    5353
     
    5858Generate a random string. gen-string is a wrapper around (gen-list gen-char).
    5959
    60         > (cluckcheck:gen-string)
     60        > (gen-string)
    6161        "\x05&o@\by\x00J &\x00\v\x1691\x05\x19\x14z\r<VxU\x1b\x06~(wE\x05\x03LB&T\x1fLl-\x15\x06"
    6262
     
    6565Tests a property function with values generated by the generator functions. If the property returns false, testing halts and the offending input values are printed to the screen.
    6666
    67         > (define (is-even n)
    68                 (= 0 (modulo n 2)))
    69         > (cluckcheck:for-all is-even cluckcheck:gen-int)
     67        > (for-all even? gen-int)
    7068        *** Failed!
    7169        (57)
     70
     71Here, the test fails because an integer (57) is found, that is not even.
    7272
    7373For more examples, see [[https://github.com/mcandre/cluckcheck/blob/master/example.scm|example.scm]].
Note: See TracChangeset for help on using the changeset viewer.