aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorVasilis Kalintiris <ehostunreach@gmail.com>2013-12-07 17:30:49 +0200
committerVasilis Kalintiris <ehostunreach@gmail.com>2013-12-07 19:36:02 +0200
commit85303af22543f32728cc2cfa55bee4c558c26631 (patch)
tree2d6155c455b5df80598b35874046d8456869c74b /tests
parent67356a7e2bfb3a039edab075a84d921569e8361b (diff)
Use do_run_from_file() for test_corruption_2
Diffstat (limited to 'tests')
-rw-r--r--tests/core/test_corruption_2.in26
-rw-r--r--tests/core/test_corruption_2.out2
-rw-r--r--tests/test_core.py29
3 files changed, 31 insertions, 26 deletions
diff --git a/tests/core/test_corruption_2.in b/tests/core/test_corruption_2.in
new file mode 100644
index 00000000..87aef9da
--- /dev/null
+++ b/tests/core/test_corruption_2.in
@@ -0,0 +1,26 @@
+
+ #include <iostream>
+ #include <fstream>
+ #include <stdlib.h>
+ #include <stdio.h>
+
+ void bye() {
+ printf("all ok\n");
+ }
+
+ int main() {
+ atexit(bye);
+
+ std::string testPath = "/Script/WA-KA.txt";
+ std::fstream str(testPath.c_str(), std::ios::in | std::ios::binary);
+
+ if (str.is_open())
+ {
+ std::cout << "open!" << std::endl;
+ } else {
+ std::cout << "missing!" << std::endl;
+ }
+
+ return 1;
+ }
+ \ No newline at end of file
diff --git a/tests/core/test_corruption_2.out b/tests/core/test_corruption_2.out
new file mode 100644
index 00000000..26795dba
--- /dev/null
+++ b/tests/core/test_corruption_2.out
@@ -0,0 +1,2 @@
+missing!
+all ok
diff --git a/tests/test_core.py b/tests/test_core.py
index c220541d..6fcff1c4 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -5109,33 +5109,10 @@ def process(filename):
Settings.CORRUPTION_CHECK = 1
# test for free(0), malloc(0), etc.
- src = r'''
- #include <iostream>
- #include <fstream>
- #include <stdlib.h>
- #include <stdio.h>
-
- void bye() {
- printf("all ok\n");
- }
-
- int main() {
- atexit(bye);
-
- std::string testPath = "/Script/WA-KA.txt";
- std::fstream str(testPath.c_str(), std::ios::in | std::ios::binary);
-
- if (str.is_open())
- {
- std::cout << "open!" << std::endl;
- } else {
- std::cout << "missing!" << std::endl;
- }
+ test_path = path_from_root('tests', 'core', 'test_corruption_2')
+ src, output = (test_path + s for s in ('.in', '.out'))
- return 1;
- }
- '''
- self.do_run(src, 'missing!\nall ok\n')
+ self.do_run_from_file(src, output)
def test_corruption_3(self):
if Settings.ASM_JS: return self.skip('cannot use corruption checks in asm')