1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
#include "stdafx.h"
#include "Fn.h"
// We don't build the Shared .so-file on Debian - the test don't add anything at this point.
BEGIN_TESTX(Shared, Storm) {
Engine &e = gEngine();
// Try to load an external library.
CHECK_EQ(runFn<Int>(S("tests.shared.test"), 10), 11);
// Does the types get resolved properly?
CHECK_EQ(runFn<Int>(S("tests.shared.test"), new (e) Str(S("A"))), 1);
// Does template classes work properly?
Array<Int> *v = new (e) Array<Int>();
v->push(1);
v->push(2);
v->push(3);
CHECK_EQ(runFn<Int>(S("tests.shared.test"), v), 6);
// Check so that we have the same idea about which threads are which.
CHECK_EQ(runFn<Thread *>(S("tests.shared.testThread"), 0), Compiler::thread(e));
CHECK_NEQ(runFn<Thread *>(S("tests.shared.testThread"), 1), Compiler::thread(e));
// Try to create some global data in the shared library!
CHECK_EQ(toS(runFn<Object *>(S("tests.shared.global"))), L"1");
CHECK_EQ(toS(runFn<Object *>(S("tests.shared.global"))), L"2");
} END_TEST
|