aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorVasilis Kalintiris <ehostunreach@gmail.com>2013-12-07 16:53:36 +0200
committerVasilis Kalintiris <ehostunreach@gmail.com>2013-12-07 19:36:01 +0200
commitfd27a14bc2d192ccbb3266f0f8188e5b371b1ebe (patch)
tree951f62baede73f6fc342ff323aef186e3e73be32 /tests
parent9669423b703fc50f7acbf9f640743669cf893bcc (diff)
Use do_run_from_file() for test_stdvec
Diffstat (limited to 'tests')
-rw-r--r--tests/core/test_stdvec.in31
-rw-r--r--tests/core/test_stdvec.out2
-rw-r--r--tests/test_core.py34
3 files changed, 36 insertions, 31 deletions
diff --git a/tests/core/test_stdvec.in b/tests/core/test_stdvec.in
new file mode 100644
index 00000000..884933c2
--- /dev/null
+++ b/tests/core/test_stdvec.in
@@ -0,0 +1,31 @@
+
+ #include <vector>
+ #include <stdio.h>
+
+ struct S {
+ int a;
+ float b;
+ };
+
+ void foo(int a, float b)
+ {
+ printf("%d:%.2f\n", a, b);
+ }
+
+ int main ( int argc, char *argv[] )
+ {
+ std::vector<S> ar;
+ S s;
+
+ s.a = 789;
+ s.b = 123.456f;
+ ar.push_back(s);
+
+ s.a = 0;
+ s.b = 100.1f;
+ ar.push_back(s);
+
+ foo(ar[0].a, ar[0].b);
+ foo(ar[1].a, ar[1].b);
+ }
+ \ No newline at end of file
diff --git a/tests/core/test_stdvec.out b/tests/core/test_stdvec.out
new file mode 100644
index 00000000..cb3a61fc
--- /dev/null
+++ b/tests/core/test_stdvec.out
@@ -0,0 +1,2 @@
+789:123.46
+0:100.1 \ No newline at end of file
diff --git a/tests/test_core.py b/tests/test_core.py
index 47a39ba7..228de112 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -4258,39 +4258,11 @@ PORT: 3979
def test_stdvec(self):
if self.emcc_args is None: return self.skip('requires emcc')
- src = '''
- #include <vector>
- #include <stdio.h>
-
- struct S {
- int a;
- float b;
- };
- void foo(int a, float b)
- {
- printf("%d:%.2f\\n", a, b);
- }
-
- int main ( int argc, char *argv[] )
- {
- std::vector<S> ar;
- S s;
-
- s.a = 789;
- s.b = 123.456f;
- ar.push_back(s);
-
- s.a = 0;
- s.b = 100.1f;
- ar.push_back(s);
-
- foo(ar[0].a, ar[0].b);
- foo(ar[1].a, ar[1].b);
- }
- '''
+ test_path = path_from_root('tests', 'core', 'test_stdvec')
+ src, output = (test_path + s for s in ('.in', '.out'))
- self.do_run(src, '789:123.46\n0:100.1')
+ self.do_run_from_file(src, output)
def test_reinterpreted_ptrs(self):
if self.emcc_args is None: return self.skip('needs emcc and libc')