diff options
author | Martyn Russell <martyn@lanedo.com> | 2014-09-28 19:49:49 +0100 |
---|---|---|
committer | Martyn Russell <martyn@lanedo.com> | 2014-10-27 16:02:00 +0000 |
commit | b3fd5c0041b84bc7f7e62ac02d03ad67223c5a10 (patch) | |
tree | d4ec4ac0d999c2b8dbfa73ce67b1ddcc80f8ab6a /tests/libtracker-common | |
parent | 10695ecd1f74d7c12546c2d797c34fc4ff63c7ff (diff) | |
download | tracker-b3fd5c0041b84bc7f7e62ac02d03ad67223c5a10.tar.gz |
libtracker-common: Removed all unused type utils functions
Includes:
gchar * tracker_glong_to_string (glong i);
gchar * tracker_gint_to_string (gint i);
gchar * tracker_guint_to_string (guint i);
gchar * tracker_gint32_to_string (gint32 i);
gchar * tracker_guint32_to_string (guint32 i);
gboolean tracker_string_to_uint (const gchar *s,
guint *ret);
gchar * tracker_string_list_to_string (gchar **strv,
gsize length,
gchar sep);
GList * tracker_glist_copy_with_string_data (GList *list);
gchar * tracker_string_boolean_to_string_gint (const gchar *value);
Diffstat (limited to 'tests/libtracker-common')
-rw-r--r-- | tests/libtracker-common/tracker-type-utils-test.c | 255 |
1 files changed, 0 insertions, 255 deletions
diff --git a/tests/libtracker-common/tracker-type-utils-test.c b/tests/libtracker-common/tracker-type-utils-test.c index 1f9559bf1..808c78094 100644 --- a/tests/libtracker-common/tracker-type-utils-test.c +++ b/tests/libtracker-common/tracker-type-utils-test.c @@ -25,125 +25,6 @@ #include <libtracker-common/tracker-type-utils.h> static void -test_long_to_string (void) -{ - glong n; - gchar *result; - - n = 10050; - result = tracker_glong_to_string (n); - g_assert_cmpstr (result, ==, "10050"); - g_free (result); - - n = -9950; - result = tracker_glong_to_string (n); - g_assert_cmpstr (result, ==, "-9950"); - g_free (result); -} - -static void -test_int_to_string (void) -{ - gint n; - gchar *result; - - n = 654; - result = tracker_gint_to_string (n); - g_assert_cmpstr (result, ==, "654"); - g_free (result); - - n = -963; - result = tracker_gint_to_string (n); - g_assert_cmpstr (result, ==, "-963"); - g_free (result); - -} - -static void -test_uint_to_string (void) -{ - guint n; - gchar *result; - - n = 100; - result = tracker_guint_to_string (n); - g_assert_cmpstr (result, ==, "100"); - g_free (result); -} - -static void -test_gint32_to_string (void) -{ - gint32 n; - gchar *result; - - n = 100; - result = tracker_gint32_to_string (n); - g_assert_cmpstr (result, ==, "100"); - g_free (result); - - n = -96; - result = tracker_gint32_to_string (n); - g_assert_cmpstr (result, ==, "-96"); - g_free (result); - -} - -static void -test_guint32_to_string (void) -{ - guint32 n; - gchar *result; - - n = 100; - result = tracker_guint32_to_string (n); - g_assert_cmpstr (result, ==, "100"); - g_free (result); - -} - -static void -test_string_to_uint_failures_subprocess_1 (void) -{ - guint num = 10; - - tracker_string_to_uint (NULL, &num); -} - -static void -test_string_to_uint_failures_subprocess_2 (void) -{ - tracker_string_to_uint ("199", NULL); -} - -static void -test_string_to_uint_failures (void) -{ - g_test_trap_subprocess ("/libtracker-common/tracker-type-utils/string_to_uint_failures/subprocess/1", 0, 0); - g_test_trap_assert_failed (); - g_test_trap_assert_stderr ("*assertion 's != NULL' failed*"); - - g_test_trap_subprocess ("/libtracker-common/tracker-type-utils/string_to_uint_failures/subprocess/2", 0, 0); - g_test_trap_assert_failed (); - g_test_trap_assert_stderr ("*assertion 'value != NULL' failed*"); -} - -static void -test_string_to_uint (void) -{ - guint num_result, rc; - - rc = tracker_string_to_uint ("10", &num_result); - - g_assert (rc); - g_assert_cmpint (num_result, ==, 10); - - rc = tracker_string_to_uint ("i am not a number", &num_result); - g_assert (!rc); - g_assert_cmpint (rc, ==, 0); -} - -static void test_string_in_string_list_failures_subprocess (void) { const gchar *complete = "This is an extract of text with different terms an props like Audio:Title ..."; @@ -251,38 +132,6 @@ test_string_list_to_gslist (void) g_assert (tracker_string_in_gslist ("two", result)); g_assert (!tracker_string_in_gslist ("three", result)); g_assert (!tracker_string_in_gslist ("four", result)); - -} - -static void -test_string_list_to_string (void) -{ - const gchar *input = "one two three four"; - gchar **pieces; - gchar *result; - - pieces = g_strsplit (input, " ", 4); - - result = tracker_string_list_to_string (pieces, 4, ' '); - g_assert_cmpstr (input, ==, result); - g_free (result); - - result = tracker_string_list_to_string (pieces, 3, '_'); - g_assert_cmpstr ("one_two_three", ==, result); - g_free (result); - - result = tracker_string_list_to_string (NULL, 6, 'x'); - g_assert (result == NULL); - - result = tracker_string_list_to_string (pieces, -1, ' '); - g_assert_cmpstr (input, ==, result); - g_free (result); - - result = tracker_string_list_to_string (pieces, 6, ' '); - g_assert_cmpstr (input, ==, result); - g_free (result); - - g_strfreev (pieces); } static void @@ -297,66 +146,6 @@ test_string_to_string_list (void) } static void -test_boolean_as_text_to_number_failures_subprocess (void) -{ - tracker_string_boolean_to_string_gint (NULL); -} - -static void -test_boolean_as_text_to_number_failures (void) -{ - g_test_trap_subprocess ("/libtracker-common/tracker-type-utils/boolean_as_text_to_number_failures/subprocess", 0, 0); - g_test_trap_assert_failed (); - g_test_trap_assert_stderr ("*assertion 'value != NULL' failed*"); -} - -static void -test_boolean_as_text_to_number (void) -{ - gchar *result; - - /* Correct true values */ - result = tracker_string_boolean_to_string_gint ("True"); - g_assert_cmpstr (result, ==, "1"); - g_free (result); - - - result = tracker_string_boolean_to_string_gint ("TRUE"); - g_assert_cmpstr (result, ==, "1"); - g_free (result); - - result = tracker_string_boolean_to_string_gint ("true"); - g_assert_cmpstr (result, ==, "1"); - g_free (result); - - /* Correct false values */ - result = tracker_string_boolean_to_string_gint ("False"); - g_assert_cmpstr (result, ==, "0"); - g_free (result); - - result = tracker_string_boolean_to_string_gint ("FALSE"); - g_assert_cmpstr (result, ==, "0"); - g_free (result); - - result = tracker_string_boolean_to_string_gint ("false"); - g_assert_cmpstr (result, ==, "0"); - g_free (result); - - /* Invalid values */ - result = tracker_string_boolean_to_string_gint ("Thrue"); - g_assert_cmpstr (result, ==, "Thrue"); - g_free (result); - - result = tracker_string_boolean_to_string_gint ("Falsez"); - g_assert_cmpstr (result, ==, "Falsez"); - g_free (result); - - result = tracker_string_boolean_to_string_gint ("Other invalid value"); - g_assert_cmpstr (result, ==, "Other invalid value"); - g_free (result); -} - -static void test_gslist_with_string_data_equal (void) { GSList *list1 = NULL; @@ -397,22 +186,6 @@ test_gslist_with_string_data_equal (void) g_slist_free (list3); } -static void -test_glist_copy_with_string_data (void) -{ - GList *input = NULL; - GList *result = NULL; - - input = g_list_prepend (input, g_strdup ("one")); - input = g_list_prepend (input, g_strdup ("two")); - - result = tracker_glist_copy_with_string_data (input); - g_assert (result != input); - g_assert_cmpint (g_list_length (result), ==, 2); - - /* Further checks... that the contents are actually the same */ -} - int main (int argc, char **argv) { @@ -420,14 +193,6 @@ main (int argc, char **argv) g_test_init (&argc, &argv, NULL); - g_test_add_func ("/libtracker-common/tracker-type-utils/boolean_as_text_to_number", - test_boolean_as_text_to_number); - g_test_add_func ("/libtracker-common/tracker-type-utils/boolean_as_text_to_number_failures", - test_boolean_as_text_to_number_failures); - g_test_add_func ("/libtracker-common/tracker-type-utils/boolean_as_text_to_number_failures/subprocess", - test_boolean_as_text_to_number_failures_subprocess); - g_test_add_func ("/libtracker-common/tracker-type-utils/string_list_as_list", - test_string_list_to_string); g_test_add_func ("/libtracker-common/tracker-type-utils/string_list_as_list", test_string_to_string_list); g_test_add_func ("/libtracker-common/tracker-type-utils/gslist_to_string_list", @@ -442,28 +207,8 @@ main (int argc, char **argv) test_string_in_gslist); g_test_add_func ("/libtracker-common/tracker-type-utils/string_list_to_gslist", test_string_list_to_gslist); - g_test_add_func ("/libtracker-common/tracker-type-utils/string_to_uint", - test_string_to_uint); - g_test_add_func ("/libtracker-common/tracker-type-utils/string_to_uint_failures", - test_string_to_uint_failures); - g_test_add_func ("/libtracker-common/tracker-type-utils/string_to_uint_failures/subprocess/1", - test_string_to_uint_failures_subprocess_1); - g_test_add_func ("/libtracker-common/tracker-type-utils/string_to_uint_failures/subprocess/2", - test_string_to_uint_failures_subprocess_2); - g_test_add_func ("/libtracker-common/tracker-type-utils/guint32_to_string", - test_guint32_to_string); - g_test_add_func ("/libtracker-common/tracker-type-utils/gint32_to_string", - test_gint32_to_string); - g_test_add_func ("/libtracker-common/tracker-type-utils/uint_to_string", - test_uint_to_string); - g_test_add_func ("/libtracker-common/tracker-type-utils/int_to_string", - test_int_to_string); - g_test_add_func ("/libtracker-common/tracker-type-utils/long_to_string", - test_long_to_string); g_test_add_func ("/libtracker-common/tracker-type-utils/gslist_with_string_data_equal", test_gslist_with_string_data_equal); - g_test_add_func ("/libtracker-common/tracker-type-utils/glist_copy_with_string_data", - test_glist_copy_with_string_data); result = g_test_run (); return result; |