2
text[1] = "a"; expected[1] = 1
3
text[2] = " a"; expected[2] = 1
4
text[3] = ",a"; expected[3] = 2
5
text[4] = " , a"; expected[4] = 2
6
text[5] = "a,b"; expected[5] = 2
7
text[6] = "a,b,c"; expected[6] = 3
8
text[7] = "\"\""; expected[7] = 1
9
text[8] = "\"abc\""; expected[8] = 1
10
text[9] = "\"a\"\"b\""; expected[9] = 1
11
text[10] = "\"a\",\"b\""; expected[10] = 2
12
text[11] = "a\"\"b"; expected[11] = 1
13
text[12] = "\"a,b\""; expected[12] = 1
14
text[13] = "\"\"\"\""; expected[13] = 1
15
text[14] = "\"\"\"\"\"\""; expected[14] = 1
16
text[15] = "\"\"\"x\"\"\""; expected[15] = 1
17
text[16] = ",,\"\""; expected[16] = 3
18
text[17] = "a\"\"b"; expected[17] = 1
19
text[18] = "a\"b"; expected[18] = 1
20
text[19] = "a''b"; expected[19] = 1
21
text[20] = "\"abc"; expected[20] = 1
22
text[21] = ",,"; expected[21] = 3
23
text[22] = "a,"; expected[22] = 2
24
text[23] = "\"\","; expected[23] = 2
25
text[24] = ","; expected[24] = 2
26
text[25] = "\"abc\",def"; expected[25] = 2
28
for (i = 1; i <= length(text); i++) {
29
n = split(text[i], array)
31
printf("text[%d] = <%s>, expected %d, got %d\n",
32
i, text[i], expected[i], n)