コード例 #1
0
ファイル: test.c プロジェクト: wyt0602/data_struct
void test_queue_out()
{
    CU_ASSERT_PTR_EQUAL_FATAL(queue_out(&queue), p1);
    CU_ASSERT_PTR_EQUAL_FATAL(queue_out(&queue), p2);
    CU_ASSERT_PTR_EQUAL_FATAL(queue_out(&queue), p3);
    CU_ASSERT_PTR_EQUAL_FATAL(queue_out(&queue), p4);
    CU_ASSERT_EQUAL_FATAL(queue.queue_size, 0);
    CU_ASSERT_EQUAL_FATAL(queue.node_count, 4);
}
コード例 #2
0
ファイル: parseaddr.c プロジェクト: gnb/cyrus-imapd
static void test_single_append(void)
{
    struct address *a;
    struct address *origa;

    a = NULL;
    parseaddr_list("Fred Bloggs <*****@*****.**>", &a);
    CU_ASSERT_PTR_NOT_NULL_FATAL(a);
    CU_ASSERT_STRING_EQUAL(a->name, "Fred Bloggs");
    CU_ASSERT_STRING_EQUAL(a->mailbox, "fbloggs");
    CU_ASSERT_STRING_EQUAL(a->domain, "fastmail.fm");
    CU_ASSERT_PTR_NULL(a->next);
    origa = a;

    parseaddr_list("Sarah Jane Smith <*****@*****.**>", &a);
    CU_ASSERT_PTR_EQUAL_FATAL(a, origa);
    CU_ASSERT_STRING_EQUAL(a->name, "Fred Bloggs");
    CU_ASSERT_STRING_EQUAL(a->mailbox, "fbloggs");
    CU_ASSERT_STRING_EQUAL(a->domain, "fastmail.fm");
    CU_ASSERT_PTR_NOT_NULL_FATAL(a->next);
    CU_ASSERT_STRING_EQUAL(a->next->name, "Sarah Jane Smith");
    CU_ASSERT_STRING_EQUAL(a->next->mailbox, "sjsmith");
    CU_ASSERT_STRING_EQUAL(a->next->domain, "gmail.com");
    CU_ASSERT_PTR_NULL(a->next->next);

    parseaddr_free(a);
}