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
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, ··@frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de
In article <·······························@40tude.net>,
Frank Buss <··@frank-buss.de> wrote:
> 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
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
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.
> Look instead here:
>
> http://www.cs.northwestern.edu/academics/courses/325/readings/lisp-unit.html
Thanks, this looks much better, if "serious" is translated to "full
featured library with lots of useful functions and macros" :-)
--
Frank Buss, ··@frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de
On Aug 11, 8:32 am, Tamas Papp <······@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.
hankhero <·············@gmail.com> writes:
> On Aug 11, 8:32 am, Tamas Papp <······@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.
Thanks for all the answers. I think I will try lisp-unit first.
Tamas