aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-02-01 12:56:38 +0900
committernsfisis <nsfisis@gmail.com>2026-02-01 12:56:38 +0900
commit0dcaa7de7208bbcd56624011a43bac66f5dee44b (patch)
treef93385ab8e7e7f562bada428543a5e8066563899 /tests
parent385d2e3722c22e788230c1cfba679356fbdd2d0a (diff)
downloadducc-0dcaa7de7208bbcd56624011a43bac66f5dee44b.tar.gz
ducc-0dcaa7de7208bbcd56624011a43bac66f5dee44b.tar.zst
ducc-0dcaa7de7208bbcd56624011a43bac66f5dee44b.zip
feat: implement array global variables
Diffstat (limited to 'tests')
-rw-r--r--tests/variables.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/variables.c b/tests/variables.c
index 228a625..0be59a3 100644
--- a/tests/variables.c
+++ b/tests/variables.c
@@ -16,6 +16,10 @@ int g_k = 999;
char g_l[6] = "hello";
+char arr1[3] = {65, 66, 67};
+short arr2[3] = {10, 20, 30};
+int arr3[3] = {1, 2, 3};
+
int main() {
// global variables
*g_b = 123;
@@ -36,6 +40,18 @@ int main() {
ASSERT_EQ(0, strcmp("hello", g_l));
+ ASSERT_EQ(65, arr1[0]);
+ ASSERT_EQ(66, arr1[1]);
+ ASSERT_EQ(67, arr1[2]);
+
+ ASSERT_EQ(10, arr2[0]);
+ ASSERT_EQ(20, arr2[1]);
+ ASSERT_EQ(30, arr2[2]);
+
+ ASSERT_EQ(1, arr3[0]);
+ ASSERT_EQ(2, arr3[1]);
+ ASSERT_EQ(3, arr3[2]);
+
// local variables
int foo;
foo = 42;