Exemplo n.º 1
0
static void
test_Cat(TestBatchRunner *runner) {
    ByteBuf *bb = BB_new_bytes("foo", 3);

    {
        Blob *blob = Blob_new("bar", 3);
        BB_Cat(bb, blob);
        TEST_TRUE(runner, BB_Equals_Bytes(bb, "foobar", 6), "Cat");
        DECREF(blob);
    }

    BB_Cat_Bytes(bb, "baz", 3);
    TEST_TRUE(runner, BB_Equals_Bytes(bb, "foobarbaz", 9), "Cat_Bytes");

    DECREF(bb);
}
Exemplo n.º 2
0
static void
test_Cat(TestBatchRunner *runner) {
    ByteBuf *wanted  = BB_new_bytes("foobar", 6);
    ByteBuf *got     = BB_new_bytes("foo", 3);
    ByteBuf *scratch = BB_new_bytes("bar", 3);

    BB_Cat(got, scratch);
    TEST_TRUE(runner, BB_Equals(wanted, (Obj*)got), "Cat");

    BB_Mimic_Bytes(wanted, "foobarbaz", 9);
    BB_Cat_Bytes(got, "baz", 3);
    TEST_TRUE(runner, BB_Equals(wanted, (Obj*)got), "Cat_Bytes");

    DECREF(scratch);
    DECREF(got);
    DECREF(wanted);
}