36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
printf("\r\033[1;%dmTests successful: %2" ZD "/%d\033[0m",
(i == NUM_TESTS ? 32 : 33), i, NUM_TESTS);
fflush(stdout);
} else {
printf("\r\033[K\033[1;31mTest %" ZD "/%d failed!\033[0m\n",
i, NUM_TESTS);
printf("%s is NOT expected result!\n", result);
exit(1);
}
free(result);
}
inline void
|
>
|
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
printf("\r\033[1;%dmTests successful: %2" ZD "/%d\033[0m",
(i == NUM_TESTS ? 32 : 33), i, NUM_TESTS);
fflush(stdout);
} else {
printf("\r\033[K\033[1;31mTest %" ZD "/%d failed!\033[0m\n",
i, NUM_TESTS);
printf("%s is NOT expected result!\n", result);
printf("Should have been: %s\n", result);
exit(1);
}
free(result);
}
inline void
|
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
check_result([OFXMLFactory createStanza: "foo"
withCloseTag: NO
andData: NULL,
"bar", "baz",
"blub", "asd",
NULL],
"<foo bar='baz' blub='asd'>");
check_result([OFXMLFactory createStanza: "foo"
withCloseTag: YES
andData: NULL,
NULL],
"<foo/>");
check_result([OFXMLFactory createStanza: "foo"
withCloseTag: YES
andData: "bar",
NULL],
"<foo>bar</foo>");
check_result([OFXMLFactory createStanza: "foo"
withCloseTag: YES
andData: NULL,
"bar", "b&az",
NULL],
"<foo bar='b&az'/>");
check_result([OFXMLFactory createStanza: "foo"
withCloseTag: YES
andData: "bar",
"bar", "b'az",
NULL],
"<foo bar='b'az'>bar</foo>");
check_result([OFXMLFactory createStanza: "foo"
withCloseTag: YES
andData: NULL,
"bar", "b&az",
"x", "asd\"",
NULL],
"<foo bar='b&az' x='asd"'/>");
check_result([OFXMLFactory createStanza: "foo"
withCloseTag: YES
andData: "bar",
"bar", "b'az",
"x", "y",
"a", "b",
NULL],
"<foo bar='b'az' x='y' a='b'>bar</foo>");
}
|
|
<
<
<
<
<
|
|
<
<
<
|
|
<
<
<
|
|
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
check_result([OFXMLFactory createStanza: "foo"
withCloseTag: NO
andData: NULL,
"bar", "baz",
"blub", "asd",
NULL],
"<foo bar='baz' blub='asd'>");
check_result([OFXMLFactory createStanza: "foo", NULL], "<foo/>");
check_result([OFXMLFactory createStanza: "foo"
withData: "bar",
NULL],
"<foo>bar</foo>");
check_result([OFXMLFactory createStanza: "foo",
"bar", "b&az",
NULL],
"<foo bar='b&az'/>");
check_result([OFXMLFactory createStanza: "foo"
withData: "bar",
"bar", "b'az",
NULL],
"<foo bar='b'az'>bar</foo>");
check_result([OFXMLFactory createStanza: "foo",
"bar", "b&az",
"x", "asd\"",
NULL],
"<foo bar='b&az' x='asd"'/>");
check_result([OFXMLFactory createStanza: "foo"
withData: "bar",
"bar", "b'az",
"x", "y",
"a", "b",
NULL],
"<foo bar='b'az' x='y' a='b'>bar</foo>");
}
|