Ejemplo n.º 1
0
static void
stub_failure_iterated_test (gconstpointer data)
{
    cut_assert_true(TRUE, cut_message("always pass"));
    MARK_FAIL(cut_assert_equal_int(2, GPOINTER_TO_INT(data)));
    cut_assert_true(TRUE, cut_message("always pass if come here"));
}
Ejemplo n.º 2
0
static void
stub_not_equal_int64 (void)
{
    gcut_assert_not_equal_int64(0, 1);
    gcut_assert_not_equal_int64((gint64)G_MAXINT32, (gint64)G_MAXINT32 + 1);
    MARK_FAIL(gcut_assert_not_equal_int64(G_MAXINT64, G_MAXINT64));
}
Ejemplo n.º 3
0
static void
stub_equal_hash_table (void)
{
    hash1 = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, g_free);
    hash2 = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, g_free);

    g_hash_table_insert(hash1, GUINT_TO_POINTER(1), g_strdup("11"));
    g_hash_table_insert(hash1, GUINT_TO_POINTER(10), g_strdup("22"));
    g_hash_table_insert(hash2, GUINT_TO_POINTER(2), g_strdup("99"));
    g_hash_table_insert(hash2, GUINT_TO_POINTER(20), g_strdup("88"));

    gcut_assert_equal_hash_table(hash1, hash1,
                                 g_str_equal,
                                 gcut_inspect_direct,
                                 gcut_inspect_string,
                                 NULL);
    gcut_assert_equal_hash_table(hash2, hash2,
                                 g_str_equal,
                                 gcut_inspect_direct,
                                 gcut_inspect_string,
                                 NULL);

    MARK_FAIL(gcut_assert_equal_hash_table(hash1, hash2,
                                           g_str_equal,
                                           gcut_inspect_direct,
                                           gcut_inspect_string,
                                           NULL));
}
Ejemplo n.º 4
0
static void
stub_equal_uint64 (void)
{
    gcut_assert_equal_uint64(0, 0);
    gcut_assert_equal_uint64((guint64)G_MAXUINT32 + 1, (guint64)G_MAXUINT32 + 1);
    MARK_FAIL(gcut_assert_equal_uint64(G_MAXUINT32, G_MAXUINT64));
}
Ejemplo n.º 5
0
static void
stub_pending_iterated_test (gconstpointer data)
{
    cut_assert_true(TRUE, cut_message("always pass"));
    if (GPOINTER_TO_INT(data) == 2)
        MARK_FAIL(cut_pend("PENDING!"));
    cut_assert_true(TRUE, cut_message("always pass if come here"));
}
Ejemplo n.º 6
0
static void
stub_error_iterated_test (gconstpointer data)
{
    cut_assert_true(TRUE, cut_message("always pass"));
    if (GPOINTER_TO_INT(data) == 2)
        MARK_FAIL(cut_error("ERROR!"));
    cut_assert_true(TRUE, cut_message("always pass if come here"));
}
Ejemplo n.º 7
0
static void
stub_notification_iterated_test (gconstpointer data)
{
    cut_assert_true(TRUE, cut_message("always pass"));
    if (GPOINTER_TO_INT(data) == 2)
        MARK_FAIL(cut_notify("NOTIFICATION!"));
    cut_assert_true(TRUE, cut_message("always pass if come here"));
}
Ejemplo n.º 8
0
static void
stub_omission_iterated_test (gconstpointer data)
{
    cut_assert_true(TRUE, cut_message("always pass"));
    if (GPOINTER_TO_INT(data) == 2)
        MARK_FAIL(cut_omit("OMISSION!"));
    cut_assert_true(TRUE, cut_message("always pass if come here"));
}
Ejemplo n.º 9
0
static void
stub_error (void)
{
    gcut_assert_error(error);

    error = g_error_new(G_FILE_ERROR, G_FILE_ERROR_NOENT, "not found");
    MARK_FAIL(gcut_assert_error(error));
}
Ejemplo n.º 10
0
static void
stub_equal_object_custom (void)
{
    object1 = G_OBJECT(cut_test_new("test-name", NULL));
    object2 = G_OBJECT(cut_test_new("test-name", NULL));
    object3 = G_OBJECT(cut_test_new("no-name", NULL));

    gcut_assert_equal_object_custom(object1, object2, equal_name);
    MARK_FAIL(gcut_assert_equal_object_custom(object1, object3, equal_name));
}
Ejemplo n.º 11
0
static void
stub_equal_enum (void)
{
    gcut_assert_equal_enum(CUT_TYPE_TEST_RESULT_STATUS,
                           CUT_TEST_RESULT_PENDING,
                           CUT_TEST_RESULT_PENDING);
    MARK_FAIL(gcut_assert_equal_enum(CUT_TYPE_TEST_RESULT_STATUS,
                                     CUT_TEST_RESULT_FAILURE,
                                     CUT_TEST_RESULT_PENDING));
}
Ejemplo n.º 12
0
static void
stub_equal_flags (void)
{
    gcut_assert_equal_flags(flags_type,
                            (1 << 0) | (1 << 2),
                            (1 << 0) | (1 << 2));
    MARK_FAIL(gcut_assert_equal_flags(flags_type,
                                      (1 << 1) | (1 << 2),
                                      (1 << 3)));
}
Ejemplo n.º 13
0
static void
stub_equal_object (void)
{
    object1 = G_OBJECT(cut_loader_new("so-name1"));
    object2 = G_OBJECT(cut_loader_new("so-name2"));

    gcut_assert_equal_object(object1, object1);
    gcut_assert_equal_object(object2, object2);
    gcut_assert_equal_object(NULL, NULL);
    MARK_FAIL(gcut_assert_equal_object(object1, object2));
}
Ejemplo n.º 14
0
static void
stub_equal_error (void)
{
    error1 = g_error_new(G_FILE_ERROR, G_FILE_ERROR_NOENT, "not found");
    error2 = g_error_new(G_FILE_ERROR, G_FILE_ERROR_NOENT, "not found");
    gcut_assert_equal_error(error1, error2);

    g_error_free(error2);
    error2 = g_error_new(G_FILE_ERROR, G_FILE_ERROR_NOENT, "no entry");
    MARK_FAIL(gcut_assert_equal_error(error1, error2));
}
Ejemplo n.º 15
0
static void
stub_equal_list_flags (void)
{
    list1 = g_list_append(list1, GUINT_TO_POINTER(1 << 0 | 1 << 1));
    list1 = g_list_append(list1, GUINT_TO_POINTER(1 << 2));
    list2 = g_list_append(list2, GUINT_TO_POINTER(0));

    gcut_assert_equal_list_flags(flags_type, list1, list1);
    gcut_assert_equal_list_flags(flags_type, list2, list2);

    MARK_FAIL(gcut_assert_equal_list_flags(flags_type, list1, list2));
}
Ejemplo n.º 16
0
static void
stub_equal_list_enum (void)
{
    list1 = g_list_append(list1, GINT_TO_POINTER(CUT_TEST_RESULT_PENDING));
    list1 = g_list_append(list1, GINT_TO_POINTER(CUT_TEST_RESULT_SUCCESS));
    list2 = g_list_append(list2, GINT_TO_POINTER(CUT_TEST_RESULT_FAILURE));

    gcut_assert_equal_list_enum(CUT_TYPE_TEST_RESULT_STATUS, list1, list1);
    gcut_assert_equal_list_enum(CUT_TYPE_TEST_RESULT_STATUS, list2, list2);

    MARK_FAIL(gcut_assert_equal_list_enum(CUT_TYPE_TEST_RESULT_STATUS,
                                          list1, list2));
}
Ejemplo n.º 17
0
static void
stub_equal_value (void)
{
    g_value_init(value1, G_TYPE_INT);
    g_value_set_int(value1, 10);
    g_value_init(value2, G_TYPE_STRING);
    g_value_set_string(value2, "String");

    gcut_assert_equal_value(value1, value1);
    gcut_assert_equal_value(value2, value2);

    MARK_FAIL(gcut_assert_equal_value(value1, value2));
}
Ejemplo n.º 18
0
static void
stub_equal_list_uint (void)
{
    list1 = g_list_append(list1, GUINT_TO_POINTER(100));
    list1 = g_list_append(list1, GUINT_TO_POINTER(200));
    list2 = g_list_append(list2, GUINT_TO_POINTER(1000));
    list2 = g_list_append(list2, GUINT_TO_POINTER(2000));

    gcut_assert_equal_list_uint(list1, list1);
    gcut_assert_equal_list_uint(list2, list2);

    MARK_FAIL(gcut_assert_equal_list_uint(list1, list2));
}
Ejemplo n.º 19
0
static void
stub_equal_list_string (void)
{
    need_to_free_list_contents = TRUE;

    list1 = g_list_append(list1, g_strdup("abc"));
    list1 = g_list_append(list1, g_strdup("def"));
    list2 = g_list_append(list2, g_strdup("zyx"));
    list2 = g_list_append(list2, g_strdup("wvu"));

    gcut_assert_equal_list_string(list1, list1);
    gcut_assert_equal_list_string(list2, list2);

    MARK_FAIL(gcut_assert_equal_list_string(list1, list2));
}
Ejemplo n.º 20
0
static void
stub_equal_hash_table_string_string (void)
{
    hash1 = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
    hash2 = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);

    g_hash_table_insert(hash1, g_strdup("abc"), g_strdup("11"));
    g_hash_table_insert(hash1, g_strdup("def"), g_strdup("22"));
    g_hash_table_insert(hash2, g_strdup("zyx"), g_strdup("99"));
    g_hash_table_insert(hash2, g_strdup("wvu"), g_strdup("88"));

    gcut_assert_equal_hash_table_string_string(hash1, hash1);
    gcut_assert_equal_hash_table_string_string(hash2, hash2);

    MARK_FAIL(gcut_assert_equal_hash_table_string_string(hash1, hash2));
}
Ejemplo n.º 21
0
static void
stub_equal_list_object (void)
{
    need_to_free_list_contents = TRUE;
    list_element_free_function = g_object_unref_with_null_check;

    list1 = g_list_append(list1, cut_repository_new("directory1"));
    list1 = g_list_append(list1, NULL);
    list1 = g_list_append(list1, cut_test_new("test1", NULL));
    list2 = g_list_append(list2, cut_repository_new("directory2"));
    list2 = g_list_append(list2, NULL);
    list2 = g_list_append(list2, cut_test_new("test2", NULL));

    gcut_assert_equal_list_object(list1, list1);
    gcut_assert_equal_list_object(list2, list2);

    MARK_FAIL(gcut_assert_equal_list_object(list1, list2));
}
Ejemplo n.º 22
0
static void
stub_equal_list (void)
{
    list1 = g_list_append(list1, GINT_TO_POINTER(100));
    list1 = g_list_append(list1, GINT_TO_POINTER(-200));
    list2 = g_list_append(list2, GINT_TO_POINTER(-1000));
    list2 = g_list_append(list2, GINT_TO_POINTER(2000));

    gcut_assert_equal_list(list1, list1,
                           stub_equal_list_equal_func,
                           stub_equal_list_inspect_func, "AAA");
    gcut_assert_equal_list(list2, list2,
                           stub_equal_list_equal_func,
                           stub_equal_list_inspect_func, "BBB");

    MARK_FAIL(gcut_assert_equal_list(list1, list2,
                                     stub_equal_list_equal_func,
                                     stub_equal_list_inspect_func, "CCC"));
}
Ejemplo n.º 23
0
static void
stub_equal_object_null (void)
{
    object1 = G_OBJECT(cut_loader_new("so-name"));
    MARK_FAIL(gcut_assert_equal_object(object1, NULL));
}
Ejemplo n.º 24
0
static void
stub_pending_test (void)
{
    MARK_FAIL(cut_pend("This test has been pending ever!"));
}
Ejemplo n.º 25
0
static void
stub_equal_type (void)
{
    gcut_assert_equal_type(G_TYPE_INT, G_TYPE_INT);
    MARK_FAIL(gcut_assert_equal_type(G_TYPE_INT, G_TYPE_STRING));
}
Ejemplo n.º 26
0
static void
stub_notification_test (void)
{
    MARK_FAIL(cut_notify("This test has been notifable ever!"));
}
Ejemplo n.º 27
0
static void
stub_error_test (void)
{
    MARK_FAIL(cut_error("This test should error"));
}
Ejemplo n.º 28
0
static void
stub_not_equal_pid (void)
{
    gcut_assert_not_equal_pid(0, (GPid)100);
    MARK_FAIL(gcut_assert_not_equal_pid(0, 0));
}
Ejemplo n.º 29
0
static void
stub_failure_test (void)
{
    MARK_FAIL(cut_fail("This test should fail"));
}