aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/variables.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/tests/variables.c b/tests/variables.c
index 5f09074..2ba28d1 100644
--- a/tests/variables.c
+++ b/tests/variables.c
@@ -19,14 +19,22 @@ char arr1[3] = {65, 66, 67};
short arr2[3] = {10, 20, 30};
int arr3[3] = {1, 2, 3};
-struct S {
+struct S1 {
int x, y;
};
-struct S arr4[] = {
+struct S1 arr4[] = {
{1, 2},
{3, 4},
};
+struct S2 {
+ const char* x;
+};
+struct S2 arr5[] = {
+ {"foo"},
+ {"bar"},
+};
+
int main() {
// global variables
*g_b = 123;
@@ -64,6 +72,9 @@ int main() {
ASSERT_EQ(3, arr4[1].x);
ASSERT_EQ(4, arr4[1].y);
+ ASSERT_EQ_STR("foo", arr5[0].x);
+ ASSERT_EQ_STR("bar", arr5[1].x);
+
// local variables
int foo;
foo = 42;