Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

which unit testing library?

6 views
Skip to first unread message

Tamas Papp

unread,
Aug 11, 2007, 2:32:21 AM8/11/07
to
I would like to add serious testing (as opposed to ad-hoc test
functions) to the library I am working on. I found many unit testing
frameworks on cliki.net, and I would appreciate some advice on which
one to choose.

My code is numerical, and I am mostly doing stuff like this: create a
random matrix, perform operations on it, check some invariant or
condition.

Thanks,

Tamas

Frank Buss

unread,
Aug 11, 2007, 4:11:54 AM8/11/07
to
Tamas Papp wrote:

> I would like to add serious testing (as opposed to ad-hoc test
> functions) to the library I am working on. I found many unit testing
> frameworks on cliki.net, and I would appreciate some advice on which
> one to choose.

I didn't know the libraries and maybe they are better, but you could write
it in just a few lines yourself:

(defparameter *test-count* 0)
(defparameter *test-failed* 0)

(defmacro test-form (form)
`(progn
(incf *test-count*)
(unless ,form
(format t "test failed: ~s~%" (quote ,form))
(incf *test-failed*))))

(defun test ()
(setf *test-count* 0
*test-failed* 0)

(test-form (equal (* 2 3) 6))
(test-form (equal (* 4 4) 15))
(test-form (equal (+ 1 2) 3))

(format t "summary: tests executed: ~a, tests failed: ~s~%"
*test-count* *test-failed*))

CL-USER > (test)
test failed: (EQUAL (* 4 4) 15)
summary: tests executed: 3, tests failed: 1

--
Frank Buss, f...@frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de

Rainer Joswig

unread,
Aug 11, 2007, 7:01:46 AM8/11/07
to
In article <gv4zeypkom3j$.ous7veof4aw4$.d...@40tude.net>,
Frank Buss <f...@frank-buss.de> wrote:

Come on. He wanted 'serious testing'. Your code does not even
deal with error conditions...

Look instead here:

http://www.cs.northwestern.edu/academics/courses/325/readings/lisp-unit.html

--
http://lispm.dyndns.org

Frank Buss

unread,
Aug 11, 2007, 7:38:48 AM8/11/07
to
Rainer Joswig wrote:

> Come on. He wanted 'serious testing'. Your code does not even
> deal with error conditions...

I translated "serious" with "regression testing", which my code does. Error
conditions could be catched and compared in a test-form, too.

Thanks, this looks much better, if "serious" is translated to "full
featured library with lots of useful functions and macros" :-)

hankhero

unread,
Aug 13, 2007, 4:27:13 AM8/13/07
to
On Aug 11, 8:32 am, Tamas Papp <tkp...@gmail.com> wrote:
> I would like to add serious testing (as opposed to ad-hoc test
> functions) to the library I am working on. I found many unit testing
> frameworks on cliki.net, and I would appreciate some advice on which
> one to choose.

Here is a comparision:
http://aperiodic.net/phil/archives/Geekery/notes-on-lisp-testing-frameworks.html

You should choose a Lisp framework rather that an xUnit clone. I use
FiveAM and like it a lot.

Tamas Papp

unread,
Aug 13, 2007, 4:53:38 AM8/13/07
to
hankhero <henrik...@gmail.com> writes:

Thanks for all the answers. I think I will try lisp-unit first.

Tamas

0 new messages