aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-02-05 23:51:26 +0900
committernsfisis <nsfisis@gmail.com>2026-02-06 00:01:34 +0900
commit3633f9a1f4f7638355beba85c53a2bb2ab0e3976 (patch)
tree58dd3231c5580d770defc2268ffe75dd87c11dec /tests
parent0dcaa7de7208bbcd56624011a43bac66f5dee44b (diff)
downloadducc-3633f9a1f4f7638355beba85c53a2bb2ab0e3976.tar.gz
ducc-3633f9a1f4f7638355beba85c53a2bb2ab0e3976.tar.zst
ducc-3633f9a1f4f7638355beba85c53a2bb2ab0e3976.zip
feat: implement more complex initializer
Diffstat (limited to 'tests')
-rw-r--r--tests/variables.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/variables.c b/tests/variables.c
index 0be59a3..9ba505e 100644
--- a/tests/variables.c
+++ b/tests/variables.c
@@ -20,6 +20,14 @@ char arr1[3] = {65, 66, 67};
short arr2[3] = {10, 20, 30};
int arr3[3] = {1, 2, 3};
+struct S {
+ int x, y;
+};
+struct S arr4[] = {
+ {1, 2},
+ {3, 4},
+};
+
int main() {
// global variables
*g_b = 123;
@@ -52,6 +60,11 @@ int main() {
ASSERT_EQ(2, arr3[1]);
ASSERT_EQ(3, arr3[2]);
+ ASSERT_EQ(1, arr4[0].x);
+ ASSERT_EQ(2, arr4[0].y);
+ ASSERT_EQ(3, arr4[1].x);
+ ASSERT_EQ(4, arr4[1].y);
+
// local variables
int foo;
foo = 42;