Google Groups unterstützt keine neuen Usenet-Beiträge oder ‑Abos mehr. Bisherige Inhalte sind weiterhin sichtbar.

which unit testing library?

6 Aufrufe
Direkt zur ersten ungelesenen Nachricht

Tamas Papp

ungelesen,
11.08.2007, 02:32:2111.08.07
an
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

ungelesen,
11.08.2007, 04:11:5411.08.07
an
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

ungelesen,
11.08.2007, 07:01:4611.08.07
an
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

ungelesen,
11.08.2007, 07:38:4811.08.07
an
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

ungelesen,
13.08.2007, 04:27:1313.08.07
an
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

ungelesen,
13.08.2007, 04:53:3813.08.07
an
hankhero <henrik...@gmail.com> writes:

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

Tamas

0 neue Nachrichten