Ejemplo n.º 1
0
Post *read_post_bin(int filed)
{
    /* TODO: this is poor performance but it avoids bugs tbqh */
    Post* post = new_post(" ", " ", " ", 0, 0, 0);
    read_post_bin_noalloc(post, filed);
    return post;
}
Ejemplo n.º 2
0
int test_add_post(void *data)
{
    (void) data;
    int status = 1;
    /* create posts */
    Post *op = new_post("nameOP", "titleOP", "textOP", 0, -1, 0);
    Post *reply = new_post("name", "title", "text", 1, 0, 0);
    Thread *thread = new_thread(op, 150, 0);
    add_post_to_thread(thread, reply);
    assert(thread->nreplies == 1);
    assert(thread->first_post == 0);
    assert(thread->last_post == 0);
    free_thread(thread);
    free_post(op);
    free_post(reply);
    return status;
}
Ejemplo n.º 3
0
int test_thread_full(void* data) {
    (void) data;
    int status = 1;
    /* create dummy post */
    Post *post = new_post("title", "name", "text", 0, 0, 0);
    Thread *thread = new_thread(NULL, 1, 0);
    add_post_to_thread(thread, post);
    add_post_to_thread(thread, post);
    assert(thread->nreplies == 1);
    free_thread(thread);
    free_post(post);
    return status;
}