> a = Add()
> a.adder(5)
> a.d # debug mode
> a.b(2) # b is a shortcut for 'bang'
[a:1] 7.00
@[a:1]@ indicates that outlet "1" of object "a" has sent the following signal (@7.00@, a floating point number).
h3. adding a number to a list
> a = Add()
> a.adder(4)
> a.d # debug mode
> a.b(2,3,10)
[a:1]
Let's start by writing the test file.
#include "test_helper.h"
class AddTest : public CxxTest::TestSuite, public ParseTest
{
public:
The class should inherit from @CxxTest::TestSuite@ (C++ testing infrastructure) and @ParseTest@ (command line simulation).
h3. testing initial/default conditions
Test methods should start with @test_@.
void test_initial_conditions( void )
{
setup("t=Add()\nt=>p");
assert_print("t.b(1)","1.00");
assert_print("t.b(2,3,10)","");
}
The *setup* method creates testing conditions. *assert_print* compares the command output with a result. You can omit the trailing end of line.
Note how we use the predefined @Print@ object named "p".
h3. testing numbers
void test_numbers( void )
{
setup("t=Add()\nt.adder(4)\nt=>p");
assert_print("t.b(1)","5.00");
assert_print("t.b(2,3,10)","");
}
h3. testing matrices
void test_matrix( void )
{
setup("t=Add()\nt.adder(1,1,2)\nt=>p");
assert_print("t.b(1,2,3)", "");
parse("b=Buffer(2)\nb.b(1,2,3)\nb=>t");
assert_print("b.b(4,5,6)\n","");
}
h3. errors
[TODO]
Funding from the Swiss Federal Office of Culture to write the graphical frontend to rubyk !
Moving from a global mutex to a global select/poll loop.