5 static int test_b64encode(const char *correct
, const void *input
,
9 output
= _isds_b64encode(input
, length
);
11 if (correct
== NULL
&& output
== NULL
) {
15 if (correct
!= NULL
&& output
== NULL
) {
16 FAIL_TEST("Excpected non-NULL, got NULL");
19 if (correct
== NULL
&& output
!= NULL
) {
21 FAIL_TEST("Excpected NULL, got non-NULL");
24 if (strcmp(correct
, output
)) {
25 test_asprintf(&reason
, "Wrong return value: expected=`%s', got=`%s'",
36 int main(int argc
, char **argv
) {
37 INIT_TEST("b64encode");
39 TEST("generic", test_b64encode
, "NDIA\n", "42", 3);
40 TEST("empty string", test_b64encode
, "AA==\n", "", 1);
41 TEST("NULL input, 0 length", test_b64encode
, "\n", NULL
, 0);
42 TEST("non-NULL input, 0 length", test_b64encode
, "\n", "", 0);
43 TEST("NULL input, non-zero length", test_b64encode
, NULL
, NULL
, 1);