Skip to content

Commit fea2b0d

Browse files
committed
Add test for multi-dimensional arrays
1 parent 8dd5ab6 commit fea2b0d

File tree

4 files changed

+18
-0
lines changed

4 files changed

+18
-0
lines changed

main/tests/bin/diff1

7.18 KB
Binary file not shown.

main/tests/bin/diff2

7.4 KB
Binary file not shown.

main/tests/src/diff.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,6 +1026,23 @@ EXPECT(
10261026
"+ \tsize: 2\n",
10271027
"\n")
10281028

1029+
#undef T
1030+
#define T variable_diff_size_multi
1031+
#ifdef TEST1
1032+
char T[1][3];
1033+
#endif
1034+
#ifdef TEST2
1035+
char T[2][4];
1036+
#endif
1037+
EXPECT(
1038+
T,
1039+
"- var ", S(T), ": [char; 1, 3]\n",
1040+
"+ var ", S(T), ": [char; 2, 4]\n",
1041+
"[..]",
1042+
"- \tsize: 3\n",
1043+
"+ \tsize: 8\n",
1044+
"\n")
1045+
10291046
#undef T
10301047
#define T variable_diff_decl
10311048
#ifdef SUPPORT

main/tests/src/diff.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,5 @@ test!(function_diff_return_type, " fn ", "function_diff_return_type", "\n", "[.
4545
test!(function_diff_variables, " fn ", "function_diff_variables", "\n", "[..]\n", " \tvariables:\n", "- \t\t[1]\ta: char\n", "+ \t\t[1]\tb: char\n", " \t\t[1]\tc: char\n", "- \t\t[1]\td: char\n", "+ \t\t[4]\td: int\n", "- \t\t[1]\te: char\n", "+ \t\t[1]\tf: char\n", "- \t\t[4]\textra: int\n", " \t\t[1]\tg: char\n", "\n");
4646
test!(variable_equal, "");
4747
test!(variable_diff_size, "- var ", "variable_diff_size", ": [char; 1]\n", "+ var ", "variable_diff_size", ": [char; 2]\n", "[..]", "- \tsize: 1\n", "+ \tsize: 2\n", "\n");
48+
test!(variable_diff_size_multi, "- var ", "variable_diff_size_multi", ": [char; 1, 3]\n", "+ var ", "variable_diff_size_multi", ": [char; 2, 4]\n", "[..]", "- \tsize: 3\n", "+ \tsize: 8\n", "\n");
4849
test!(variable_diff_decl, " var ", "variable_diff_decl", ": int\n", "[..]", " \tsize: 4\n", "+ \tdeclaration: yes\n", "\n");

0 commit comments

Comments
 (0)