[PD-dev] unit tests!

Mathieu Bouchard matju at artengine.ca
Thu Dec 29 23:15:51 CET 2005


On Thu, 29 Dec 2005, Tim Blechmann wrote:

> >  * failure: a test object reports a problem through outlet 0.
> how do you want it to be implemented? one object per patch, per canvas
> (like switch~) or globally?

I don't understand your question, but then maybe you misread something or 
that I miswrote something.

Test objects only test what they can.

If +-test.pd tests [+], it can test for hotness, coldness, it can test
that only one result is produced per hot message, that all results are
float, that a few example additions work, and that with random inputs it
respects commutativity, associativity, invertibility, within appropriate
relative-error bounds, etc.

However +-test.pd can't test that errormessages aren't printed during the 
testing. This may be something that we want to check for, and currently 
the best way to handle it is to search the console for error messages, and 
if there are any, restart the tests in verbose mode and see where the 
error happens exactly.

> i'd also suggest the addition of an assert object, that's similar to my
> external on the cvs...

ok, I think that given what yours do, it should be called [error]. Also it
should take an optional argument which would either be a float (e.g.  the
$0 of the enclosing abstraction) or a pointer. It would have one inlet, no
outlet, and support the following messages:

  set $scapegoat:
    replaces the originator of the message by $scapegoat, which can be a
    float or a pointer

  error $1 ...:
    causes its arguments to be concatenated, space-separated (may include
    floats), and then sent through pd_error using the appropriate
    originator (scapegoat).

  list $1 ...:
    for future use. would use pd_error2() (see README or previous mail).
    $1 has to be a symbol.

 _ _ __ ___ _____ ________ _____________ _____________________ ...
| Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju
| Freelance Digital Arts Engineer, Montréal QC Canada




More information about the Pd-dev mailing list