www.delorie.com/gnu/docs/greg/greg_23.html   search  
 
Buy GNU books!


Greg testing framework

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

6.0.6 greg-testcase

The greg-testcase procedure takes three arguments -

The Guile programming language permits the thunk to return in four ways -

As there are no other ways in which the thunk may be exited, it is impossible for a testcase to produce a result that doesn't fit into the framework (unless your testcase manages either to crash Guile or enter an infinite loop - in which case you won't get any output).

The value returned by the greg-testcase procedure is a boolean - #t if the test resulted in an expected pass, #f otherwise.
You can use this return value to make the execution of subsequent testcases dependent on the success of an earlier testcase.

 
;
; A testcase to check an instance of numeric addition
;
(greg-testcase "One plus One is two" #t
(lambda ()
  (eq? (+ 1 1 ) 2)
))

;
;  The above testcase will generate output -
;  `PASS: One plus One is two'
;

The system provides hooks for general purpose procedures that are automatically called immediately before and after each testcase is executed. These procedures can be used to perform additional logging or other housekeeping functions. -

While a testcase is executing (or in the greg-case-begin or greg-case-end procedures) there are a number of public procedures that may be used to obtain information about the system -


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

  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003