[PD-dev] unit tests!

Mathieu Bouchard matju at artengine.ca
Thu Dec 29 23:47:31 CET 2005


On Thu, 29 Dec 2005, Tim Blechmann wrote:

> > 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:
> i intended assert to be an object without overhead... but i also like
> your generalisation. 

What do you mean without overhead? The overhead only happens when an error
occurs. Printing the error in the Tk console has much more overhead than
doing a string concat. The other feature is important and because of that 
I wouldn't use your [assert] because it doesn't support it.

> the only problem i see is, that i'd like to switch off the runtime
> overhead in performance mode

Just delete assert.pd_linux and restart Pd. Then all [assert]s will be 
disabled.

> and check the asserts only in debug mode,

Oh ok, the checking is completely done outside of your [assert] or my
[error], which is exactly why I decided to call it [error] and not
[assert]. It's not at all their responsibility to perform the actual
checks. If you want to disable the checks you can use a bunch of [spigot]s
or [demux]es or such.

> which would be either a canvas property or a global property ...
> (unfortunately this distinction doesn't really exist in pd)

You are thinking about Contracts and not UnitTests. Contracts are runtime 
things that you may enable or disable. As it is, I don't know how to do 
them. However, UnitTests are easier but lie outside of normal execution 
of patches.

 _ _ __ ___ _____ ________ _____________ _____________________ ...
| 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