aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-02-02 23:13:52 +0900
committernsfisis <nsfisis@gmail.com>2026-02-02 23:13:52 +0900
commit8fc33c3f2f4cbfbd770cb432639b1abe7d456d6d (patch)
tree149320cbdbee35f0540893b481d31a015b9335ea
parent0dcaa7de7208bbcd56624011a43bac66f5dee44b (diff)
downloadducc-feat/complex-init.tar.gz
ducc-feat/complex-init.tar.zst
ducc-feat/complex-init.zip
-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..dada3fe 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[2].y);
+
// local variables
int foo;
foo = 42;