Lines Matching refs:parse_range

237 TEST(parse_range) {  in TEST()  argument
241 assert_se(parse_range("111", &lower, &upper) == 0); in TEST()
245 assert_se(parse_range("111-123", &lower, &upper) == 0); in TEST()
249 assert_se(parse_range("123-111", &lower, &upper) == 0); in TEST()
253 assert_se(parse_range("123-123", &lower, &upper) == 0); in TEST()
257 assert_se(parse_range("0", &lower, &upper) == 0); in TEST()
261 assert_se(parse_range("0-15", &lower, &upper) == 0); in TEST()
265 assert_se(parse_range("15-0", &lower, &upper) == 0); in TEST()
269 assert_se(parse_range("128-65535", &lower, &upper) == 0); in TEST()
273 assert_se(parse_range("1024-4294967295", &lower, &upper) == 0); in TEST()
278 assert_se(parse_range(" 111", &lower, &upper) == 0); in TEST()
282 assert_se(parse_range(" 111-123", &lower, &upper) == 0); in TEST()
286 assert_se(parse_range("111- 123", &lower, &upper) == 0); in TEST()
290 assert_se(parse_range("\t111-\t123", &lower, &upper) == 0); in TEST()
294 assert_se(parse_range(" \t 111- \t 123", &lower, &upper) == 0); in TEST()
300 assert_se(parse_range("111garbage", &lower, &upper) == -EINVAL); in TEST()
304 assert_se(parse_range("garbage111", &lower, &upper) == -EINVAL); in TEST()
308 assert_se(parse_range("garbage", &lower, &upper) == -EINVAL); in TEST()
312 assert_se(parse_range("111-123garbage", &lower, &upper) == -EINVAL); in TEST()
316 assert_se(parse_range("111garbage-123", &lower, &upper) == -EINVAL); in TEST()
322 assert_se(parse_range("", &lower, &upper) == -EINVAL); in TEST()
327 assert_se(parse_range("111--123", &lower, &upper) == -ERANGE); in TEST()
331 assert_se(parse_range("-123", &lower, &upper) == -EINVAL); in TEST()
335 assert_se(parse_range("-111-123", &lower, &upper) == -EINVAL); in TEST()
339 assert_se(parse_range("111-123-", &lower, &upper) == -EINVAL); in TEST()
343 assert_se(parse_range("111.4-123", &lower, &upper) == -EINVAL); in TEST()
347 assert_se(parse_range("111-123.4", &lower, &upper) == -EINVAL); in TEST()
351 assert_se(parse_range("111,4-123", &lower, &upper) == -EINVAL); in TEST()
355 assert_se(parse_range("111-123,4", &lower, &upper) == -EINVAL); in TEST()
360 assert_se(parse_range("111-", &lower, &upper) == -EINVAL); in TEST()
364 assert_se(parse_range("111-123-", &lower, &upper) == -EINVAL); in TEST()
368 assert_se(parse_range("111--", &lower, &upper) == -EINVAL); in TEST()
372 assert_se(parse_range("111- ", &lower, &upper) == -EINVAL); in TEST()
377 assert_se(parse_range("111 123", &lower, &upper) == -EINVAL); in TEST()
381 assert_se(parse_range("111\t123", &lower, &upper) == -EINVAL); in TEST()
385 assert_se(parse_range("111 \t 123", &lower, &upper) == -EINVAL); in TEST()
390 assert_se(parse_range("111 ", &lower, &upper) == -EINVAL); in TEST()
394 assert_se(parse_range("111-123 ", &lower, &upper) == -EINVAL); in TEST()
398 assert_se(parse_range("111 -123", &lower, &upper) == -EINVAL); in TEST()
402 assert_se(parse_range("111 -123 ", &lower, &upper) == -EINVAL); in TEST()
406 assert_se(parse_range("111\t-123\t", &lower, &upper) == -EINVAL); in TEST()
410 assert_se(parse_range("111 \t -123 \t ", &lower, &upper) == -EINVAL); in TEST()
415 assert_se(parse_range("0-18446744073709551616", &lower, &upper) == -ERANGE); in TEST()