aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/core/test_bigarray.in19
-rw-r--r--tests/core/test_bigarray.out1
-rw-r--r--tests/test_core.py22
3 files changed, 23 insertions, 19 deletions
diff --git a/tests/core/test_bigarray.in b/tests/core/test_bigarray.in
new file mode 100644
index 00000000..0255c207
--- /dev/null
+++ b/tests/core/test_bigarray.in
@@ -0,0 +1,19 @@
+
+// avoid "array initializer too large" errors
+ #include <stdio.h>
+ #include <assert.h>
+
+ #define SIZE (1024*100)
+ struct Struct {
+ char x;
+ int y;
+ };
+ Struct buffy[SIZE];
+
+ int main() {
+ for (int i = 0; i < SIZE; i++) { assert(buffy[i].x == 0 && buffy[i].y == 0); } // we were zeroinitialized
+ for (int i = 0; i < SIZE; i++) { buffy[i].x = i*i; buffy[i].y = i*i*i; } // we can save data
+ printf("*%d*\n", buffy[SIZE/3].x);
+ return 0;
+ }
+
diff --git a/tests/core/test_bigarray.out b/tests/core/test_bigarray.out
new file mode 100644
index 00000000..33485c46
--- /dev/null
+++ b/tests/core/test_bigarray.out
@@ -0,0 +1 @@
+*57* \ No newline at end of file
diff --git a/tests/test_core.py b/tests/test_core.py
index f5285db0..e5874a6a 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -1739,26 +1739,10 @@ class T(RunnerCore): # Short name, to make it more fun to use manually on the co
def test_bigarray(self):
if self.emcc_args is None: return self.skip('need ta2 to compress type data on zeroinitializers')
- # avoid "array initializer too large" errors
- src = r'''
- #include <stdio.h>
- #include <assert.h>
-
- #define SIZE (1024*100)
- struct Struct {
- char x;
- int y;
- };
- Struct buffy[SIZE];
+ test_path = path_from_root('tests', 'core', 'test_bigarray')
+ src, output = (test_path + s for s in ('.in', '.out'))
- int main() {
- for (int i = 0; i < SIZE; i++) { assert(buffy[i].x == 0 && buffy[i].y == 0); } // we were zeroinitialized
- for (int i = 0; i < SIZE; i++) { buffy[i].x = i*i; buffy[i].y = i*i*i; } // we can save data
- printf("*%d*\n", buffy[SIZE/3].x);
- return 0;
- }
- '''
- self.do_run(src, '*57*')
+ self.do_run_from_file(src, output)
def test_mod_globalstruct(self):
src = '''