int test9 (void) { struct tagbstring t = bsStatic ("Hello world"); bstring b, c; int err, ret = 0; printf ("TEST: Base 64 codec.\n"); b = bBase64Encode (&t); ret += 0 >= biseqcstr (b, "SGVsbG8gd29ybGQ="); c = bBase64DecodeEx (b, &err); ret += 0 != err; ret += 0 >= biseq (c, &t); bdestroy (b); bdestroy (c); printf ("\t# failures: %d\n", ret); return ret; }
END_TEST START_TEST(core_009) { struct tagbstring t = bsStatic("Hello world"); int err, ret = 0; bstring b, c; b = bBase64Encode(&t); ck_assert(b != NULL); ret += 0 >= biseqcstr(b, "SGVsbG8gd29ybGQ="); c = bBase64DecodeEx(b, &err); ck_assert(b != NULL); ck_assert_int_eq(err, 0); ret += 0 >= biseq(c, &t); ck_assert_int_eq(ret, 0); ret = bdestroy(b); ck_assert_int_eq(ret, BSTR_OK); ret = bdestroy(c); ck_assert_int_eq(ret, BSTR_OK); }