A simple testing library

Joseph Donaldson <[email protected]>
Newsgroups gmane.lisp.scheme.bigloo
Message-ID <[email protected]>
Hello, All,

I have put together a simple testing library that others may find useful. It can be found at https://github.com/donaldsonjw/btest. It supports two different interfaces. The first duplicates the interface provided by the pthread recette. Hence, tests are defined with a define-test macro. Below is a simple example. 

(define-test test-empty-list 
(list) :result (lambda (v) 
                               (if (eq? v 'result) "an empty list" (null? v))))


The second interface consists, primarily, of two macros, define-test-suite and test. Below is a simple example.

 (define-test-suite my-suite (let ((lst1 '(1 2 3)))

  (test "throws error exception"
 (assert-exception-thrown  (raise 5);(error "a" "b" "c")
    &error))

  (test "car of (1 2 3) = 1"
 (assert= (car lst1) 1))

  (test "car of (1 2 3) != 2"
 (assert-false (= (car lst1) 2)))
  ))

A more detailed description of both interfaces and their use can be found at the link above. 

Best Regards,
Joseph Donaldson
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.