aboutsummaryrefslogtreecommitdiff
path: root/tests/test-qobject-input-visitor.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test-qobject-input-visitor.c')
-rw-r--r--tests/test-qobject-input-visitor.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/test-qobject-input-visitor.c b/tests/test-qobject-input-visitor.c
index 6eb48fee7b..f965743b6e 100644
--- a/tests/test-qobject-input-visitor.c
+++ b/tests/test-qobject-input-visitor.c
@@ -116,6 +116,34 @@ static void test_visitor_in_int(TestInputVisitorData *data,
g_assert_cmpint(res, ==, value);
}
+static void test_visitor_in_uint(TestInputVisitorData *data,
+ const void *unused)
+{
+ Error *err = NULL;
+ uint64_t res = 0;
+ int value = 42;
+ Visitor *v;
+
+ v = visitor_input_test_init(data, "%d", value);
+
+ visit_type_uint64(v, NULL, &res, &error_abort);
+ g_assert_cmpuint(res, ==, (uint64_t)value);
+
+ /* BUG: value between INT64_MIN and -1 accepted modulo 2^64 */
+
+ v = visitor_input_test_init(data, "%d", -value);
+
+ visit_type_uint64(v, NULL, &res, &error_abort);
+ g_assert_cmpuint(res, ==, (uint64_t)-value);
+
+ /* BUG: value between INT64_MAX+1 and UINT64_MAX rejected */
+
+ v = visitor_input_test_init(data, "18446744073709551574");
+
+ visit_type_uint64(v, NULL, &res, &err);
+ error_free_or_abort(&err);
+}
+
static void test_visitor_in_int_overflow(TestInputVisitorData *data,
const void *unused)
{
@@ -1225,6 +1253,8 @@ int main(int argc, char **argv)
input_visitor_test_add("/visitor/input/int",
NULL, test_visitor_in_int);
+ input_visitor_test_add("/visitor/input/uint",
+ NULL, test_visitor_in_uint);
input_visitor_test_add("/visitor/input/int_overflow",
NULL, test_visitor_in_int_overflow);
input_visitor_test_add("/visitor/input/int_keyval",