mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 11:45:25 +00:00
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.
This commit is contained in:
parent
84beb0c1dd
commit
a87948275c
2 changed files with 46 additions and 0 deletions
|
@ -1,3 +1,9 @@
|
|||
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),
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue