aboutsummaryrefslogtreecommitdiff
path: root/tests/test_core.py
diff options
context:
space:
mode:
authorVasilis Kalintiris <ehostunreach@gmail.com>2013-12-07 14:17:38 +0200
committerVasilis Kalintiris <ehostunreach@gmail.com>2013-12-07 19:35:58 +0200
commit46a2bf30fb1f52b88de44776158ac110cdef530e (patch)
tree4f28bbfc6f7440e303d0cd77fcc0ebd21670760d /tests/test_core.py
parent621ed6c081c49d9b6ffc76d58d6898350f9c5411 (diff)
Use do_run_from_file() for test_statics
Diffstat (limited to 'tests/test_core.py')
-rw-r--r--tests/test_core.py42
1 files changed, 3 insertions, 39 deletions
diff --git a/tests/test_core.py b/tests/test_core.py
index a69764eb..f1fbae7a 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -2507,46 +2507,10 @@ The current type of b is: 9
Settings.SAFE_HEAP = 3
Settings.SAFE_HEAP_LINES = ['src.cpp:19', 'src.cpp:26', 'src.cpp:28']
- src = '''
- #include <stdio.h>
- #include <string.h>
-
- #define CONSTRLEN 32
-
- char * (*func)(char *, const char *) = NULL;
-
- void conoutfv(const char *fmt)
- {
- static char buf[CONSTRLEN];
- func(buf, fmt); // call by function pointer to make sure we test strcpy here
- puts(buf);
- }
-
- struct XYZ {
- float x, y, z;
- XYZ(float a, float b, float c) : x(a), y(b), z(c) { }
- static const XYZ& getIdentity()
- {
- static XYZ iT(1,2,3);
- return iT;
- }
- };
- struct S {
- static const XYZ& getIdentity()
- {
- static const XYZ iT(XYZ::getIdentity());
- return iT;
- }
- };
+ test_path = path_from_root('tests', 'core', 'test_statics')
+ src, output = (test_path + s for s in ('.in', '.out'))
- int main() {
- func = &strcpy;
- conoutfv("*staticccz*");
- printf("*%.2f,%.2f,%.2f*\\n", S::getIdentity().x, S::getIdentity().y, S::getIdentity().z);
- return 0;
- }
- '''
- self.do_run(src, '*staticccz*\n*1.00,2.00,3.00*')
+ self.do_run_from_file(src, output)
def test_copyop(self):
if self.emcc_args is None: return self.skip('requires emcc')