[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Thu, 11 Apr 2002 12:18:43 +1000
> Could Rhys or someone please post a quick HOWTO for writing pnetlib unit
(Caveat: until the cscc compiler works, tests won't be
much use. Sorry).
The "csunit" framework is a stripped-down version of
JUnit/NUnit, designed for automated tests within an
automake framework, but not much else.
For a background on unit testing in general, see the
"www.junit.org" Web site.
To build a test case, you inherit from the "TestCase"
and override "Setup" and "Cleanup" to set things up
for your test. Then, define a number of methods called
"TestX", "TestY", etc, for your various tests. There
are a bunch of "Assert" methods in "TestCase" that
can be used to test for success/failure cases.
The file "tests/System/TestBoolean.cs" provides an
example of what a test class would look like. You will
also need to add the test class to the "suite" for that
namespace. e.g. "tests/System/TestSystem.c".
Then "make check" will run the tests (but see the caveat
above - it won't actually work yet).
Even though the compiler is broken, people can still
write test cases in anticipation of the compiler working.
P.S. I know that the compiler problem is annoying, but
there's only one of me. Unless someone with real
compiler knowledge fronts up to help me out, it will
take a while longer.