+2008-05-05 Sebastian Dröge <slomo@circular-chaos.org>
+
+ * 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 <slomo@circular-chaos.org>
* tools/gst-inspect.c: (n_print), (print_hierarchy),
const char *strings[] = {
"12345678901",
"-12345678901",
+ "1152921504606846976",
+ "-1152921504606846976",
};
gint64 results[] = {
12345678901LL,
-12345678901LL,
+ 1152921504606846976LL,
+ -1152921504606846976LL,
};
int i;
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 };
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);