[rhythmbox: 1/2] tests: replace deprecated fail_unless / fail_if calls
- From: Jonathan Matthew <jmatthew src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rhythmbox: 1/2] tests: replace deprecated fail_unless / fail_if calls
- Date: Sun, 21 Feb 2021 11:38:29 +0000 (UTC)
commit 7e67d60e9b3f5dfca61f87ca7476c66f78b673ef
Author: crvi <crvisqr gmail com>
Date: Sun Feb 21 11:38:29 2021 +0000
tests: replace deprecated fail_unless / fail_if calls
tests/test-audioscrobbler.c | 16 +--
tests/test-file-helpers.c | 12 +--
tests/test-rb-lib.c | 30 +++---
tests/test-rhythmdb-property-model.c | 134 ++++++++++++-------------
tests/test-rhythmdb-query-model.c | 18 ++--
tests/test-rhythmdb.c | 184 +++++++++++++++++------------------
tests/test-utils.c | 4 +-
tests/test-utils.h | 4 -
tests/test-widgets.c | 32 +++---
9 files changed, 213 insertions(+), 221 deletions(-)
---
diff --git a/tests/test-audioscrobbler.c b/tests/test-audioscrobbler.c
index 95d417d91..839975df9 100644
--- a/tests/test-audioscrobbler.c
+++ b/tests/test-audioscrobbler.c
@@ -53,19 +53,19 @@ START_TEST (test_rb_audioscrobbler_entry)
as_gstring = g_string_new ("");
rb_audioscrobbler_entry_save_to_string (as_gstring, entry);
rb_debug ("string form: %s", as_gstring->str);
- fail_unless (as_gstring->len != 0, "entry saved as string should not be empty");
+ ck_assert_msg (as_gstring->len != 0, "entry saved as string should not be empty");
reload = rb_audioscrobbler_entry_load_from_string (as_gstring->str);
- fail_unless (reload != NULL, "entry-as-string can be converted back to an entry");
+ ck_assert_msg (reload != NULL, "entry-as-string can be converted back to an entry");
rb_audioscrobbler_entry_debug (entry, 0);
rb_audioscrobbler_entry_debug (reload, 1);
- fail_unless (strcmp (entry->title, reload->title) == 0, "title made it back OK");
- fail_unless (strcmp (entry->artist, reload->artist) == 0, "artist made it back OK");
- fail_unless (strcmp (entry->album, reload->album) == 0, "album made it back OK");
- fail_unless (strcmp (entry->mbid, reload->mbid) == 0, "album made it back OK");
- fail_unless (entry->length == reload->length, "length made it back OK");
- fail_unless (entry->play_time == reload->play_time, "play time made it back OK");
+ ck_assert_msg (strcmp (entry->title, reload->title) == 0, "title made it back OK");
+ ck_assert_msg (strcmp (entry->artist, reload->artist) == 0, "artist made it back OK");
+ ck_assert_msg (strcmp (entry->album, reload->album) == 0, "album made it back OK");
+ ck_assert_msg (strcmp (entry->mbid, reload->mbid) == 0, "album made it back OK");
+ ck_assert_msg (entry->length == reload->length, "length made it back OK");
+ ck_assert_msg (entry->play_time == reload->play_time, "play time made it back OK");
rb_audioscrobbler_entry_free (entry);
rb_audioscrobbler_entry_free (reload);
diff --git a/tests/test-file-helpers.c b/tests/test-file-helpers.c
index e65a26cc6..855b15fc0 100644
--- a/tests/test-file-helpers.c
+++ b/tests/test-file-helpers.c
@@ -44,7 +44,7 @@ test_get_short_path_name (const char *in, const char *expected)
out = rb_uri_get_short_path_name (in);
rb_debug ("extracting short path from \"%s\", expecting \"%s\", got \"%s\"", in, expected, out);
- fail_unless (strcmp (out, expected) == 0);
+ ck_assert (strcmp (out, expected) == 0);
g_free (out);
}
@@ -58,7 +58,7 @@ START_TEST (test_rb_uri_get_short_path_name)
/* nothing */
in = NULL;
out = rb_uri_get_short_path_name (in);
- fail_unless (out == NULL);
+ ck_assert (out == NULL);
g_free (out);
/* just a file name */
@@ -93,10 +93,10 @@ END_TEST
START_TEST (test_rb_check_dir_has_space)
{
init_once (TRUE);
- fail_unless (rb_check_dir_has_space_uri ("file:///tmp", 1));
- fail_unless (rb_check_dir_has_space_uri ("file:///etc/passwd", 1));
- fail_unless (rb_check_dir_has_space_uri ("file:///tmp/NONEXISTANT_FILE", 1));
- fail_unless (rb_check_dir_has_space_uri ("file:///tmp/NONEXISTANT/THISDOESNTEXISTEITHER/NORDOESTHIS",
G_MAXUINT64) == FALSE);
+ ck_assert (rb_check_dir_has_space_uri ("file:///tmp", 1));
+ ck_assert (rb_check_dir_has_space_uri ("file:///etc/passwd", 1));
+ ck_assert (rb_check_dir_has_space_uri ("file:///tmp/NONEXISTANT_FILE", 1));
+ ck_assert (rb_check_dir_has_space_uri ("file:///tmp/NONEXISTANT/THISDOESNTEXISTEITHER/NORDOESTHIS",
G_MAXUINT64) == FALSE);
}
END_TEST
diff --git a/tests/test-rb-lib.c b/tests/test-rb-lib.c
index f3cb4d53b..e652fded6 100644
--- a/tests/test-rb-lib.c
+++ b/tests/test-rb-lib.c
@@ -42,43 +42,43 @@ START_TEST (test_rb_string_value_map)
GValue val = {0,};
map = rb_string_value_map_new ();
- fail_unless (rb_string_value_map_size (map) == 0, "new map should have 0 entries");
+ ck_assert_msg (rb_string_value_map_size (map) == 0, "new map should have 0 entries");
g_value_init (&val, G_TYPE_INT);
g_value_set_int (&val, 42);
rb_string_value_map_set (map, "foo", &val);
g_value_unset (&val);
- fail_unless (rb_string_value_map_size (map) == 1, "map with 1 entry added should have 1 entry");
+ ck_assert_msg (rb_string_value_map_size (map) == 1, "map with 1 entry added should have 1 entry");
- fail_unless (rb_string_value_map_get (map, "foo", &val), "couldn't retrieve just-added entry");
- fail_unless (g_value_get_int (&val) == 42, "entry returned wrong value");
+ ck_assert_msg (rb_string_value_map_get (map, "foo", &val), "couldn't retrieve just-added entry");
+ ck_assert_msg (g_value_get_int (&val) == 42, "entry returned wrong value");
g_value_unset (&val);
g_value_init (&val, G_TYPE_STRING);
g_value_set_string (&val, "BAZ");
rb_string_value_map_set (map, "bar", &val);
g_value_unset (&val);
- fail_unless (rb_string_value_map_size (map) == 2, "map with 2 entries added should have 2 entries");
+ ck_assert_msg (rb_string_value_map_size (map) == 2, "map with 2 entries added should have 2 entries");
- fail_unless (rb_string_value_map_get (map, "foo", &val), "couldn't retrieve entry");
- fail_unless (g_value_get_int (&val) == 42, "entry returned wrong value");
+ ck_assert_msg (rb_string_value_map_get (map, "foo", &val), "couldn't retrieve entry");
+ ck_assert_msg (g_value_get_int (&val) == 42, "entry returned wrong value");
g_value_unset (&val);
- fail_unless (strcmp (g_value_get_string (rb_string_value_map_peek (map, "bar")), "BAZ") == 0,
- "wrong string returned");
+ ck_assert_msg (strcmp (g_value_get_string (rb_string_value_map_peek (map, "bar")), "BAZ") == 0,
+ "wrong string returned");
- fail_unless (rb_string_value_map_get (map, "wombat", &val) == FALSE, "could retrieve non-existant
entry");
+ ck_assert_msg (rb_string_value_map_get (map, "wombat", &val) == FALSE, "could retrieve non-existant
entry");
rb_string_value_map_remove (map, "foo");
- fail_unless (rb_string_value_map_size (map) == 1, "map with second entry removed should have 1
entry");
+ ck_assert_msg (rb_string_value_map_size (map) == 1, "map with second entry removed should have 1
entry");
- fail_unless (strcmp (g_value_get_string (rb_string_value_map_peek (map, "bar")), "BAZ") == 0,
- "wrong string returned");
+ ck_assert_msg (strcmp (g_value_get_string (rb_string_value_map_peek (map, "bar")), "BAZ") == 0,
+ "wrong string returned");
rb_string_value_map_remove (map, "bar");
- fail_unless (rb_string_value_map_size (map) == 0, "map with both entries removed should have 0
entries");
+ ck_assert_msg (rb_string_value_map_size (map) == 0, "map with both entries removed should have 0
entries");
- fail_unless (rb_string_value_map_peek (map, "bar") == NULL, "removed entry should return NULL");
+ ck_assert_msg (rb_string_value_map_peek (map, "bar") == NULL, "removed entry should return NULL");
}
END_TEST
diff --git a/tests/test-rhythmdb-property-model.c b/tests/test-rhythmdb-property-model.c
index b01fb1e04..d7cdd2ab3 100644
--- a/tests/test-rhythmdb-property-model.c
+++ b/tests/test-rhythmdb-property-model.c
@@ -89,11 +89,11 @@ START_TEST (test_rhythmdb_property_model_static)
set_waiting_signal (G_OBJECT (propmodel), "row-inserted");
rhythmdb_query_model_add_entry (model, b, -1);
wait_for_signal ();
- fail_unless (rhythmdb_query_model_entry_to_iter (model, a, &iter));
- fail_unless (rhythmdb_query_model_entry_to_iter (model, b, &iter));
- /*fail_unless (_get_property_count (propmodel, _("All")) == 2);*/
- fail_unless (_get_property_count (propmodel, "x") == 1);
- fail_unless (_get_property_count (propmodel, "y") == 1);
+ ck_assert (rhythmdb_query_model_entry_to_iter (model, a, &iter));
+ ck_assert (rhythmdb_query_model_entry_to_iter (model, b, &iter));
+ /*ck_assert (_get_property_count (propmodel, _("All")) == 2);*/
+ ck_assert (_get_property_count (propmodel, "x") == 1);
+ ck_assert (_get_property_count (propmodel, "y") == 1);
end_step ();
@@ -102,8 +102,8 @@ START_TEST (test_rhythmdb_property_model_static)
set_entry_string (db, a, RHYTHMDB_PROP_ARTIST, "y");
rhythmdb_commit (db);
wait_for_signal ();
- fail_unless (_get_property_count (propmodel, "x") == 0);
- fail_unless (_get_property_count (propmodel, "y") == 2);
+ ck_assert (_get_property_count (propmodel, "x") == 0);
+ ck_assert (_get_property_count (propmodel, "y") == 2);
end_step ();
@@ -112,17 +112,17 @@ START_TEST (test_rhythmdb_property_model_static)
set_entry_hidden (db, a, TRUE);
rhythmdb_commit (db);
wait_for_signal ();
- /*fail_unless (_get_property_count (propmodel, _("All")) == 1);*/
- fail_unless (_get_property_count (propmodel, "x") == 0);
- fail_unless (_get_property_count (propmodel, "y") == 1);
+ /*ck_assert (_get_property_count (propmodel, _("All")) == 1);*/
+ ck_assert (_get_property_count (propmodel, "x") == 0);
+ ck_assert (_get_property_count (propmodel, "y") == 1);
end_step ();
/* change back */
set_entry_string (db, a, RHYTHMDB_PROP_ARTIST, "x");
rhythmdb_commit (db);
- fail_unless (_get_property_count (propmodel, "x") == 0);
- fail_unless (_get_property_count (propmodel, "y") == 1);
+ ck_assert (_get_property_count (propmodel, "x") == 0);
+ ck_assert (_get_property_count (propmodel, "y") == 1);
end_step ();
@@ -132,9 +132,9 @@ START_TEST (test_rhythmdb_property_model_static)
rhythmdb_commit (db);
wait_for_signal ();
- /*fail_unless (_get_property_count (propmodel, _("All")) == 2);*/
- fail_unless (_get_property_count (propmodel, "x") == 1);
- fail_unless (_get_property_count (propmodel, "y") == 1);
+ /*ck_assert (_get_property_count (propmodel, _("All")) == 2);*/
+ ck_assert (_get_property_count (propmodel, "x") == 1);
+ ck_assert (_get_property_count (propmodel, "y") == 1);
end_step ();
@@ -142,9 +142,9 @@ START_TEST (test_rhythmdb_property_model_static)
set_waiting_signal (G_OBJECT (propmodel), "pre-row-deletion");
rhythmdb_query_model_remove_entry (model, a);
wait_for_signal ();
- /*fail_unless (_get_property_count (propmodel, _("All")) == 1);*/
- fail_unless (_get_property_count (propmodel, "x") == 0);
- fail_unless (_get_property_count (propmodel, "y") == 1);
+ /*ck_assert (_get_property_count (propmodel, _("All")) == 1);*/
+ ck_assert (_get_property_count (propmodel, "x") == 0);
+ ck_assert (_get_property_count (propmodel, "y") == 1);
end_step ();
@@ -157,8 +157,8 @@ START_TEST (test_rhythmdb_property_model_static)
g_object_set (propmodel, "query-model", model2, NULL);
wait_for_signal ();
- fail_unless (_get_property_count (propmodel, "x") == 1);
- fail_unless (_get_property_count (propmodel, "y") == 1);
+ ck_assert (_get_property_count (propmodel, "x") == 1);
+ ck_assert (_get_property_count (propmodel, "y") == 1);
end_step ();
@@ -167,8 +167,8 @@ START_TEST (test_rhythmdb_property_model_static)
rhythmdb_entry_delete (db, a);
rhythmdb_commit (db);
wait_for_signal ();
- fail_unless (_get_property_count (propmodel, "x") == 0);
- fail_unless (_get_property_count (propmodel, "y") == 1);
+ ck_assert (_get_property_count (propmodel, "x") == 0);
+ ck_assert (_get_property_count (propmodel, "y") == 1);
end_step ();
@@ -177,8 +177,8 @@ START_TEST (test_rhythmdb_property_model_static)
rhythmdb_entry_delete (db, b);
rhythmdb_commit (db);
wait_for_signal ();
- fail_unless (_get_property_count (propmodel, "x") == 0);
- fail_unless (_get_property_count (propmodel, "y") == 0);
+ ck_assert (_get_property_count (propmodel, "x") == 0);
+ ck_assert (_get_property_count (propmodel, "y") == 0);
end_test_case ();
@@ -234,8 +234,8 @@ START_TEST (test_rhythmdb_property_model_query)
rhythmdb_commit (db);
wait_for_signal ();
- fail_unless (_get_property_count (propmodel, "x") == 1);
- fail_unless (_get_property_count (propmodel, "y") == 0);
+ ck_assert (_get_property_count (propmodel, "x") == 1);
+ ck_assert (_get_property_count (propmodel, "y") == 0);
end_step ();
@@ -244,8 +244,8 @@ START_TEST (test_rhythmdb_property_model_query)
set_entry_string (db, b, RHYTHMDB_PROP_ARTIST, "x");
rhythmdb_commit (db);
wait_for_signal ();
- fail_unless (_get_property_count (propmodel, "x") == 2);
- fail_unless (_get_property_count (propmodel, "y") == 0);
+ ck_assert (_get_property_count (propmodel, "x") == 2);
+ ck_assert (_get_property_count (propmodel, "y") == 0);
end_step ();
@@ -254,9 +254,9 @@ START_TEST (test_rhythmdb_property_model_query)
set_entry_string (db, b, RHYTHMDB_PROP_ARTIST, "xx");
rhythmdb_commit (db);
wait_for_signal ();
- fail_unless (_get_property_count (propmodel, "x") == 1);
- fail_unless (_get_property_count (propmodel, "xx") == 1);
- fail_unless (_get_property_count (propmodel, "y") == 0);
+ ck_assert (_get_property_count (propmodel, "x") == 1);
+ ck_assert (_get_property_count (propmodel, "xx") == 1);
+ ck_assert (_get_property_count (propmodel, "y") == 0);
end_step ();
@@ -265,8 +265,8 @@ START_TEST (test_rhythmdb_property_model_query)
set_entry_hidden (db, a, TRUE);
rhythmdb_commit (db);
wait_for_signal ();
- fail_unless (_get_property_count (propmodel, "x") == 0);
- fail_unless (_get_property_count (propmodel, "xx") == 1);
+ ck_assert (_get_property_count (propmodel, "x") == 0);
+ ck_assert (_get_property_count (propmodel, "xx") == 1);
end_step ();
@@ -275,8 +275,8 @@ START_TEST (test_rhythmdb_property_model_query)
set_entry_string (db, a, RHYTHMDB_PROP_ARTIST, "xx");
rhythmdb_commit (db);
wait_for_signal ();
- fail_unless (_get_property_count (propmodel, "x") == 0);
- fail_unless (_get_property_count (propmodel, "xx") == 1);
+ ck_assert (_get_property_count (propmodel, "x") == 0);
+ ck_assert (_get_property_count (propmodel, "xx") == 1);
end_step ();
@@ -285,8 +285,8 @@ START_TEST (test_rhythmdb_property_model_query)
set_entry_hidden (db, a, FALSE);
rhythmdb_commit (db);
wait_for_signal ();
- fail_unless (_get_property_count (propmodel, "x") == 0);
- fail_unless (_get_property_count (propmodel, "xx") == 2);
+ ck_assert (_get_property_count (propmodel, "x") == 0);
+ ck_assert (_get_property_count (propmodel, "xx") == 2);
end_step ();
@@ -295,17 +295,17 @@ START_TEST (test_rhythmdb_property_model_query)
set_entry_string (db, a, RHYTHMDB_PROP_ARTIST, "y");
rhythmdb_commit (db);
wait_for_signal ();
- fail_unless (_get_property_count (propmodel, "x") == 0);
- fail_unless (_get_property_count (propmodel, "xx") == 1);
- fail_unless (_get_property_count (propmodel, "y") == 0);
+ ck_assert (_get_property_count (propmodel, "x") == 0);
+ ck_assert (_get_property_count (propmodel, "xx") == 1);
+ ck_assert (_get_property_count (propmodel, "y") == 0);
end_step ();
/* switch to model2 */
g_object_set (propmodel, "query-model", model2, NULL);
- fail_unless (_get_property_count (propmodel, "x") == 0);
- fail_unless (_get_property_count (propmodel, "y") == 1);
- fail_unless (_get_property_count (propmodel, "xx") == 0);
+ ck_assert (_get_property_count (propmodel, "x") == 0);
+ ck_assert (_get_property_count (propmodel, "y") == 1);
+ ck_assert (_get_property_count (propmodel, "xx") == 0);
end_step ();
@@ -314,9 +314,9 @@ START_TEST (test_rhythmdb_property_model_query)
set_entry_string (db, a, RHYTHMDB_PROP_ARTIST, "x");
rhythmdb_commit (db);
wait_for_signal ();
- fail_unless (_get_property_count (propmodel, "x") == 0);
- fail_unless (_get_property_count (propmodel, "xx") == 0);
- fail_unless (_get_property_count (propmodel, "y") == 0);
+ ck_assert (_get_property_count (propmodel, "x") == 0);
+ ck_assert (_get_property_count (propmodel, "xx") == 0);
+ ck_assert (_get_property_count (propmodel, "y") == 0);
end_step ();
@@ -383,8 +383,8 @@ START_TEST (test_rhythmdb_property_model_query_chain)
rhythmdb_commit (db);
wait_for_signal ();
- fail_unless (_get_property_count (propmodel, "x") == 0);
- fail_unless (_get_property_count (propmodel, "y") == 1);
+ ck_assert (_get_property_count (propmodel, "x") == 0);
+ ck_assert (_get_property_count (propmodel, "y") == 1);
end_step ();
@@ -394,9 +394,9 @@ START_TEST (test_rhythmdb_property_model_query_chain)
rhythmdb_commit (db);
wait_for_signal ();
- fail_unless (_get_property_count (propmodel, "x") == 0);
- fail_unless (_get_property_count (propmodel, "y") == 1);
- fail_unless (_get_property_count (propmodel, "yy") == 1);
+ ck_assert (_get_property_count (propmodel, "x") == 0);
+ ck_assert (_get_property_count (propmodel, "y") == 1);
+ ck_assert (_get_property_count (propmodel, "yy") == 1);
end_step ();
@@ -406,8 +406,8 @@ START_TEST (test_rhythmdb_property_model_query_chain)
rhythmdb_commit (db);
wait_for_signal ();
- fail_unless (_get_property_count (propmodel, "y") == 2);
- fail_unless (_get_property_count (propmodel, "yy") == 0);
+ ck_assert (_get_property_count (propmodel, "y") == 2);
+ ck_assert (_get_property_count (propmodel, "yy") == 0);
end_step ();
@@ -417,8 +417,8 @@ START_TEST (test_rhythmdb_property_model_query_chain)
rhythmdb_commit (db);
wait_for_signal ();
- fail_unless (_get_property_count (propmodel, "y") == 1);
- fail_unless (_get_property_count (propmodel, "z") == 0);
+ ck_assert (_get_property_count (propmodel, "y") == 1);
+ ck_assert (_get_property_count (propmodel, "z") == 0);
end_step ();
@@ -482,12 +482,12 @@ START_TEST (test_rhythmdb_property_model_sorting)
/* test a comes immediately before c */
rhythmdb_property_model_iter_from_string (propmodel, "a", &iter1);
rhythmdb_property_model_iter_from_string (propmodel, "c", &iter2);
- fail_unless (iter1.user_data == g_sequence_iter_prev (iter2.user_data));
+ ck_assert (iter1.user_data == g_sequence_iter_prev (iter2.user_data));
/* test c comes immediately before the_b */
rhythmdb_property_model_iter_from_string (propmodel, "c", &iter1);
rhythmdb_property_model_iter_from_string (propmodel, "the b", &iter2);
- fail_unless (iter1.user_data == g_sequence_iter_prev (iter2.user_data));
+ ck_assert (iter1.user_data == g_sequence_iter_prev (iter2.user_data));
end_step ();
@@ -500,12 +500,12 @@ START_TEST (test_rhythmdb_property_model_sorting)
/* test a comes immediately before the_b */
rhythmdb_property_model_iter_from_string (propmodel, "a", &iter1);
rhythmdb_property_model_iter_from_string (propmodel, "the b", &iter2);
- fail_unless (iter1.user_data == g_sequence_iter_prev (iter2.user_data));
+ ck_assert (iter1.user_data == g_sequence_iter_prev (iter2.user_data));
/* test the_b comes immediately before c */
rhythmdb_property_model_iter_from_string (propmodel, "the b", &iter1);
rhythmdb_property_model_iter_from_string (propmodel, "c", &iter2);
- fail_unless (iter1.user_data == g_sequence_iter_prev (iter2.user_data));
+ ck_assert (iter1.user_data == g_sequence_iter_prev (iter2.user_data));
end_step();
@@ -518,11 +518,11 @@ START_TEST (test_rhythmdb_property_model_sorting)
/* property model order shouldn't have changed */
rhythmdb_property_model_iter_from_string (propmodel, "a", &iter1);
rhythmdb_property_model_iter_from_string (propmodel, "THE B", &iter2);
- fail_unless (iter1.user_data == g_sequence_iter_prev (iter2.user_data));
+ ck_assert (iter1.user_data == g_sequence_iter_prev (iter2.user_data));
rhythmdb_property_model_iter_from_string (propmodel, "THE B", &iter1);
rhythmdb_property_model_iter_from_string (propmodel, "c", &iter2);
- fail_unless (iter1.user_data == g_sequence_iter_prev (iter2.user_data));
+ ck_assert (iter1.user_data == g_sequence_iter_prev (iter2.user_data));
end_step();
@@ -535,11 +535,11 @@ START_TEST (test_rhythmdb_property_model_sorting)
/* property model order shouldn't have changed */
rhythmdb_property_model_iter_from_string (propmodel, "a", &iter1);
rhythmdb_property_model_iter_from_string (propmodel, "THE B", &iter2);
- fail_unless (iter1.user_data == g_sequence_iter_prev (iter2.user_data));
+ ck_assert (iter1.user_data == g_sequence_iter_prev (iter2.user_data));
rhythmdb_property_model_iter_from_string (propmodel, "THE B", &iter1);
rhythmdb_property_model_iter_from_string (propmodel, "c", &iter2);
- fail_unless (iter1.user_data == g_sequence_iter_prev (iter2.user_data));
+ ck_assert (iter1.user_data == g_sequence_iter_prev (iter2.user_data));
end_step();
@@ -552,11 +552,11 @@ START_TEST (test_rhythmdb_property_model_sorting)
/* property model order should have changed to match */
rhythmdb_property_model_iter_from_string (propmodel, "a", &iter1);
rhythmdb_property_model_iter_from_string (propmodel, "c", &iter2);
- fail_unless (iter1.user_data == g_sequence_iter_prev (iter2.user_data));
+ ck_assert (iter1.user_data == g_sequence_iter_prev (iter2.user_data));
rhythmdb_property_model_iter_from_string (propmodel, "c", &iter1);
rhythmdb_property_model_iter_from_string (propmodel, "THE B", &iter2);
- fail_unless (iter1.user_data == g_sequence_iter_prev (iter2.user_data));
+ ck_assert (iter1.user_data == g_sequence_iter_prev (iter2.user_data));
end_step();
@@ -569,11 +569,11 @@ START_TEST (test_rhythmdb_property_model_sorting)
/* property model order should have changed to match */
rhythmdb_property_model_iter_from_string (propmodel, "a", &iter1);
rhythmdb_property_model_iter_from_string (propmodel, "c", &iter2);
- fail_unless (iter1.user_data == g_sequence_iter_prev (iter2.user_data));
+ ck_assert (iter1.user_data == g_sequence_iter_prev (iter2.user_data));
rhythmdb_property_model_iter_from_string (propmodel, "c", &iter1);
rhythmdb_property_model_iter_from_string (propmodel, "THE B", &iter2);
- fail_unless (iter1.user_data == g_sequence_iter_prev (iter2.user_data));
+ ck_assert (iter1.user_data == g_sequence_iter_prev (iter2.user_data));
end_step();
diff --git a/tests/test-rhythmdb-query-model.c b/tests/test-rhythmdb-query-model.c
index 3cab51a8a..da2615699 100644
--- a/tests/test-rhythmdb-query-model.c
+++ b/tests/test-rhythmdb-query-model.c
@@ -47,13 +47,13 @@ test_query_eval (RhythmDB *db, RhythmDBQuery *query, RhythmDBEntry *entry, gbool
/* direct evaluation - need to preprocess it first */
processed = rhythmdb_query_copy (query);
rhythmdb_query_preprocess (db, processed);
- fail_unless (rhythmdb_evaluate_query (db, processed, entry) == expected, what);
+ ck_assert_msg (rhythmdb_evaluate_query (db, processed, entry) == expected, "%s", what);
rhythmdb_query_free (processed);
/* query evaluation - query is preprocessed by rhythmdb */
model = rhythmdb_query_model_new_empty (db);
rhythmdb_do_full_query_parsed (db, RHYTHMDB_QUERY_RESULTS (model), query);
- fail_unless (rhythmdb_query_model_entry_to_iter (model, entry, &iter) == expected, what);
+ ck_assert_msg (rhythmdb_query_model_entry_to_iter (model, entry, &iter) == expected, "%s", what);
g_object_unref (model);
}
@@ -75,7 +75,7 @@ START_TEST (test_rhythmdb_db_queries)
start_test_case ();
entry = rhythmdb_entry_new (db, RHYTHMDB_ENTRY_TYPE_IGNORE, "file:///whee.ogg");
- fail_unless (entry != NULL, "failed to create entry");
+ ck_assert_msg (entry != NULL, "failed to create entry");
g_value_init (&val, G_TYPE_STRING);
g_value_set_static_string (&val, "Rock");
@@ -247,8 +247,8 @@ START_TEST (test_hidden_chain_filter)
/* add entry to base, should be in both */
rhythmdb_query_model_add_entry (base_model, entry, -1);
- fail_unless (rhythmdb_query_model_entry_to_iter (base_model, entry, &iter));
- fail_unless (rhythmdb_query_model_entry_to_iter (filter_model, entry, &iter));
+ ck_assert (rhythmdb_query_model_entry_to_iter (base_model, entry, &iter));
+ ck_assert (rhythmdb_query_model_entry_to_iter (filter_model, entry, &iter));
end_step ();
@@ -259,8 +259,8 @@ START_TEST (test_hidden_chain_filter)
rhythmdb_commit (db);
wait_for_signal ();
- fail_unless (rhythmdb_query_model_entry_to_iter (base_model, entry, &iter));
- fail_if (rhythmdb_query_model_entry_to_iter (filter_model, entry, &iter));
+ ck_assert (rhythmdb_query_model_entry_to_iter (base_model, entry, &iter));
+ ck_assert (rhythmdb_query_model_entry_to_iter (filter_model, entry, &iter) == FALSE);
end_step ();
@@ -271,8 +271,8 @@ START_TEST (test_hidden_chain_filter)
rhythmdb_commit (db);
wait_for_signal ();
- fail_unless (rhythmdb_query_model_entry_to_iter (base_model, entry, &iter));
- fail_unless (rhythmdb_query_model_entry_to_iter (filter_model, entry, &iter));
+ ck_assert (rhythmdb_query_model_entry_to_iter (base_model, entry, &iter));
+ ck_assert (rhythmdb_query_model_entry_to_iter (filter_model, entry, &iter));
end_step ();
diff --git a/tests/test-rhythmdb.c b/tests/test-rhythmdb.c
index 036ac7086..1de5b052a 100644
--- a/tests/test-rhythmdb.c
+++ b/tests/test-rhythmdb.c
@@ -59,7 +59,7 @@ START_TEST (test_rhythmdb_indexing)
gboolean b;
entry = rhythmdb_entry_new (db, RHYTHMDB_ENTRY_TYPE_IGNORE, "file:///whee.ogg");
- fail_unless (entry != NULL, "failed to create entry");
+ ck_assert_msg (entry != NULL, "failed to create entry");
g_value_init (&val, G_TYPE_STRING);
g_value_set_static_string (&val, "Rock");
@@ -84,16 +84,16 @@ START_TEST (test_rhythmdb_indexing)
rhythmdb_commit (db);
/* check the data is recorded correctly */
- fail_unless (strcmp (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_LOCATION), "file:///whee.ogg")
== 0,
- "LOCATION set incorrectly");
- fail_unless (strcmp (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_GENRE), "Rock") == 0,
- "GENRE set incorrectly");
- fail_unless (strcmp (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_ARTIST), "Nine Inch Nails") == 0,
- "ARTIST set incorrectly");
- fail_unless (strcmp (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_ALBUM), "Pretty Hate Machine")
== 0,
- "ALBUM set incorrectly");
- fail_unless (strcmp (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_TITLE), "Sin") == 0,
- "TITLE set incorrectly");
+ ck_assert_msg (strcmp (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_LOCATION), "file:///whee.ogg")
== 0,
+ "LOCATION set incorrectly");
+ ck_assert_msg (strcmp (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_GENRE), "Rock") == 0,
+ "GENRE set incorrectly");
+ ck_assert_msg (strcmp (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_ARTIST), "Nine Inch Nails") ==
0,
+ "ARTIST set incorrectly");
+ ck_assert_msg (strcmp (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_ALBUM), "Pretty Hate Machine")
== 0,
+ "ALBUM set incorrectly");
+ ck_assert_msg (strcmp (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_TITLE), "Sin") == 0,
+ "TITLE set incorrectly");
/* check changing album */
g_value_init (&val, G_TYPE_STRING);
@@ -102,16 +102,16 @@ START_TEST (test_rhythmdb_indexing)
g_value_unset (&val);
rhythmdb_commit (db);
- fail_unless (strcmp (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_LOCATION), "file:///whee.ogg")
== 0,
- "LOCATION set incorrectly");
- fail_unless (strcmp (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_GENRE), "Rock") == 0,
- "GENRE set incorrectly");
- fail_unless (strcmp (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_ARTIST), "Nine Inch Nails") == 0,
- "ARTIST set incorrectly");
- fail_unless (strcmp (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_ALBUM), "Broken") == 0,
- "ALBUM set incorrectly");
- fail_unless (strcmp (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_TITLE), "Sin") == 0,
- "TITLE set incorrectly");
+ ck_assert_msg (strcmp (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_LOCATION), "file:///whee.ogg")
== 0,
+ "LOCATION set incorrectly");
+ ck_assert_msg (strcmp (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_GENRE), "Rock") == 0,
+ "GENRE set incorrectly");
+ ck_assert_msg (strcmp (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_ARTIST), "Nine Inch Nails") ==
0,
+ "ARTIST set incorrectly");
+ ck_assert_msg (strcmp (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_ALBUM), "Broken") == 0,
+ "ALBUM set incorrectly");
+ ck_assert_msg (strcmp (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_TITLE), "Sin") == 0,
+ "TITLE set incorrectly");
/* check changing artist */
g_value_init (&val, G_TYPE_STRING);
@@ -120,16 +120,16 @@ START_TEST (test_rhythmdb_indexing)
g_value_unset (&val);
rhythmdb_commit (db);
- fail_unless (strcmp (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_LOCATION), "file:///whee.ogg")
== 0,
- "LOCATION set incorrectly");
- fail_unless (strcmp (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_GENRE), "Rock") == 0,
- "GENRE set incorrectly");
- fail_unless (strcmp (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_ARTIST), "Evanescence") == 0,
- "ARTIST set incorrectly");
- fail_unless (strcmp (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_ALBUM), "Broken") == 0,
- "ALBUM set incorrectly");
- fail_unless (strcmp (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_TITLE), "Sin") == 0,
- "TITLE set incorrectly");
+ ck_assert_msg (strcmp (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_LOCATION), "file:///whee.ogg")
== 0,
+ "LOCATION set incorrectly");
+ ck_assert_msg (strcmp (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_GENRE), "Rock") == 0,
+ "GENRE set incorrectly");
+ ck_assert_msg (strcmp (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_ARTIST), "Evanescence") == 0,
+ "ARTIST set incorrectly");
+ ck_assert_msg (strcmp (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_ALBUM), "Broken") == 0,
+ "ALBUM set incorrectly");
+ ck_assert_msg (strcmp (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_TITLE), "Sin") == 0,
+ "TITLE set incorrectly");
/* check removal */
rhythmdb_entry_delete (db, entry);
@@ -137,7 +137,7 @@ START_TEST (test_rhythmdb_indexing)
b = FALSE;
rhythmdb_entry_foreach (db, (RhythmDBEntryForeachFunc) set_true, &b);
- fail_unless (b == FALSE, "entry not deleted");
+ ck_assert_msg (b == FALSE, "entry not deleted");
}
END_TEST
@@ -148,40 +148,40 @@ START_TEST (test_rhythmdb_multiple)
/* add multiple entries */
entry1 = rhythmdb_entry_new (db, RHYTHMDB_ENTRY_TYPE_IGNORE, "file:///foo.mp3");
rhythmdb_commit (db);
- fail_unless (entry1 != NULL, "failed to create entry");
- fail_unless (rhythmdb_entry_lookup_by_location (db, "file:///foo.mp3") == entry1, "entry missing");
+ ck_assert_msg (entry1 != NULL, "failed to create entry");
+ ck_assert_msg (rhythmdb_entry_lookup_by_location (db, "file:///foo.mp3") == entry1, "entry missing");
entry2 = rhythmdb_entry_new (db, RHYTHMDB_ENTRY_TYPE_IGNORE, "file:///bar.mp3");
rhythmdb_commit (db);
- fail_unless (entry2 != NULL, "failed to create entry");
- fail_unless (rhythmdb_entry_lookup_by_location (db, "file:///bar.mp3") == entry2, "entry missing");
+ ck_assert_msg (entry2 != NULL, "failed to create entry");
+ ck_assert_msg (rhythmdb_entry_lookup_by_location (db, "file:///bar.mp3") == entry2, "entry missing");
entry3 = rhythmdb_entry_new (db, RHYTHMDB_ENTRY_TYPE_IGNORE, "file:///baz.mp3");
rhythmdb_commit (db);
- fail_unless (entry3 != NULL, "failed to create entry");
- fail_unless (rhythmdb_entry_lookup_by_location (db, "file:///baz.mp3") == entry3, "entry missing");
+ ck_assert_msg (entry3 != NULL, "failed to create entry");
+ ck_assert_msg (rhythmdb_entry_lookup_by_location (db, "file:///baz.mp3") == entry3, "entry missing");
/* check they're still there */
- fail_unless (rhythmdb_entry_lookup_by_location (db, "file:///foo.mp3") == entry1, "entry missing");
- fail_unless (rhythmdb_entry_lookup_by_location (db, "file:///bar.mp3") == entry2, "entry missing");
- fail_unless (rhythmdb_entry_lookup_by_location (db, "file:///baz.mp3") == entry3, "entry missing");
+ ck_assert_msg (rhythmdb_entry_lookup_by_location (db, "file:///foo.mp3") == entry1, "entry missing");
+ ck_assert_msg (rhythmdb_entry_lookup_by_location (db, "file:///bar.mp3") == entry2, "entry missing");
+ ck_assert_msg (rhythmdb_entry_lookup_by_location (db, "file:///baz.mp3") == entry3, "entry missing");
/* remove the middle one and check again */
rhythmdb_entry_delete (db, entry2);
rhythmdb_commit (db);
- fail_unless (rhythmdb_entry_lookup_by_location (db, "file:///foo.mp3") == entry1, "entry missing");
- fail_unless (rhythmdb_entry_lookup_by_location (db, "file:///bar.mp3") == NULL, "entry not deleted");
- fail_unless (rhythmdb_entry_lookup_by_location (db, "file:///baz.mp3") == entry3, "entry missing");
+ ck_assert_msg (rhythmdb_entry_lookup_by_location (db, "file:///foo.mp3") == entry1, "entry missing");
+ ck_assert_msg (rhythmdb_entry_lookup_by_location (db, "file:///bar.mp3") == NULL, "entry not
deleted");
+ ck_assert_msg (rhythmdb_entry_lookup_by_location (db, "file:///baz.mp3") == entry3, "entry missing");
/* and the others */
rhythmdb_entry_delete (db, entry1);
rhythmdb_entry_delete (db, entry3);
rhythmdb_commit (db);
- fail_unless (rhythmdb_entry_lookup_by_location (db, "file:///foo.mp3") == NULL, "entry not deleted");
- fail_unless (rhythmdb_entry_lookup_by_location (db, "file:///bar.mp3") == NULL, "entry not deleted");
- fail_unless (rhythmdb_entry_lookup_by_location (db, "file:///baz.mp3") == NULL, "entry not deleted");
+ ck_assert_msg (rhythmdb_entry_lookup_by_location (db, "file:///foo.mp3") == NULL, "entry not
deleted");
+ ck_assert_msg (rhythmdb_entry_lookup_by_location (db, "file:///bar.mp3") == NULL, "entry not
deleted");
+ ck_assert_msg (rhythmdb_entry_lookup_by_location (db, "file:///baz.mp3") == NULL, "entry not
deleted");
}
END_TEST
@@ -192,7 +192,7 @@ START_TEST (test_rhythmdb_mirroring)
const char *str;
entry = rhythmdb_entry_new (db, RHYTHMDB_ENTRY_TYPE_IGNORE, "file:///foo.mp3");
- fail_unless (entry != NULL, "failed to create entry");
+ ck_assert_msg (entry != NULL, "failed to create entry");
/* check the last-played date is mirrored */
g_value_init (&val, G_TYPE_ULONG);
@@ -202,7 +202,7 @@ START_TEST (test_rhythmdb_mirroring)
rhythmdb_commit (db);
str = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_LAST_PLAYED_STR);
- fail_unless (str && (strlen (str) > 0), "date not converted to string");
+ ck_assert_msg (str && (strlen (str) > 0), "date not converted to string");
/* check folded and sort-key varients */
g_value_init (&val, G_TYPE_STRING);
@@ -212,9 +212,9 @@ START_TEST (test_rhythmdb_mirroring)
rhythmdb_commit (db);
str = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_TITLE_SORT_KEY);
- fail_unless (str && (strlen (str) > 0), "sort-key not generated");
+ ck_assert_msg (str && (strlen (str) > 0), "sort-key not generated");
str = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_TITLE_FOLDED);
- fail_unless (str && (strcmp (str, "foo") == 0), "folded variant not generated");
+ ck_assert_msg (str && (strcmp (str, "foo") == 0), "folded variant not generated");
g_value_init (&val, G_TYPE_STRING);
g_value_set_static_string (&val, "BAR");
@@ -223,9 +223,9 @@ START_TEST (test_rhythmdb_mirroring)
rhythmdb_commit (db);
str = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_TITLE_SORT_KEY);
- fail_unless (str && (strlen (str) > 0), "sort-key not generated");
+ ck_assert_msg (str && (strlen (str) > 0), "sort-key not generated");
str = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_TITLE_FOLDED);
- fail_unless (str && (strcmp (str, "bar") == 0), "folded variant not generated");
+ ck_assert_msg (str && (strcmp (str, "bar") == 0), "folded variant not generated");
}
@@ -256,72 +256,72 @@ START_TEST (test_rhythmdb_keywords)
keyword_baz = rb_refstring_new ("baz");
entry = rhythmdb_entry_new (db, RHYTHMDB_ENTRY_TYPE_IGNORE, "file:///foo.mp3");
- fail_unless (entry != NULL, "failed to create entry");
+ ck_assert_msg (entry != NULL, "failed to create entry");
/* new entries should have 0 keywords */
list = rhythmdb_entry_keywords_get (db, entry);
- fail_unless (count_and_free_refstring_list (list) == 0, "new entry had keywords");
+ ck_assert_msg (count_and_free_refstring_list (list) == 0, "new entry had keywords");
/* adding one keyword */
ret = rhythmdb_entry_keyword_add (db, entry, keyword_foo);
- fail_unless (ret == FALSE, "entry incorrectly reported as having keyword already");
+ ck_assert_msg (ret == FALSE, "entry incorrectly reported as having keyword already");
list = rhythmdb_entry_keywords_get (db, entry);
- fail_unless (count_and_free_refstring_list (list) == 1, "entry wrong number of keywords after one was
added");
+ ck_assert_msg (count_and_free_refstring_list (list) == 1, "entry wrong number of keywords after one
was added");
/* has added keyword */
ret = rhythmdb_entry_keyword_has (db, entry, keyword_foo);
- fail_unless (ret == TRUE, "reported not having just-added keyword");
+ ck_assert_msg (ret == TRUE, "reported not having just-added keyword");
/* add keyword again */
ret = rhythmdb_entry_keyword_add (db, entry, keyword_foo);
- fail_unless (ret == TRUE, "entry incorrectly reported as not keyword already");
+ ck_assert_msg (ret == TRUE, "entry incorrectly reported as not keyword already");
/* check keyword count*/
list = rhythmdb_entry_keywords_get (db, entry);
- fail_unless (count_and_free_refstring_list (list) == 1, "entry wrong number of keywords after one was
re-added");
+ ck_assert_msg (count_and_free_refstring_list (list) == 1, "entry wrong number of keywords after one
was re-added");
/* ensure it has only that keyword */
ret = rhythmdb_entry_keyword_has (db, entry, keyword_bar);
- fail_unless (ret == FALSE, "reported having wrong keyword");
+ ck_assert_msg (ret == FALSE, "reported having wrong keyword");
/* remove the keyword */
ret = rhythmdb_entry_keyword_remove (db, entry, keyword_foo);
- fail_unless (ret == TRUE, "reported having not previously having keyword");
+ ck_assert_msg (ret == TRUE, "reported having not previously having keyword");
/* has removed keyword */
ret = rhythmdb_entry_keyword_has (db, entry, keyword_foo);
- fail_unless (ret == FALSE, "reported having just-removed keyword");
+ ck_assert_msg (ret == FALSE, "reported having just-removed keyword");
/* check count is back to zero */
list = rhythmdb_entry_keywords_get (db, entry);
- fail_unless (count_and_free_refstring_list (list) == 0, "entry has keywords after they were removed");
+ ck_assert_msg (count_and_free_refstring_list (list) == 0, "entry has keywords after they were
removed");
/* try removing keyword again */
ret = rhythmdb_entry_keyword_remove (db, entry, keyword_foo);
- fail_unless (ret == FALSE, "reported previously having already removed keyword");
+ ck_assert_msg (ret == FALSE, "reported previously having already removed keyword");
/* add and remove several keywords */
ret = rhythmdb_entry_keyword_add (db, entry, keyword_foo);
- fail_unless (ret == FALSE, "reported previously having already removed keyword");
+ ck_assert_msg (ret == FALSE, "reported previously having already removed keyword");
ret = rhythmdb_entry_keyword_add (db, entry, keyword_bar);
- fail_unless (ret == FALSE, "reported previously having already never-added keyword");
+ ck_assert_msg (ret == FALSE, "reported previously having already never-added keyword");
ret = rhythmdb_entry_keyword_add (db, entry, keyword_baz);
- fail_unless (ret == FALSE, "reported previously having already never-added keyword");
+ ck_assert_msg (ret == FALSE, "reported previously having already never-added keyword");
list = rhythmdb_entry_keywords_get (db, entry);
- fail_unless (count_and_free_refstring_list (list) == 3, "entry wrong number of keywords after several
were added");
+ ck_assert_msg (count_and_free_refstring_list (list) == 3, "entry wrong number of keywords after
several were added");
ret = rhythmdb_entry_keyword_remove (db, entry, keyword_foo);
- fail_unless (ret == TRUE, "reported previously not having added keyword");
+ ck_assert_msg (ret == TRUE, "reported previously not having added keyword");
list = rhythmdb_entry_keywords_get (db, entry);
- fail_unless (count_and_free_refstring_list (list) == 2, "entry wrong number of keywords after several
were added");
+ ck_assert_msg (count_and_free_refstring_list (list) == 2, "entry wrong number of keywords after
several were added");
ret = rhythmdb_entry_keyword_remove (db, entry, keyword_bar);
- fail_unless (ret == TRUE, "reported previously not having added keyword");
+ ck_assert_msg (ret == TRUE, "reported previously not having added keyword");
list = rhythmdb_entry_keywords_get (db, entry);
- fail_unless (count_and_free_refstring_list (list) == 1, "entry wrong number of keywords after several
were added");
+ ck_assert_msg (count_and_free_refstring_list (list) == 1, "entry wrong number of keywords after
several were added");
ret = rhythmdb_entry_keyword_remove (db, entry, keyword_baz);
- fail_unless (ret == TRUE, "reported previously not having added keyword");
+ ck_assert_msg (ret == TRUE, "reported previously not having added keyword");
list = rhythmdb_entry_keywords_get (db, entry);
- fail_unless (count_and_free_refstring_list (list) == 0, "entry wrong number of keywords after several
were added");
+ ck_assert_msg (count_and_free_refstring_list (list) == 0, "entry wrong number of keywords after
several were added");
}
END_TEST
@@ -344,7 +344,7 @@ START_TEST (test_rhythmdb_deserialisation1)
RHYTHMDB_PROP_TYPE, RHYTHMDB_ENTRY_TYPE_IGNORE,
RHYTHMDB_QUERY_END);
wait_for_signal ();
- fail_unless (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (model), NULL) == 0, "deserialisation
incorrect");
+ ck_assert_msg (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (model), NULL) == 0, "deserialisation
incorrect");
g_object_unref (model);
}
END_TEST
@@ -368,7 +368,7 @@ START_TEST (test_rhythmdb_deserialisation2)
RHYTHMDB_QUERY_END);
wait_for_signal ();
/* FIXME: this fails for some reason
- fail_unless (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (model), NULL) == 1, "deserialisation
incorrect");*/
+ ck_assert_msg (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (model), NULL) == 1, "deserialisation
incorrect");*/
g_object_unref (model);
/* TODO: check values */
@@ -395,7 +395,7 @@ START_TEST (test_rhythmdb_deserialisation3)
RHYTHMDB_QUERY_END);
wait_for_signal ();
/* FIXME: this fails for some reason
- fail_unless (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (model), NULL) == 1, "deserialisation
incorrect");*/
+ ck_assert_msg (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (model), NULL) == 1, "deserialisation
incorrect");*/
g_object_unref (model);
/* TODO: check values */
@@ -415,16 +415,16 @@ START_TEST (test_rhythmdb_podcast_upgrade)
entry = rhythmdb_entry_lookup_by_location (db,
"file:///home/tester/Desktop/BBC%20Xtra/xtra_20080906-1226a.mp3");
- fail_unless (entry != NULL, "entry missing");
- fail_unless (rhythmdb_entry_get_entry_type (entry) == RHYTHMDB_ENTRY_TYPE_PODCAST_POST, "entry isn't
a podcast");
+ ck_assert_msg (entry != NULL, "entry missing");
+ ck_assert_msg (rhythmdb_entry_get_entry_type (entry) == RHYTHMDB_ENTRY_TYPE_PODCAST_POST, "entry
isn't a podcast");
mountpoint = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_MOUNTPOINT);
- fail_unless (mountpoint != NULL, "no mountpoint for podcast");
- fail_unless (strcmp (mountpoint,
"http://downloads.bbc.co.uk/podcasts/worldservice/xtra/xtra_20080906-1226a.mp3") == 0, "wrong mountpoint for
podcast");
+ ck_assert_msg (mountpoint != NULL, "no mountpoint for podcast");
+ ck_assert_msg (strcmp (mountpoint,
"http://downloads.bbc.co.uk/podcasts/worldservice/xtra/xtra_20080906-1226a.mp3") == 0, "wrong mountpoint for
podcast");
entry = rhythmdb_entry_lookup_by_location (db,
"http://downloads.bbc.co.uk/podcasts/worldservice/xtra/xtra_20080903-1217a.mp3");
- fail_unless (entry != NULL, "entry not upgraded");
- fail_unless (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_MOUNTPOINT) == NULL, "wrong mountpoint
for podcast");
+ ck_assert_msg (entry != NULL, "entry not upgraded");
+ ck_assert_msg (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_MOUNTPOINT) == NULL, "wrong mountpoint
for podcast");
}
END_TEST
@@ -434,23 +434,23 @@ START_TEST (test_rhythmdb_modify_after_delete)
GValue val = {0,};
entry = rhythmdb_entry_new (db, RHYTHMDB_ENTRY_TYPE_IGNORE, "file:///whee.ogg");
- fail_unless (entry != NULL, "failed to create entry");
+ ck_assert_msg (entry != NULL, "failed to create entry");
g_value_init (&val, G_TYPE_STRING);
g_value_set_static_string (&val, "Anything");
rhythmdb_entry_set (db, entry, RHYTHMDB_PROP_GENRE, &val);
g_value_unset (&val);
-
+
g_value_init (&val, G_TYPE_STRING);
g_value_set_static_string (&val, "Nothing");
rhythmdb_entry_set (db, entry, RHYTHMDB_PROP_ARTIST, &val);
g_value_unset (&val);
-
+
g_value_init (&val, G_TYPE_STRING);
g_value_set_static_string (&val, "Something");
rhythmdb_entry_set (db, entry, RHYTHMDB_PROP_ALBUM, &val);
g_value_unset (&val);
-
+
g_value_init (&val, G_TYPE_STRING);
g_value_set_static_string (&val, "Thing");
rhythmdb_entry_set (db, entry, RHYTHMDB_PROP_TITLE, &val);
@@ -461,12 +461,12 @@ START_TEST (test_rhythmdb_modify_after_delete)
rhythmdb_entry_delete (db, entry);
rhythmdb_commit (db);
-
+
g_value_init (&val, G_TYPE_STRING);
g_value_set_static_string (&val, "Something Else");
rhythmdb_entry_set (db, entry, RHYTHMDB_PROP_ALBUM, &val);
g_value_unset (&val);
-
+
rhythmdb_commit (db);
rhythmdb_entry_unref (entry);
}
@@ -476,7 +476,7 @@ static void
commit_change_merge_cb (RhythmDB *db, RhythmDBEntry *entry, GArray *changes, gpointer ok)
{
int expected = GPOINTER_TO_INT (ok);
- fail_unless (changes->len == expected, "commit change lists merged");
+ ck_assert_msg (changes->len == expected, "commit change lists merged");
}
START_TEST (test_rhythmdb_commit_change_merging)
@@ -485,7 +485,7 @@ START_TEST (test_rhythmdb_commit_change_merging)
GValue val = {0,};
entry = rhythmdb_entry_new (db, RHYTHMDB_ENTRY_TYPE_IGNORE, "file:///whee.ogg");
- fail_unless (entry != NULL, "failed to create entry");
+ ck_assert_msg (entry != NULL, "failed to create entry");
rhythmdb_commit (db);
diff --git a/tests/test-utils.c b/tests/test-utils.c
index ff96a2c2a..92f626e49 100644
--- a/tests/test-utils.c
+++ b/tests/test-utils.c
@@ -137,7 +137,7 @@ test_rhythmdb_setup (void)
init_once (TRUE);
db = rhythmdb_tree_new ("test");
- fail_unless (db != NULL, "failed to initialise DB");
+ ck_assert_msg (db != NULL, "failed to initialise DB");
rhythmdb_start_action_thread (db);
/* allow songs and ignored entries to be synced to for the tests */
@@ -153,7 +153,7 @@ test_rhythmdb_setup (void)
void
test_rhythmdb_shutdown (void)
{
- fail_unless (db != NULL, "failed to shutdown DB");
+ ck_assert_msg (db != NULL, "failed to shutdown DB");
rhythmdb_shutdown (db);
/* release the reference, and wait until after finalisation */
diff --git a/tests/test-utils.h b/tests/test-utils.h
index 2d129d7cd..df3e635ac 100644
--- a/tests/test-utils.h
+++ b/tests/test-utils.h
@@ -29,10 +29,6 @@
#ifndef __TEST_UTILS_H
#define __TEST_UTILS_H
-#ifndef fail_if
-#define fail_if(expr, ...) fail_unless(!(expr), "Failure '"#expr"' occured")
-#endif
-
/* yes. really. */
extern RhythmDB *db;
diff --git a/tests/test-widgets.c b/tests/test-widgets.c
index 9cabbaea7..d74c0df47 100644
--- a/tests/test-widgets.c
+++ b/tests/test-widgets.c
@@ -13,10 +13,6 @@
#include "test-utils.h"
-#ifndef fail_if
-#define fail_if(expr, ...) fail_unless(!(expr), "Failure '"#expr"' occured")
-#endif
-
static gboolean
rhythmdb_query_equal (const RhythmDBQuery *q1, const RhythmDBQuery *q2)
{
@@ -81,16 +77,16 @@ query_creator_test_load_query (RhythmDB *db,
squery,
limit_type, limit_value,
sort_column, sort_direction);
-
+
str1 = rhythmdb_query_to_string (db, squery);
- fail_unless (creator != NULL,
- "could not create query editor for %s", str1);
+ ck_assert_msg (creator != NULL,
+ "could not create query editor for %s", str1);
/* check queries */
query2 = rb_query_creator_get_query (RB_QUERY_CREATOR (creator));
str2 = rhythmdb_query_to_string (db, query2);
- fail_unless (rhythmdb_query_equal (squery, query2),
- "queries differ: %s; %s", str1, str2);
+ ck_assert_msg (rhythmdb_query_equal (squery, query2),
+ "queries differ: %s; %s", str1, str2);
rhythmdb_query_free (query2);
g_free (str2);
g_free (str1);
@@ -98,13 +94,13 @@ query_creator_test_load_query (RhythmDB *db,
/* check limits */
rb_query_creator_get_limit (RB_QUERY_CREATOR (creator),
&limit_type2, &limit_value2);
- fail_unless (limit_type == limit_type2,
- "limit types differ: %d; %d", limit_type, limit_type2);
+ ck_assert_msg (limit_type == limit_type2,
+ "limit types differ: %d; %d", limit_type, limit_type2);
if (limit_value == NULL) {
- fail_unless (limit_value == limit_value2, "wasn't supposed to get a limit value");
+ ck_assert_msg (limit_value == limit_value2, "wasn't supposed to get a limit value");
} else {
- fail_unless (g_variant_equal (limit_value, limit_value2),
- "limit values differ: %s; %s", g_variant_print (limit_value, TRUE),
g_variant_print (limit_value2, TRUE));
+ ck_assert_msg (g_variant_equal (limit_value, limit_value2),
+ "limit values differ: %s; %s", g_variant_print (limit_value, TRUE),
g_variant_print (limit_value2, TRUE));
}
if (limit_value2)
g_variant_unref (limit_value2);
@@ -112,10 +108,10 @@ query_creator_test_load_query (RhythmDB *db,
/* check sorting */
rb_query_creator_get_sort_order (RB_QUERY_CREATOR (creator),
&sort_column2, &sort_direction2);
- fail_unless (strcmp (sort_column2, sort_column) == 0,
- "sort columns differ: %s; %s", sort_column, sort_column2);
- fail_unless (sort_direction2 == sort_direction,
- "sort directions differ: %d; %d", sort_direction, sort_direction2);
+ ck_assert_msg (strcmp (sort_column2, sort_column) == 0,
+ "sort columns differ: %s; %s", sort_column, sort_column2);
+ ck_assert_msg (sort_direction2 == sort_direction,
+ "sort directions differ: %d; %d", sort_direction, sort_direction2);
rhythmdb_query_free (squery);
gtk_widget_destroy (creator);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]