[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6. Settings

 
type 'a control                           
val get : 'a control → 'a                
val set : 'a control * 'a → unit         

Many run-time parameters can be adjusted before running your unit tests.

 
val gen_target : int option control       

Number of valid random cases to test. Default is 100.

 
val gen_max : int control                 

Maximum number of random cases to consider; stop after this many even if gen_target has not been reached. Default is 400.

 
val examples : int option control         

Maximum number of counter-examples to report. Default is 5.

 
val outstream : TextIO.outstream control  

Output stream for test results.

 
val column_width : int control            

Width of test name column. Its interpretation depends on the output style. Default is 22.

 
val show_stats : bool control             

Show distribution of test cases. Default is true.

 
val style :                               
    { name: string,
      ctor: string →
            { status: string option * Property.result 
                      * Property.stats → unit,
              finish: Property.stats → bool } } control

This controls the style of the output. See below.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.1 Pluggable output styles

The default output style (PerlStyle.style) is modeled after the unit-testing framework for Perl. It makes room for statistics and counter-examples, while leaving clear a column down the middle where the "ok/FAILED" results can be easily read. The Perl style uses the carriage return character \r to update the current line with each test – this is a useful progress indicator for tests that take a long time.

Output styles are completely configurable just by writing a function of a particular type. An alternate style is provided, which is meant to mesh well with the output of the SML/NJ Compilation Manager (CM), like this:

 
 › [testing Bool/to-from... ok]
 › [testing Bool/from-to... ok]
 › [testing Bool/valid... FAILED]
 › Bool/valid:1.0 Error: False
 › Bool/valid:2.0 Error: True

To select this style, just do:

 
    Settings.set(Settings.style, CMStyle.style);

[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

This document was generated by Chris League on April, 14 2008 using texi2html 1.78.