1 #undef G_DISABLE_ASSERT
10 test_uint64 (const gchar
*str
,
21 actual
= g_ascii_strtoull (str
, &endptr
, base
);
24 g_assert (actual
== result
);
25 g_assert (strcmp (end
, endptr
) == 0);
26 g_assert (err
== error
);
30 test_int64 (const gchar
*str
,
41 actual
= g_ascii_strtoll (str
, &endptr
, base
);
44 g_assert (actual
== result
);
45 g_assert (strcmp (end
, endptr
) == 0);
46 g_assert (err
== error
);
50 main (int argc
, char *argv
[])
52 test_uint64 ("0", "", 10, 0, 0);
53 test_uint64 ("+0", "", 10, 0, 0);
54 test_uint64 ("-0", "", 10, 0, 0);
55 test_uint64 ("18446744073709551615", "", 10, G_MAXUINT64
, 0);
56 test_uint64 ("18446744073709551616", "", 10, G_MAXUINT64
, ERANGE
);
57 test_uint64 ("20xyz", "xyz", 10, 20, 0);
58 test_uint64 ("-1", "", 10, G_MAXUINT64
, 0);
60 test_int64 ("0", "", 10, 0, 0);
61 test_int64 ("9223372036854775807", "", 10, G_MAXINT64
, 0);
62 test_int64 ("9223372036854775808", "", 10, G_MAXINT64
, ERANGE
);
63 test_int64 ("-9223372036854775808", "", 10, G_MININT64
, 0);
64 test_int64 ("-9223372036854775809", "", 10, G_MININT64
, ERANGE
);