int test8 (void) { struct tagbstring t = bsStatic ("Hello world"); bstring b; char * c; int ret = 0; printf ("TEST: NetStr functions.\n"); c = bStr2NetStr (&t); ret += 0 != strcmp (c, "11:Hello world,"); b = bNetStr2Bstr (c); ret += 0 >= biseq (b, &t); bdestroy (b); bcstrfree (c); printf ("\t# failures: %d\n", ret); return ret; }
END_TEST START_TEST(core_008) { struct tagbstring t = bsStatic("Hello world"); int ret = 0; bstring b; char *c; c = bStr2NetStr(&t); ck_assert(c != NULL); ret = strcmp(c, "11:Hello world,"); ck_assert_int_eq(ret, 0); b = bNetStr2Bstr(c); ck_assert(b != NULL); ret = biseq(b, &t); ck_assert_int_eq(ret, 1); ret = bdestroy(b); ck_assert_int_eq(ret, BSTR_OK); ret = bcstrfree(c); ck_assert_int_eq(ret, BSTR_OK); }