On 12/3/05, Chris Campbell <[EMAIL PROTECTED]> wrote:
Are there any freely available unit testing frameworks for Oz,
preferably MIT licensed or similar?

I don't know about complete frameworks, but doesn't Oz itself provide within the language itself most of what unit testers do? JUnit, for instance, consists mostly of an ASSERT package and provisions for bundling tests together in packages. In Oz, this would be a hierarchy of functors[1], and ASSERTS could be emulated with TELL errors. It's a little bit more complicated in Oz because of dataflow variables and possible deadlock; if you want to test function results a little bit more rigorously than TELL errors will allow you to, you could use the Test function from this package here:

http://faculty.cs.byu.edu/~irenelg/courses/330/CTM/HW/Help.oz

Usage:
{Test Procedure/Function-to-test record(arg1 arg2 arg3... arg3)}
Any arg can be used, except that an arg wrapped in a record "ex" (for "expect") has an unbound substituted in its place, and after the function is over that variable is then compared against the argument. Test takes either one testcase or a list of testcases and returns true if

Result1 = {Test Number.'+' testcase(4 5 ex(9))}  % 4 + 5 = 9, right?
Result2 = {Test Number.'+' testcase(4 _ ex(9))}  % Returns false w/ timeout error after two seconds
Result3 = {Test Number.'+' [testcase(1 1 ex(2)) testcase(1 3 ex(5)) testcase(~3 ~2 ex(~5))]} % Will
% return false because the second case fails. Reports "Input: 1 3 _    Expected: 1 3 5     Actual: 1 3 4".

You could use this package or write a similar one on your own, but between TELL errors and functors I think you've basically got a unit-testing package already.

Max Wilson

[1] If anyone wants to talk about how to emulate unit test suites using this, let's.

--
Be pretty if you are,
Be witty if you can,
But be cheerful if it kills you.
_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to