int test4 (void) { struct tagbstring t = bsStatic ("foo"); bstring b; int ret = 0; printf ("TEST: bReplicate function.\n"); ret += 0 <= bReplicate (&t, 4); ret += 0 <= bReplicate (b = bstrcpy (&t), -1); ret += 0 > bReplicate (b, 4); ret += 0 >= biseqcstr (b, "foofoofoofoo"); ret += 0 > bReplicate (b, 0); ret += 0 >= biseqcstr (b, ""); bdestroy (b); printf ("\t# failures: %d\n", ret); return ret; }
END_TEST START_TEST(core_004) { struct tagbstring t = bsStatic("foo"); int ret = 0; bstring b; ret = bReplicate(&t, 4); ck_assert_int_eq(ret, BSTR_ERR); b = bstrcpy(&t); ck_assert(b != NULL); ret = bReplicate(b, -1); ck_assert_int_eq(ret, BSTR_ERR); ret = bReplicate(b, 4); ck_assert_int_eq(ret, 0); ret = biseqcstr(b, "foofoofoofoo"); ck_assert_int_eq(ret, 1); ret = bReplicate(b, 0); ck_assert_int_eq(ret, 0); ret = biseqcstr(b, ""); ck_assert_int_eq(ret, 1); ret = bdestroy(b); ck_assert_int_eq(ret, BSTR_OK); }