示例#1
0
END_TEST

START_TEST(core_011)
{
	struct tagbstring t = bsStatic("Hello world");
	unsigned char Ytstr[] = {
		0x72, 0x8f, 0x96, 0x96, 0x99, 0x4a,
		0xa1, 0x99, 0x9c, 0x96, 0x8e
	};
	bstring b, c;
	int ret = 0;
	b = bYEncode(&t);
	ck_assert(b != NULL);
	ck_assert_int_eq(ret, 0);
	ret = bisstemeqblk(b, Ytstr, 11);
	ck_assert_int_eq(ret, 1);
	c = bYDecode(b);
	ck_assert(c != NULL);
	ret = biseq(c, &t);
	ck_assert_int_eq(ret, 1);
	ret = bdestroy(b);
	ck_assert_int_eq(ret, BSTR_OK);
	ret = bdestroy(c);
	ck_assert_int_eq(ret, BSTR_OK);
}
示例#2
0
int test11 (void) {
struct tagbstring t = bsStatic ("Hello world");
unsigned char Ytstr[] = {0x72, 0x8f, 0x96, 0x96, 0x99, 0x4a, 0xa1, 0x99, 0x9c, 0x96, 0x8e};
bstring b, c;
int ret = 0;

	printf ("TEST: Y codec.\n");

	b = bYEncode (&t);
	ret += 11 != b->slen;
	ret += 0 >= bisstemeqblk (b, Ytstr, 11);
	c = bYDecode (b);
	ret += 0 >= biseq (c, &t);
	bdestroy (b);
	bdestroy (c);

	printf ("\t# failures: %d\n", ret);

	return ret;
}