Source
253
253
{"65536", 10, 65536LL},
254
254
{"65537", 10, 65537LL},
255
255
{"2147483647", 10, 2147483647LL},
256
256
{"2147483648", 10, 2147483648LL},
257
257
{"2147483649", 10, 2147483649LL},
258
258
{"4294967295", 10, 4294967295LL},
259
259
{"4294967296", 10, 4294967296LL},
260
260
{"4294967297", 10, 4294967297LL},
261
261
{"9223372036854775807", 10, 9223372036854775807LL},
262
262
263
+
{"-0", 10, 0LL},
263
264
{"-1", 10, -1LL},
264
265
{"-2", 10, -2LL},
265
266
{"-9223372036854775808", 10, LLONG_MIN},
266
267
};
267
268
TEST_OK(kstrtoll, long long, "%lld", test_ll_ok);
268
269
}
269
270
270
271
static void __init test_kstrtoll_fail(void)
271
272
{
272
273
static DEFINE_TEST_FAIL(test_ll_fail) = {
273
274
{"9223372036854775808", 10},
274
275
{"9223372036854775809", 10},
275
276
{"18446744073709551614", 10},
276
277
{"18446744073709551615", 10},
277
278
{"-9223372036854775809", 10},
278
279
{"-18446744073709551614", 10},
279
280
{"-18446744073709551615", 10},
280
-
/* negative zero isn't an integer in Linux */
281
-
{"-0", 0},
282
-
{"-0", 8},
283
-
{"-0", 10},
284
-
{"-0", 16},
285
281
/* sign is first character if any */
286
282
{"-+1", 0},
287
283
{"-+1", 8},
288
284
{"-+1", 10},
289
285
{"-+1", 16},
290
286
};
291
287
TEST_FAIL(kstrtoll, long long, "%lld", test_ll_fail);
292
288
}
293
289
294
290
static void __init test_kstrtou64_ok(void)