[chuck-users] parent and children classes (I meant polymorphism)
Michael Heuer
heuermh at gmail.com
Wed Jan 21 15:46:34 EST 2009
mike clemow wrote:
> // this doesn't work...
> //myCollection.pop() $ Event @=> Event f;
Are you sure that doesn't work? I swear I have been doing the same
with my collection classes.
>From ArrayListTest.ck:
class Foo
{
fun int foo()
{
return 1;
}
}
// unit test for ArrayList
class ArrayListTest extends Assert
{
{
true => exitOnFailure;
testConstructor();
testSize();
testGetAddSet();
testIterator();
testForEach();
testAssign();
testTransform();
testAddAll();
testFoo();
<<<"ArrayListTest ok">>>;
}
//...
fun void testFoo()
{
ArrayList list;
Foo fooIn;
list.add(fooIn);
list.get(0) $ Foo @=> Foo fooOut;
assertEquals(fooIn, fooOut);
<<<fooOut.foo()>>>;
}
}
...
[chuck](VM): sporking incoming shred: 1 (ArrayListTest.ck)...
1 :(int)
"ArrayListTest ok" : (string)
michael
More information about the chuck-users
mailing list