File: Shared.cpp

package info (click to toggle)
storm-lang 0.7.0-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 51,832 kB
  • sloc: ansic: 261,420; cpp: 138,870; sh: 14,877; perl: 9,846; python: 2,525; lisp: 2,504; asm: 860; makefile: 678; pascal: 70; java: 52; xml: 37; awk: 12
file content (29 lines) | stat: -rw-r--r-- 1,001 bytes parent folder | download | duplicates (2)
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