From a87948275c0a18446c72d4623d1c7f741181836d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 5 May 2008 15:50:36 +0000 Subject: [PATCH] tests/check/gst/gstvalue.c: Add unit test for deserializing uint64s and check some really large numbers in the int64 ... Original commit message from CVS: * tests/check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite): Add unit test for deserializing uint64s and check some really large numbers in the int64 test. --- ChangeLog | 6 ++++++ tests/check/gst/gstvalue.c | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/ChangeLog b/ChangeLog index 967e30a..201b58b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-05-05 Sebastian Dröge + + * tests/check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite): + Add unit test for deserializing uint64s and check some really large + numbers in the int64 test. + 2008-05-04 Sebastian Dröge * tools/gst-inspect.c: (n_print), (print_hierarchy), diff --git a/tests/check/gst/gstvalue.c b/tests/check/gst/gstvalue.c index 7bfb6c6..cec60bf 100644 --- a/tests/check/gst/gstvalue.c +++ b/tests/check/gst/gstvalue.c @@ -99,10 +99,14 @@ GST_START_TEST (test_deserialize_gint64) const char *strings[] = { "12345678901", "-12345678901", + "1152921504606846976", + "-1152921504606846976", }; gint64 results[] = { 12345678901LL, -12345678901LL, + 1152921504606846976LL, + -1152921504606846976LL, }; int i; @@ -120,6 +124,41 @@ GST_START_TEST (test_deserialize_gint64) GST_END_TEST; +GST_START_TEST (test_deserialize_guint64) +{ + GValue value = { 0 }; + const char *strings[] = { + "0xffffffffffffffff", + "9223372036854775810", + "-9223372036854775810", + "-1", + "1", + "-0", + }; + guint64 results[] = { + 0xffffffffffffffffULL, + 9223372036854775810ULL, + 9223372036854775806ULL, + -1, + 1, + 0, + }; + int i; + + g_value_init (&value, G_TYPE_UINT64); + + for (i = 0; i < G_N_ELEMENTS (strings); ++i) { + fail_unless (gst_value_deserialize (&value, strings[i]), + "could not deserialize %s (%d)", strings[i], i); + fail_unless (g_value_get_uint64 (&value) == results[i], + "resulting value is %" G_GUINT64_FORMAT ", not %" G_GUINT64_FORMAT + ", for string %s (%d)", g_value_get_uint64 (&value), + results[i], strings[i], i); + } +} + +GST_END_TEST; + GST_START_TEST (test_deserialize_gstfraction) { GValue value = { 0 }; @@ -1632,6 +1671,7 @@ gst_value_suite (void) tcase_add_test (tc_chain, test_deserialize_guint); tcase_add_test (tc_chain, test_deserialize_guint_failures); tcase_add_test (tc_chain, test_deserialize_gint64); + tcase_add_test (tc_chain, test_deserialize_guint64); tcase_add_test (tc_chain, test_deserialize_gstfraction); tcase_add_test (tc_chain, test_serialize_flags); tcase_add_test (tc_chain, test_deserialize_flags); -- 2.7.4