aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/variables.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/variables.c')
-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;