aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-09-11 14:58:32 -0700
committerAlon Zakai <alonzakai@gmail.com>2012-09-11 14:58:32 -0700
commit91ae9b1233ba658bcbd4d8b59e8dc30e69548012 (patch)
treea0f4b39fcca3ec4342fb11935b7188c2de0fb163 /tests
parent2c815155ae7f8bf5e5022e58c42d61720df37894 (diff)
compress type info of zeroinitializers in ta2
Diffstat (limited to 'tests')
-rwxr-xr-xtests/runner.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/runner.py b/tests/runner.py
index a089d7b8..513a0434 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -2466,6 +2466,30 @@ c5,de,15,8a
'''
self.do_run(src, '*70,97,15,3,3029,90*')
+ 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];
+
+ 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*')
+
def test_mod_globalstruct(self):
src = '''
#include <stdio.h>