Exemplo n.º 1
0
static void test_write_flag(CuTest *tc) {
    curse_fixture fix;
    storage store;
    char buf[1024];
    stream out = { 0 };
    size_t len;

    mstream_init(&out);
    binstore_init(&store, &out);
    store.handle.data = &out;

    setup_curse(&fix, "gbdream");
    fix.c->flags = 42 | CURSE_ISNEW;
    curse_write(fix.r->attribs, fix.r, &store);
    out.api->rewind(out.handle);
    len = out.api->read(out.handle, buf, sizeof(buf));
    buf[len] = '\0';
    out.api->rewind(out.handle);
    curse_read(fix.r->attribs, fix.r, &store);
    CuAssertIntEquals(tc, 42 | CURSE_ISNEW, ((curse *) fix.r->attribs->data.v)->flags);
    global.data_version = RELEASE_VERSION;
    CuAssertIntEquals(tc, RELEASE_VERSION, global.data_version);

    mstream_done(&out);
    binstore_done(&store);
    test_cleanup();
}
Exemplo n.º 2
0
static void cw_write(const attrib * a, const void *target, storage * store)
{
    connection *b = ((wallcurse *)((curse *)a->data.v)->data.v)->wall;
    curse_write(a, target, store);
    WRITE_INT(store, b->id);
}