Exemplo n.º 1
0
END_TEST

/** NULL struct tmq *, NULL struct tmq_elem * 
 */
START_TEST(test_tmq_insert_null_null)
{
    int ret;
    ret = tmq_insert (NULL, NULL);

    fail_unless ((ret != 0), "tmq_insert (NULL, NULL)");
}
Exemplo n.º 2
0
int
host_insert(HostKey *key, HostData *data)
{
    assert(hosttable);
    assert(key);

    struct tmq_element *tmq_elem =
        tmq_element_create(&key, sizeof key);
    tmq_insert(timeout_queue, tmq_elem);

    return hash_insert(hosttable, data, key, sizeof *key);
}
Exemplo n.º 3
0
END_TEST


/** NULL struct tmq_elem *
 */
START_TEST(test_tmq_insert_tmq_null)
{
    struct tmq *tmq= tmq_create ();

    int ret;
    ret = tmq_insert (tmq, NULL);

    fail_unless ((ret != 0), "tmq_insert (tmq, NULL)");
}
Exemplo n.º 4
0
END_TEST


/** Test Case for TMQ Insert Single Element
 */
START_TEST(test_tmq_insert_one)
{
    struct tmq *tmq;
    struct tmq_element *elem;
    int key = 100;

    tmq = tmq_create ();
    elem = tmq_element_create (&key, sizeof(key));
    tmq_insert (tmq, elem);

    fail_unless ((tmq->size == 1), "Insert one test failed");

    tmq_destroy (tmq);
}
Exemplo n.º 5
0
END_TEST

/** Test Case for TMQ Insert a Bunch of Elements 
 */
START_TEST(test_tmq_insert_a_bunch)
{
    struct tmq *tmq = tmq_create ();
    struct tmq_element *elem;
    int key;

    for (key = 0; key < 9000; key++)
    {
        elem = tmq_element_create (&key, sizeof(key));
        tmq_insert (tmq, elem);
    }

    fail_unless ((tmq->size == 9000), "Insert a bunch test failed");

    tmq_destroy (tmq);
}