5 static int test_b64encode(const char *correct
, const void *input
,
9 output
= _isds_b64encode(input
, length
);
11 if (correct
== NULL
&& output
== NULL
)
14 if (correct
!= NULL
&& output
== NULL
)
15 FAIL_TEST("Excpected non-NULL, got NULL");
17 if (correct
== NULL
&& output
!= NULL
) {
19 FAIL_TEST("Excpected NULL, got non-NULL");
22 if (strcmp(correct
, output
)) {
23 FAILURE_REASON("Wrong return value: expected=`%s', got=`%s'",
35 INIT_TEST("b64encode");
37 TEST("generic", test_b64encode
, "Af+qVQA=\n", "\x1\xff\xaa\x55", 5);
38 TEST("partial cycle", test_b64encode
, "MQA=\n", "1", 2);
39 TEST("1 cycle", test_b64encode
, "NDIA\n", "42", 3);
40 TEST("2 cycles", test_b64encode
, "MTIzNDUA\n", "12345", 6);
41 TEST("empty string", test_b64encode
, "AA==\n", "", 1);
42 TEST("NULL input, 0 length", test_b64encode
, "\n", NULL
, 0);
43 TEST("non-NULL input, 0 length", test_b64encode
, "\n", "", 0);
44 TEST("NULL input, non-zero length", test_b64encode
, NULL
, NULL
, 1);