aboutsummaryrefslogtreecommitdiff
path: root/tests/test_core.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_core.py')
-rw-r--r--tests/test_core.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/test_core.py b/tests/test_core.py
index 1dd07307..54fbdcd1 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -5432,6 +5432,34 @@ The current type of b is: 9
'''
self.do_run(src, 'memmove can be very useful....!')
+ def test_flexarray_struct(self):
+ src = r'''
+#include <stdint.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+typedef struct
+{
+ uint16_t length;
+ struct
+ {
+ int32_t int32;
+ } value[];
+} Tuple;
+
+int main() {
+ Tuple T[10];
+ Tuple *t = &T[0];
+
+ t->length = 4;
+ t->value->int32 = 100;
+
+ printf("(%d, %d)\n", t->length, t->value->int32);
+ return 0;
+}
+'''
+ self.do_run(src, '(4, 100)')
+
def test_bsearch(self):
if Settings.QUANTUM_SIZE == 1: return self.skip('Test cannot work with q1')