TestCase
Interface
interface TestCase { event void run(); command void done(); }
Description
The TestControl and TestCase interfaces are identical in the commands and events they provide. This is to make it easier to program so interface names don't conflict.
Any time you implement the run() event, you MUST call back to the interface that commanded the run() event and tell it you're done()!
The TestCase interface can be found in tinyos-2.x-contrib/tunit/tos/interfaces/TestCase.nc
Examples
configuration MyTestC { } implementation { components MyTestP, new TestCaseC() as MyFirstTestC, new TestCaseC() as MySecondTestC; MyTestP.MyFirstTest -> MyFirstTestC; MyTestP.MySecondTest -> MySecondTestC; }
#include "TestCase.h" module MyTestP { uses { interface TestCase as MyFirstTest; interface TestCase as MySecondTest; } } implementation { event void MyFirstTest.run() { assertTrue("False!", TRUE); call MyFirstTest.done(); // <-- IMPORTANT } event void MySecondTest.run() { assertEquals("You can't multiply", 9, 3*3); call MySecondTest.done(); // <-- IMPORTANT } }