aboutsummaryrefslogtreecommitdiff
path: root/tests/test_core.py
diff options
context:
space:
mode:
authorVasilis Kalintiris <ehostunreach@gmail.com>2013-12-07 17:03:09 +0200
committerVasilis Kalintiris <ehostunreach@gmail.com>2013-12-07 19:36:01 +0200
commit77bc19e22629ca314c5b5c85f2c45c7ee5e2e8e4 (patch)
tree148ef8d9b8d105fa5b7c3d632934129840d32db2 /tests/test_core.py
parentfd27a14bc2d192ccbb3266f0f8188e5b371b1ebe (diff)
Use do_run_from_file() for test_reinterpreted_ptrs
Diffstat (limited to 'tests/test_core.py')
-rw-r--r--tests/test_core.py45
1 files changed, 3 insertions, 42 deletions
diff --git a/tests/test_core.py b/tests/test_core.py
index 228de112..c0612760 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -4267,49 +4267,10 @@ PORT: 3979
def test_reinterpreted_ptrs(self):
if self.emcc_args is None: return self.skip('needs emcc and libc')
- src = r'''
-#include <stdio.h>
-
-class Foo {
-private:
- float bar;
-public:
- int baz;
-
- Foo(): bar(0), baz(4711) {};
-
- int getBar() const;
-};
-
-int Foo::getBar() const {
- return this->bar;
-};
-
-const Foo *magic1 = reinterpret_cast<Foo*>(0xDEAD111F);
-const Foo *magic2 = reinterpret_cast<Foo*>(0xDEAD888F);
-
-static void runTest() {
-
- const Foo *a = new Foo();
- const Foo *b = a;
-
- if (a->getBar() == 0) {
- if (a->baz == 4712)
- b = magic1;
- else
- b = magic2;
- }
-
- printf("%s\n", (b == magic1 ? "magic1" : (b == magic2 ? "magic2" : "neither")));
-};
+ test_path = path_from_root('tests', 'core', 'test_reinterpreted_ptrs')
+ src, output = (test_path + s for s in ('.in', '.out'))
-extern "C" {
- int main(int argc, char **argv) {
- runTest();
- }
-}
-'''
- self.do_run(src, 'magic2')
+ self.do_run_from_file(src, output)
def test_jansson(self):
return self.skip('currently broken')