Lines Matching refs:str

51     const char *str = "";  in test_parse_uint_empty()  local
54 r = parse_uint(str, &endptr, 0, &i); in test_parse_uint_empty()
58 g_assert_true(endptr == str); in test_parse_uint_empty()
65 const char *str = " \t "; in test_parse_uint_whitespace() local
68 r = parse_uint(str, &endptr, 0, &i); in test_parse_uint_whitespace()
72 g_assert_true(endptr == str); in test_parse_uint_whitespace()
80 const char *str = " \t xxx"; in test_parse_uint_invalid() local
83 r = parse_uint(str, &endptr, 0, &i); in test_parse_uint_invalid()
87 g_assert_true(endptr == str); in test_parse_uint_invalid()
95 const char *str = "123xxx"; in test_parse_uint_trailing() local
98 r = parse_uint(str, &endptr, 0, &i); in test_parse_uint_trailing()
102 g_assert_true(endptr == str + 3); in test_parse_uint_trailing()
109 const char *str = "123"; in test_parse_uint_correct() local
112 r = parse_uint(str, &endptr, 0, &i); in test_parse_uint_correct()
116 g_assert_true(endptr == str + strlen(str)); in test_parse_uint_correct()
123 const char *str = "0123"; in test_parse_uint_octal() local
126 r = parse_uint(str, &endptr, 0, &i); in test_parse_uint_octal()
130 g_assert_true(endptr == str + strlen(str)); in test_parse_uint_octal()
137 const char *str = "0123"; in test_parse_uint_decimal() local
140 r = parse_uint(str, &endptr, 10, &i); in test_parse_uint_decimal()
144 g_assert_true(endptr == str + strlen(str)); in test_parse_uint_decimal()
151 char *str = g_strdup_printf("%llu", (unsigned long long)LLONG_MAX + 1); in test_parse_uint_llong_max() local
154 r = parse_uint(str, &endptr, 0, &i); in test_parse_uint_llong_max()
158 g_assert_true(endptr == str + strlen(str)); in test_parse_uint_llong_max()
160 g_free(str); in test_parse_uint_llong_max()
167 char *str = g_strdup_printf("%llu", ULLONG_MAX); in test_parse_uint_max() local
170 r = parse_uint(str, &endptr, 0, &i); in test_parse_uint_max()
174 g_assert_true(endptr == str + strlen(str)); in test_parse_uint_max()
176 g_free(str); in test_parse_uint_max()
183 const char *str; in test_parse_uint_overflow() local
188 str = "99999999999999999999999999999999999999"; in test_parse_uint_overflow()
189 r = parse_uint(str, &endptr, 0, &i); in test_parse_uint_overflow()
192 g_assert_true(endptr == str + strlen(str)); in test_parse_uint_overflow()
196 str = "0x10000000000000000"; /* 65 bits, 64-bit sign bit clear */ in test_parse_uint_overflow()
197 r = parse_uint(str, &endptr, 0, &i); in test_parse_uint_overflow()
200 g_assert_true(endptr == str + strlen(str)); in test_parse_uint_overflow()
204 str = "0x18000000080000000"; /* 65 bits, 64-bit sign bit set */ in test_parse_uint_overflow()
205 r = parse_uint(str, &endptr, 0, &i); in test_parse_uint_overflow()
208 g_assert_true(endptr == str + strlen(str)); in test_parse_uint_overflow()
215 const char *str; in test_parse_uint_negative() local
220 str = " \t -321"; in test_parse_uint_negative()
221 r = parse_uint(str, &endptr, 0, &i); in test_parse_uint_negative()
224 g_assert_true(endptr == str + strlen(str)); in test_parse_uint_negative()
228 str = "-0xffffffff00000001"; in test_parse_uint_negative()
229 r = parse_uint(str, &endptr, 0, &i); in test_parse_uint_negative()
232 g_assert_true(endptr == str + strlen(str)); in test_parse_uint_negative()
239 const char *str = " -0"; in test_parse_uint_negzero() local
242 r = parse_uint(str, &endptr, 0, &i); in test_parse_uint_negzero()
246 g_assert_true(endptr == str + strlen(str)); in test_parse_uint_negzero()
252 const char *str = "123xxx"; in test_parse_uint_full_trailing() local
255 r = parse_uint_full(str, 0, &i); in test_parse_uint_full_trailing()
264 const char *str = "123"; in test_parse_uint_full_correct() local
267 r = parse_uint_full(str, 0, &i); in test_parse_uint_full_correct()
277 const char *str = "-2junk"; in test_parse_uint_full_erange_junk() local
280 r = parse_uint_full(str, 0, &i); in test_parse_uint_full_erange_junk()
289 const char *str = NULL; in test_parse_uint_full_null() local
292 r = parse_uint_full(str, 0, &i); in test_parse_uint_full_null()
300 const char *str = "12345 foo"; in test_qemu_strtoi_correct() local
306 err = qemu_strtoi(str, &endptr, 0, &res); in test_qemu_strtoi_correct()
310 g_assert_true(endptr == str + 5); in test_qemu_strtoi_correct()
329 const char *str = ""; in test_qemu_strtoi_empty() local
335 err = qemu_strtoi(str, &endptr, 0, &res); in test_qemu_strtoi_empty()
339 g_assert_true(endptr == str); in test_qemu_strtoi_empty()
344 const char *str = " \t "; in test_qemu_strtoi_whitespace() local
350 err = qemu_strtoi(str, &endptr, 0, &res); in test_qemu_strtoi_whitespace()
354 g_assert_true(endptr == str); in test_qemu_strtoi_whitespace()
359 const char *str = " xxxx \t abc"; in test_qemu_strtoi_invalid() local
365 err = qemu_strtoi(str, &endptr, 0, &res); in test_qemu_strtoi_invalid()
369 g_assert_true(endptr == str); in test_qemu_strtoi_invalid()
374 const char *str = "123xxx"; in test_qemu_strtoi_trailing() local
380 err = qemu_strtoi(str, &endptr, 0, &res); in test_qemu_strtoi_trailing()
384 g_assert_true(endptr == str + 3); in test_qemu_strtoi_trailing()
389 const char *str = "0123"; in test_qemu_strtoi_octal() local
395 err = qemu_strtoi(str, &endptr, 8, &res); in test_qemu_strtoi_octal()
399 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoi_octal()
403 err = qemu_strtoi(str, &endptr, 0, &res); in test_qemu_strtoi_octal()
407 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoi_octal()
412 const char *str = "0123"; in test_qemu_strtoi_decimal() local
418 err = qemu_strtoi(str, &endptr, 10, &res); in test_qemu_strtoi_decimal()
422 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoi_decimal()
424 str = "123"; in test_qemu_strtoi_decimal()
427 err = qemu_strtoi(str, &endptr, 0, &res); in test_qemu_strtoi_decimal()
431 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoi_decimal()
436 const char *str = "0123"; in test_qemu_strtoi_hex() local
442 err = qemu_strtoi(str, &endptr, 16, &res); in test_qemu_strtoi_hex()
446 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoi_hex()
448 str = "0x123"; in test_qemu_strtoi_hex()
451 err = qemu_strtoi(str, &endptr, 0, &res); in test_qemu_strtoi_hex()
455 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoi_hex()
457 str = "0x"; in test_qemu_strtoi_hex()
460 err = qemu_strtoi(str, &endptr, 16, &res); in test_qemu_strtoi_hex()
464 g_assert_true(endptr == str + 1); in test_qemu_strtoi_hex()
469 char *str = g_strdup_printf("%d", INT_MAX); in test_qemu_strtoi_max() local
475 err = qemu_strtoi(str, &endptr, 0, &res); in test_qemu_strtoi_max()
479 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoi_max()
480 g_free(str); in test_qemu_strtoi_max()
485 const char *str; in test_qemu_strtoi_overflow() local
490 str = "2147483648"; /* INT_MAX + 1ll */ in test_qemu_strtoi_overflow()
493 err = qemu_strtoi(str, &endptr, 0, &res); in test_qemu_strtoi_overflow()
496 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoi_overflow()
498 str = "0x7fffffffffffffff"; /* LLONG_MAX */ in test_qemu_strtoi_overflow()
501 err = qemu_strtoi(str, &endptr, 0, &res); in test_qemu_strtoi_overflow()
504 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoi_overflow()
506 str = "0x8000000000000000"; /* (uint64_t)LLONG_MIN */ in test_qemu_strtoi_overflow()
509 err = qemu_strtoi(str, &endptr, 0, &res); in test_qemu_strtoi_overflow()
512 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoi_overflow()
514 str = "0x10000000000000000"; /* 65 bits, 32-bit sign bit clear */ in test_qemu_strtoi_overflow()
517 err = qemu_strtoi(str, &endptr, 0, &res); in test_qemu_strtoi_overflow()
520 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoi_overflow()
522 str = "0x18000000080000000"; /* 65 bits, 32-bit sign bit set */ in test_qemu_strtoi_overflow()
525 err = qemu_strtoi(str, &endptr, 0, &res); in test_qemu_strtoi_overflow()
528 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoi_overflow()
533 char *str = g_strdup_printf("%d", INT_MIN); in test_qemu_strtoi_min() local
539 err = qemu_strtoi(str, &endptr, 0, &res); in test_qemu_strtoi_min()
543 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoi_min()
544 g_free(str); in test_qemu_strtoi_min()
549 const char *str; in test_qemu_strtoi_underflow() local
554 str = "-2147483649"; /* INT_MIN - 1ll */ in test_qemu_strtoi_underflow()
557 err = qemu_strtoi(str, &endptr, 0, &res); in test_qemu_strtoi_underflow()
560 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoi_underflow()
562 str = "-0x7fffffffffffffff"; /* -LLONG_MAX */ in test_qemu_strtoi_underflow()
565 err = qemu_strtoi(str, &endptr, 0, &res); in test_qemu_strtoi_underflow()
568 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoi_underflow()
570 str = "-0x8000000000000000"; /* (uint64_t)LLONG_MIN */ in test_qemu_strtoi_underflow()
573 err = qemu_strtoi(str, &endptr, 0, &res); in test_qemu_strtoi_underflow()
576 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoi_underflow()
578 str = "-18446744073709551615"; /* -UINT64_MAX (not 1) */ in test_qemu_strtoi_underflow()
581 err = qemu_strtoi(str, &endptr, 0, &res); in test_qemu_strtoi_underflow()
584 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoi_underflow()
586 str = "-0x10000000000000000"; /* 65 bits, 32-bit sign bit clear */ in test_qemu_strtoi_underflow()
589 err = qemu_strtoi(str, &endptr, 0, &res); in test_qemu_strtoi_underflow()
592 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoi_underflow()
594 str = "-0x18000000080000000"; /* 65 bits, 32-bit sign bit set */ in test_qemu_strtoi_underflow()
597 err = qemu_strtoi(str, &endptr, 0, &res); in test_qemu_strtoi_underflow()
600 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoi_underflow()
605 const char *str; in test_qemu_strtoi_negative() local
610 str = " \t -321"; in test_qemu_strtoi_negative()
613 err = qemu_strtoi(str, &endptr, 0, &res); in test_qemu_strtoi_negative()
616 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoi_negative()
618 str = "-2147483648"; /* INT_MIN */ in test_qemu_strtoi_negative()
621 err = qemu_strtoi(str, &endptr, 0, &res); in test_qemu_strtoi_negative()
624 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoi_negative()
629 const char *str = " -0"; in test_qemu_strtoi_negzero() local
635 err = qemu_strtoi(str, &endptr, 0, &res); in test_qemu_strtoi_negzero()
639 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoi_negzero()
644 const char *str = "123"; in test_qemu_strtoi_full_correct() local
648 err = qemu_strtoi(str, NULL, 0, &res); in test_qemu_strtoi_full_correct()
670 const char *str = ""; in test_qemu_strtoi_full_empty() local
674 err = qemu_strtoi(str, NULL, 0, &res); in test_qemu_strtoi_full_empty()
682 const char *str = " \t -321"; in test_qemu_strtoi_full_negative() local
686 err = qemu_strtoi(str, NULL, 0, &res); in test_qemu_strtoi_full_negative()
694 const char *str = " -0"; in test_qemu_strtoi_full_negzero() local
698 err = qemu_strtoi(str, NULL, 0, &res); in test_qemu_strtoi_full_negzero()
706 const char *str = "123xxx"; in test_qemu_strtoi_full_trailing() local
710 err = qemu_strtoi(str, NULL, 0, &res); in test_qemu_strtoi_full_trailing()
718 char *str = g_strdup_printf("%d", INT_MAX); in test_qemu_strtoi_full_max() local
722 err = qemu_strtoi(str, NULL, 0, &res); in test_qemu_strtoi_full_max()
726 g_free(str); in test_qemu_strtoi_full_max()
732 const char *str = "-9999999999junk"; in test_qemu_strtoi_full_erange_junk() local
736 err = qemu_strtoi(str, NULL, 0, &res); in test_qemu_strtoi_full_erange_junk()
744 const char *str = "12345 foo"; in test_qemu_strtoui_correct() local
750 err = qemu_strtoui(str, &endptr, 0, &res); in test_qemu_strtoui_correct()
754 g_assert_true(endptr == str + 5); in test_qemu_strtoui_correct()
773 const char *str = ""; in test_qemu_strtoui_empty() local
779 err = qemu_strtoui(str, &endptr, 0, &res); in test_qemu_strtoui_empty()
783 g_assert_true(endptr == str); in test_qemu_strtoui_empty()
788 const char *str = " \t "; in test_qemu_strtoui_whitespace() local
794 err = qemu_strtoui(str, &endptr, 0, &res); in test_qemu_strtoui_whitespace()
798 g_assert_true(endptr == str); in test_qemu_strtoui_whitespace()
803 const char *str = " xxxx \t abc"; in test_qemu_strtoui_invalid() local
809 err = qemu_strtoui(str, &endptr, 0, &res); in test_qemu_strtoui_invalid()
813 g_assert_true(endptr == str); in test_qemu_strtoui_invalid()
818 const char *str = "123xxx"; in test_qemu_strtoui_trailing() local
824 err = qemu_strtoui(str, &endptr, 0, &res); in test_qemu_strtoui_trailing()
828 g_assert_true(endptr == str + 3); in test_qemu_strtoui_trailing()
833 const char *str = "0123"; in test_qemu_strtoui_octal() local
839 err = qemu_strtoui(str, &endptr, 8, &res); in test_qemu_strtoui_octal()
843 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoui_octal()
847 err = qemu_strtoui(str, &endptr, 0, &res); in test_qemu_strtoui_octal()
851 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoui_octal()
856 const char *str = "0123"; in test_qemu_strtoui_decimal() local
862 err = qemu_strtoui(str, &endptr, 10, &res); in test_qemu_strtoui_decimal()
866 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoui_decimal()
868 str = "123"; in test_qemu_strtoui_decimal()
871 err = qemu_strtoui(str, &endptr, 0, &res); in test_qemu_strtoui_decimal()
875 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoui_decimal()
880 const char *str = "0123"; in test_qemu_strtoui_hex() local
886 err = qemu_strtoui(str, &endptr, 16, &res); in test_qemu_strtoui_hex()
890 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoui_hex()
892 str = "0x123"; in test_qemu_strtoui_hex()
895 err = qemu_strtoui(str, &endptr, 0, &res); in test_qemu_strtoui_hex()
899 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoui_hex()
901 str = "0x"; in test_qemu_strtoui_hex()
904 err = qemu_strtoui(str, &endptr, 16, &res); in test_qemu_strtoui_hex()
908 g_assert_true(endptr == str + 1); in test_qemu_strtoui_hex()
914 const char *str = "-4294967295"; /* 1 mod 2^32 */ in test_qemu_strtoui_wrap() local
920 err = qemu_strtoui(str, &endptr, 0, &res); in test_qemu_strtoui_wrap()
924 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoui_wrap()
929 char *str = g_strdup_printf("%u", UINT_MAX); in test_qemu_strtoui_max() local
935 err = qemu_strtoui(str, &endptr, 0, &res); in test_qemu_strtoui_max()
939 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoui_max()
940 g_free(str); in test_qemu_strtoui_max()
945 const char *str; in test_qemu_strtoui_overflow() local
950 str = "4294967296"; /* UINT_MAX + 1ll */ in test_qemu_strtoui_overflow()
953 err = qemu_strtoui(str, &endptr, 0, &res); in test_qemu_strtoui_overflow()
956 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoui_overflow()
958 str = "0x7fffffffffffffff"; /* LLONG_MAX */ in test_qemu_strtoui_overflow()
961 err = qemu_strtoui(str, &endptr, 0, &res); in test_qemu_strtoui_overflow()
964 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoui_overflow()
966 str = "0x8000000000000000"; /* (uint64_t)LLONG_MIN */ in test_qemu_strtoui_overflow()
969 err = qemu_strtoui(str, &endptr, 0, &res); in test_qemu_strtoui_overflow()
972 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoui_overflow()
974 str = "0xffffffff00000001"; /* ULLONG_MAX - UINT_MAX + 1 (not 1) */ in test_qemu_strtoui_overflow()
977 err = qemu_strtoui(str, &endptr, 0, &res); in test_qemu_strtoui_overflow()
980 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoui_overflow()
982 str = "0xfffffffffffffffe"; /* ULLONG_MAX - 1 (not UINT_MAX - 1) */ in test_qemu_strtoui_overflow()
985 err = qemu_strtoui(str, &endptr, 0, &res); in test_qemu_strtoui_overflow()
988 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoui_overflow()
990 str = "0x10000000000000000"; /* 65 bits, 32-bit sign bit clear */ in test_qemu_strtoui_overflow()
993 err = qemu_strtoui(str, &endptr, 0, &res); in test_qemu_strtoui_overflow()
996 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoui_overflow()
998 str = "0x18000000080000000"; /* 65 bits, 32-bit sign bit set */ in test_qemu_strtoui_overflow()
1001 err = qemu_strtoui(str, &endptr, 0, &res); in test_qemu_strtoui_overflow()
1004 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoui_overflow()
1009 const char *str; in test_qemu_strtoui_underflow() local
1014 str = "-4294967296"; /* -(long long)UINT_MAX - 1ll */ in test_qemu_strtoui_underflow()
1017 err = qemu_strtoui(str, &endptr, 0, &res); in test_qemu_strtoui_underflow()
1020 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoui_underflow()
1022 str = "-18446744073709551615"; /* -UINT64_MAX (not -(-1)) */ in test_qemu_strtoui_underflow()
1025 err = qemu_strtoui(str, &endptr, 0, &res); in test_qemu_strtoui_underflow()
1028 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoui_underflow()
1030 str = "-0xffffffff00000002"; in test_qemu_strtoui_underflow()
1033 err = qemu_strtoui(str, &endptr, 0, &res); in test_qemu_strtoui_underflow()
1036 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoui_underflow()
1038 str = "-0x10000000000000000"; /* 65 bits, 32-bit sign bit clear */ in test_qemu_strtoui_underflow()
1041 err = qemu_strtoui(str, &endptr, 0, &res); in test_qemu_strtoui_underflow()
1044 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoui_underflow()
1046 str = "-0x18000000080000000"; /* 65 bits, 32-bit sign bit set */ in test_qemu_strtoui_underflow()
1049 err = qemu_strtoui(str, &endptr, 0, &res); in test_qemu_strtoui_underflow()
1052 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoui_underflow()
1057 const char *str = " \t -321"; in test_qemu_strtoui_negative() local
1063 err = qemu_strtoui(str, &endptr, 0, &res); in test_qemu_strtoui_negative()
1067 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoui_negative()
1072 const char *str = " -0"; in test_qemu_strtoui_negzero() local
1078 err = qemu_strtoui(str, &endptr, 0, &res); in test_qemu_strtoui_negzero()
1082 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoui_negzero()
1087 const char *str = "123"; in test_qemu_strtoui_full_correct() local
1091 err = qemu_strtoui(str, NULL, 0, &res); in test_qemu_strtoui_full_correct()
1110 const char *str = ""; in test_qemu_strtoui_full_empty() local
1114 err = qemu_strtoui(str, NULL, 0, &res); in test_qemu_strtoui_full_empty()
1122 const char *str = " \t -321"; in test_qemu_strtoui_full_negative() local
1126 err = qemu_strtoui(str, NULL, 0, &res); in test_qemu_strtoui_full_negative()
1133 const char *str = " -0"; in test_qemu_strtoui_full_negzero() local
1137 err = qemu_strtoui(str, NULL, 0, &res); in test_qemu_strtoui_full_negzero()
1144 const char *str = "123xxx"; in test_qemu_strtoui_full_trailing() local
1148 err = qemu_strtoui(str, NULL, 0, &res); in test_qemu_strtoui_full_trailing()
1156 char *str = g_strdup_printf("%u", UINT_MAX); in test_qemu_strtoui_full_max() local
1160 err = qemu_strtoui(str, NULL, 0, &res); in test_qemu_strtoui_full_max()
1164 g_free(str); in test_qemu_strtoui_full_max()
1170 const char *str = "-9999999999junk"; in test_qemu_strtoui_full_erange_junk() local
1174 err = qemu_strtoui(str, NULL, 0, &res); in test_qemu_strtoui_full_erange_junk()
1182 const char *str = "12345 foo"; in test_qemu_strtol_correct() local
1188 err = qemu_strtol(str, &endptr, 0, &res); in test_qemu_strtol_correct()
1192 g_assert_true(endptr == str + 5); in test_qemu_strtol_correct()
1211 const char *str = ""; in test_qemu_strtol_empty() local
1217 err = qemu_strtol(str, &endptr, 0, &res); in test_qemu_strtol_empty()
1221 g_assert_true(endptr == str); in test_qemu_strtol_empty()
1226 const char *str = " \t "; in test_qemu_strtol_whitespace() local
1232 err = qemu_strtol(str, &endptr, 0, &res); in test_qemu_strtol_whitespace()
1236 g_assert_true(endptr == str); in test_qemu_strtol_whitespace()
1241 const char *str = " xxxx \t abc"; in test_qemu_strtol_invalid() local
1247 err = qemu_strtol(str, &endptr, 0, &res); in test_qemu_strtol_invalid()
1251 g_assert_true(endptr == str); in test_qemu_strtol_invalid()
1256 const char *str = "123xxx"; in test_qemu_strtol_trailing() local
1262 err = qemu_strtol(str, &endptr, 0, &res); in test_qemu_strtol_trailing()
1266 g_assert_true(endptr == str + 3); in test_qemu_strtol_trailing()
1271 const char *str = "0123"; in test_qemu_strtol_octal() local
1277 err = qemu_strtol(str, &endptr, 8, &res); in test_qemu_strtol_octal()
1281 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtol_octal()
1285 err = qemu_strtol(str, &endptr, 0, &res); in test_qemu_strtol_octal()
1289 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtol_octal()
1294 const char *str = "0123"; in test_qemu_strtol_decimal() local
1300 err = qemu_strtol(str, &endptr, 10, &res); in test_qemu_strtol_decimal()
1304 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtol_decimal()
1306 str = "123"; in test_qemu_strtol_decimal()
1309 err = qemu_strtol(str, &endptr, 0, &res); in test_qemu_strtol_decimal()
1313 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtol_decimal()
1318 const char *str = "0123"; in test_qemu_strtol_hex() local
1324 err = qemu_strtol(str, &endptr, 16, &res); in test_qemu_strtol_hex()
1328 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtol_hex()
1330 str = "0x123"; in test_qemu_strtol_hex()
1333 err = qemu_strtol(str, &endptr, 0, &res); in test_qemu_strtol_hex()
1337 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtol_hex()
1339 str = "0x"; in test_qemu_strtol_hex()
1342 err = qemu_strtol(str, &endptr, 16, &res); in test_qemu_strtol_hex()
1346 g_assert_true(endptr == str + 1); in test_qemu_strtol_hex()
1351 char *str = g_strdup_printf("%ld", LONG_MAX); in test_qemu_strtol_max() local
1357 err = qemu_strtol(str, &endptr, 0, &res); in test_qemu_strtol_max()
1361 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtol_max()
1362 g_free(str); in test_qemu_strtol_max()
1367 const char *str; in test_qemu_strtol_overflow() local
1373 str = LONG_MAX == INT_MAX ? "2147483648" : "9223372036854775808"; in test_qemu_strtol_overflow()
1376 err = qemu_strtol(str, &endptr, 0, &res); in test_qemu_strtol_overflow()
1379 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtol_overflow()
1382 str = "0xffffffff00000001"; /* ULLONG_MAX - UINT_MAX + 1 (not 1) */ in test_qemu_strtol_overflow()
1385 err = qemu_strtol(str, &endptr, 0, &res); in test_qemu_strtol_overflow()
1388 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtol_overflow()
1391 str = "0x10000000000000000"; /* 65 bits, either sign bit position clear */ in test_qemu_strtol_overflow()
1394 err = qemu_strtol(str, &endptr, 0, &res); in test_qemu_strtol_overflow()
1397 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtol_overflow()
1399 str = "0x18000000080000000"; /* 65 bits, either sign bit position set */ in test_qemu_strtol_overflow()
1402 err = qemu_strtol(str, &endptr, 0, &res); in test_qemu_strtol_overflow()
1405 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtol_overflow()
1410 char *str = g_strdup_printf("%ld", LONG_MIN); in test_qemu_strtol_min() local
1416 err = qemu_strtol(str, &endptr, 0, &res); in test_qemu_strtol_min()
1420 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtol_min()
1421 g_free(str); in test_qemu_strtol_min()
1426 const char *str; in test_qemu_strtol_underflow() local
1432 str = LONG_MIN == INT_MIN ? "-2147483649" : "-9223372036854775809"; in test_qemu_strtol_underflow()
1435 err = qemu_strtol(str, &endptr, 0, &res); in test_qemu_strtol_underflow()
1438 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtol_underflow()
1441 str = "-18446744073709551615"; /* -UINT64_MAX (not 1) */ in test_qemu_strtol_underflow()
1444 err = qemu_strtol(str, &endptr, 0, &res); in test_qemu_strtol_underflow()
1447 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtol_underflow()
1450 str = "-0x10000000000000000"; /* 65 bits, either sign bit position clear */ in test_qemu_strtol_underflow()
1453 err = qemu_strtol(str, &endptr, 0, &res); in test_qemu_strtol_underflow()
1456 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtol_underflow()
1458 str = "-0x18000000080000000"; /* 65 bits, either sign bit position set */ in test_qemu_strtol_underflow()
1461 err = qemu_strtol(str, &endptr, 0, &res); in test_qemu_strtol_underflow()
1464 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtol_underflow()
1469 const char *str = " \t -321"; in test_qemu_strtol_negative() local
1475 err = qemu_strtol(str, &endptr, 0, &res); in test_qemu_strtol_negative()
1479 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtol_negative()
1484 const char *str = " -0"; in test_qemu_strtol_negzero() local
1490 err = qemu_strtol(str, &endptr, 0, &res); in test_qemu_strtol_negzero()
1494 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtol_negzero()
1499 const char *str = "123"; in test_qemu_strtol_full_correct() local
1503 err = qemu_strtol(str, NULL, 0, &res); in test_qemu_strtol_full_correct()
1525 const char *str = ""; in test_qemu_strtol_full_empty() local
1529 err = qemu_strtol(str, NULL, 0, &res); in test_qemu_strtol_full_empty()
1537 const char *str = " \t -321"; in test_qemu_strtol_full_negative() local
1541 err = qemu_strtol(str, NULL, 0, &res); in test_qemu_strtol_full_negative()
1549 const char *str = " -0"; in test_qemu_strtol_full_negzero() local
1553 err = qemu_strtol(str, NULL, 0, &res); in test_qemu_strtol_full_negzero()
1561 const char *str = "123xxx"; in test_qemu_strtol_full_trailing() local
1565 err = qemu_strtol(str, NULL, 0, &res); in test_qemu_strtol_full_trailing()
1573 char *str = g_strdup_printf("%ld", LONG_MAX); in test_qemu_strtol_full_max() local
1577 err = qemu_strtol(str, NULL, 0, &res); in test_qemu_strtol_full_max()
1581 g_free(str); in test_qemu_strtol_full_max()
1587 const char *str = "-99999999999999999999junk"; in test_qemu_strtol_full_erange_junk() local
1591 err = qemu_strtol(str, NULL, 0, &res); in test_qemu_strtol_full_erange_junk()
1599 const char *str = "12345 foo"; in test_qemu_strtoul_correct() local
1605 err = qemu_strtoul(str, &endptr, 0, &res); in test_qemu_strtoul_correct()
1609 g_assert_true(endptr == str + 5); in test_qemu_strtoul_correct()
1628 const char *str = ""; in test_qemu_strtoul_empty() local
1634 err = qemu_strtoul(str, &endptr, 0, &res); in test_qemu_strtoul_empty()
1638 g_assert_true(endptr == str); in test_qemu_strtoul_empty()
1643 const char *str = " \t "; in test_qemu_strtoul_whitespace() local
1649 err = qemu_strtoul(str, &endptr, 0, &res); in test_qemu_strtoul_whitespace()
1653 g_assert_true(endptr == str); in test_qemu_strtoul_whitespace()
1658 const char *str = " xxxx \t abc"; in test_qemu_strtoul_invalid() local
1664 err = qemu_strtoul(str, &endptr, 0, &res); in test_qemu_strtoul_invalid()
1668 g_assert_true(endptr == str); in test_qemu_strtoul_invalid()
1673 const char *str = "123xxx"; in test_qemu_strtoul_trailing() local
1679 err = qemu_strtoul(str, &endptr, 0, &res); in test_qemu_strtoul_trailing()
1683 g_assert_true(endptr == str + 3); in test_qemu_strtoul_trailing()
1688 const char *str = "0123"; in test_qemu_strtoul_octal() local
1694 err = qemu_strtoul(str, &endptr, 8, &res); in test_qemu_strtoul_octal()
1698 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoul_octal()
1702 err = qemu_strtoul(str, &endptr, 0, &res); in test_qemu_strtoul_octal()
1706 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoul_octal()
1711 const char *str = "0123"; in test_qemu_strtoul_decimal() local
1717 err = qemu_strtoul(str, &endptr, 10, &res); in test_qemu_strtoul_decimal()
1721 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoul_decimal()
1723 str = "123"; in test_qemu_strtoul_decimal()
1726 err = qemu_strtoul(str, &endptr, 0, &res); in test_qemu_strtoul_decimal()
1730 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoul_decimal()
1735 const char *str = "0123"; in test_qemu_strtoul_hex() local
1741 err = qemu_strtoul(str, &endptr, 16, &res); in test_qemu_strtoul_hex()
1745 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoul_hex()
1747 str = "0x123"; in test_qemu_strtoul_hex()
1750 err = qemu_strtoul(str, &endptr, 0, &res); in test_qemu_strtoul_hex()
1754 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoul_hex()
1756 str = "0x"; in test_qemu_strtoul_hex()
1759 err = qemu_strtoul(str, &endptr, 16, &res); in test_qemu_strtoul_hex()
1763 g_assert_true(endptr == str + 1); in test_qemu_strtoul_hex()
1768 const char *str; in test_qemu_strtoul_wrap() local
1775 str = LONG_MAX == INT_MAX ? "-4294967295" : "-18446744073709551615"; in test_qemu_strtoul_wrap()
1776 err = qemu_strtoul(str, &endptr, 0, &res); in test_qemu_strtoul_wrap()
1780 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoul_wrap()
1785 char *str = g_strdup_printf("%lu", ULONG_MAX); in test_qemu_strtoul_max() local
1791 err = qemu_strtoul(str, &endptr, 0, &res); in test_qemu_strtoul_max()
1795 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoul_max()
1796 g_free(str); in test_qemu_strtoul_max()
1801 const char *str; in test_qemu_strtoul_overflow() local
1807 str = ULONG_MAX == UINT_MAX ? "4294967296" : "18446744073709551616"; in test_qemu_strtoul_overflow()
1810 err = qemu_strtoul(str, &endptr, 0, &res); in test_qemu_strtoul_overflow()
1813 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoul_overflow()
1816 str = "0xffffffff00000001"; /* UINT64_MAX - UINT_MAX + 1 (not 1) */ in test_qemu_strtoul_overflow()
1819 err = qemu_strtoul(str, &endptr, 0, &res); in test_qemu_strtoul_overflow()
1822 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoul_overflow()
1825 str = "0x10000000000000000"; /* 65 bits, either sign bit position clear */ in test_qemu_strtoul_overflow()
1828 err = qemu_strtoul(str, &endptr, 0, &res); in test_qemu_strtoul_overflow()
1831 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoul_overflow()
1833 str = "0x18000000080000000"; /* 65 bits, either sign bit position set */ in test_qemu_strtoul_overflow()
1836 err = qemu_strtoul(str, &endptr, 0, &res); in test_qemu_strtoul_overflow()
1839 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoul_overflow()
1844 const char *str; in test_qemu_strtoul_underflow() local
1850 str = ULONG_MAX == UINT_MAX ? "-4294967296" : "-18446744073709551616"; in test_qemu_strtoul_underflow()
1853 err = qemu_strtoul(str, &endptr, 0, &res); in test_qemu_strtoul_underflow()
1856 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoul_underflow()
1859 str = "-0xffffffff00000002"; in test_qemu_strtoul_underflow()
1862 err = qemu_strtoul(str, &endptr, 0, &res); in test_qemu_strtoul_underflow()
1865 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoul_underflow()
1868 str = "-0x10000000000000000"; /* 65 bits, either sign bit position clear */ in test_qemu_strtoul_underflow()
1871 err = qemu_strtoul(str, &endptr, 0, &res); in test_qemu_strtoul_underflow()
1874 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoul_underflow()
1876 str = "-0x18000000080000000"; /* 65 bits, either sign bit position set */ in test_qemu_strtoul_underflow()
1879 err = qemu_strtoul(str, &endptr, 0, &res); in test_qemu_strtoul_underflow()
1882 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoul_underflow()
1887 const char *str = " \t -321"; in test_qemu_strtoul_negative() local
1893 err = qemu_strtoul(str, &endptr, 0, &res); in test_qemu_strtoul_negative()
1897 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoul_negative()
1902 const char *str = " -0"; in test_qemu_strtoul_negzero() local
1908 err = qemu_strtoul(str, &endptr, 0, &res); in test_qemu_strtoul_negzero()
1912 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoul_negzero()
1917 const char *str = "123"; in test_qemu_strtoul_full_correct() local
1921 err = qemu_strtoul(str, NULL, 0, &res); in test_qemu_strtoul_full_correct()
1940 const char *str = ""; in test_qemu_strtoul_full_empty() local
1944 err = qemu_strtoul(str, NULL, 0, &res); in test_qemu_strtoul_full_empty()
1952 const char *str = " \t -321"; in test_qemu_strtoul_full_negative() local
1956 err = qemu_strtoul(str, NULL, 0, &res); in test_qemu_strtoul_full_negative()
1963 const char *str = " -0"; in test_qemu_strtoul_full_negzero() local
1967 err = qemu_strtoul(str, NULL, 0, &res); in test_qemu_strtoul_full_negzero()
1974 const char *str = "123xxx"; in test_qemu_strtoul_full_trailing() local
1978 err = qemu_strtoul(str, NULL, 0, &res); in test_qemu_strtoul_full_trailing()
1986 char *str = g_strdup_printf("%lu", ULONG_MAX); in test_qemu_strtoul_full_max() local
1990 err = qemu_strtoul(str, NULL, 0, &res); in test_qemu_strtoul_full_max()
1994 g_free(str); in test_qemu_strtoul_full_max()
2000 const char *str = "-99999999999999999999junk"; in test_qemu_strtoul_full_erange_junk() local
2004 err = qemu_strtoul(str, NULL, 0, &res); in test_qemu_strtoul_full_erange_junk()
2012 const char *str = "12345 foo"; in test_qemu_strtoi64_correct() local
2018 err = qemu_strtoi64(str, &endptr, 0, &res); in test_qemu_strtoi64_correct()
2022 g_assert_true(endptr == str + 5); in test_qemu_strtoi64_correct()
2041 const char *str = ""; in test_qemu_strtoi64_empty() local
2047 err = qemu_strtoi64(str, &endptr, 0, &res); in test_qemu_strtoi64_empty()
2051 g_assert_true(endptr == str); in test_qemu_strtoi64_empty()
2056 const char *str = " \t "; in test_qemu_strtoi64_whitespace() local
2062 err = qemu_strtoi64(str, &endptr, 0, &res); in test_qemu_strtoi64_whitespace()
2066 g_assert_true(endptr == str); in test_qemu_strtoi64_whitespace()
2071 const char *str = " xxxx \t abc"; in test_qemu_strtoi64_invalid() local
2077 err = qemu_strtoi64(str, &endptr, 0, &res); in test_qemu_strtoi64_invalid()
2081 g_assert_true(endptr == str); in test_qemu_strtoi64_invalid()
2086 const char *str = "123xxx"; in test_qemu_strtoi64_trailing() local
2092 err = qemu_strtoi64(str, &endptr, 0, &res); in test_qemu_strtoi64_trailing()
2096 g_assert_true(endptr == str + 3); in test_qemu_strtoi64_trailing()
2101 const char *str = "0123"; in test_qemu_strtoi64_octal() local
2107 err = qemu_strtoi64(str, &endptr, 8, &res); in test_qemu_strtoi64_octal()
2111 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoi64_octal()
2115 err = qemu_strtoi64(str, &endptr, 0, &res); in test_qemu_strtoi64_octal()
2119 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoi64_octal()
2124 const char *str = "0123"; in test_qemu_strtoi64_decimal() local
2130 err = qemu_strtoi64(str, &endptr, 10, &res); in test_qemu_strtoi64_decimal()
2134 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoi64_decimal()
2136 str = "123"; in test_qemu_strtoi64_decimal()
2139 err = qemu_strtoi64(str, &endptr, 0, &res); in test_qemu_strtoi64_decimal()
2143 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoi64_decimal()
2148 const char *str = "0123"; in test_qemu_strtoi64_hex() local
2154 err = qemu_strtoi64(str, &endptr, 16, &res); in test_qemu_strtoi64_hex()
2158 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoi64_hex()
2160 str = "0x123"; in test_qemu_strtoi64_hex()
2163 err = qemu_strtoi64(str, &endptr, 0, &res); in test_qemu_strtoi64_hex()
2167 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoi64_hex()
2169 str = "0x"; in test_qemu_strtoi64_hex()
2172 err = qemu_strtoi64(str, &endptr, 16, &res); in test_qemu_strtoi64_hex()
2176 g_assert_true(endptr == str + 1); in test_qemu_strtoi64_hex()
2181 char *str = g_strdup_printf("%lld", LLONG_MAX); in test_qemu_strtoi64_max() local
2187 err = qemu_strtoi64(str, &endptr, 0, &res); in test_qemu_strtoi64_max()
2191 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoi64_max()
2192 g_free(str); in test_qemu_strtoi64_max()
2197 const char *str; in test_qemu_strtoi64_overflow() local
2202 str = "9223372036854775808"; /* 1 more than INT64_MAX */ in test_qemu_strtoi64_overflow()
2205 err = qemu_strtoi64(str, &endptr, 0, &res); in test_qemu_strtoi64_overflow()
2208 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoi64_overflow()
2210 str = "0x10000000000000000"; /* 65 bits, 64-bit sign bit clear */ in test_qemu_strtoi64_overflow()
2213 err = qemu_strtoi64(str, &endptr, 0, &res); in test_qemu_strtoi64_overflow()
2216 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoi64_overflow()
2218 str = "0x18000000080000000"; /* 65 bits, 64-bit sign bit set */ in test_qemu_strtoi64_overflow()
2221 err = qemu_strtoi64(str, &endptr, 0, &res); in test_qemu_strtoi64_overflow()
2224 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoi64_overflow()
2229 char *str = g_strdup_printf("%lld", LLONG_MIN); in test_qemu_strtoi64_min() local
2235 err = qemu_strtoi64(str, &endptr, 0, &res); in test_qemu_strtoi64_min()
2239 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoi64_min()
2240 g_free(str); in test_qemu_strtoi64_min()
2245 const char *str; in test_qemu_strtoi64_underflow() local
2250 str = "-9223372036854775809"; /* 1 less than INT64_MIN */ in test_qemu_strtoi64_underflow()
2253 err = qemu_strtoi64(str, &endptr, 0, &res); in test_qemu_strtoi64_underflow()
2256 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoi64_underflow()
2258 str = "-0x10000000000000000"; /* 65 bits, 64-bit sign bit clear */ in test_qemu_strtoi64_underflow()
2261 err = qemu_strtoi64(str, &endptr, 0, &res); in test_qemu_strtoi64_underflow()
2264 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoi64_underflow()
2266 str = "-0x18000000080000000"; /* 65 bits, 64-bit sign bit set */ in test_qemu_strtoi64_underflow()
2269 err = qemu_strtoi64(str, &endptr, 0, &res); in test_qemu_strtoi64_underflow()
2272 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoi64_underflow()
2277 const char *str = " \t -321"; in test_qemu_strtoi64_negative() local
2283 err = qemu_strtoi64(str, &endptr, 0, &res); in test_qemu_strtoi64_negative()
2287 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoi64_negative()
2292 const char *str = " -0"; in test_qemu_strtoi64_negzero() local
2298 err = qemu_strtoi64(str, &endptr, 0, &res); in test_qemu_strtoi64_negzero()
2302 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtoi64_negzero()
2307 const char *str = "123"; in test_qemu_strtoi64_full_correct() local
2311 err = qemu_strtoi64(str, NULL, 0, &res); in test_qemu_strtoi64_full_correct()
2330 const char *str = ""; in test_qemu_strtoi64_full_empty() local
2334 err = qemu_strtoi64(str, NULL, 0, &res); in test_qemu_strtoi64_full_empty()
2342 const char *str = " \t -321"; in test_qemu_strtoi64_full_negative() local
2346 err = qemu_strtoi64(str, NULL, 0, &res); in test_qemu_strtoi64_full_negative()
2354 const char *str = " -0"; in test_qemu_strtoi64_full_negzero() local
2358 err = qemu_strtoi64(str, NULL, 0, &res); in test_qemu_strtoi64_full_negzero()
2366 const char *str = "123xxx"; in test_qemu_strtoi64_full_trailing() local
2370 err = qemu_strtoi64(str, NULL, 0, &res); in test_qemu_strtoi64_full_trailing()
2379 char *str = g_strdup_printf("%lld", LLONG_MAX); in test_qemu_strtoi64_full_max() local
2383 err = qemu_strtoi64(str, NULL, 0, &res); in test_qemu_strtoi64_full_max()
2387 g_free(str); in test_qemu_strtoi64_full_max()
2393 const char *str = "-99999999999999999999junk"; in test_qemu_strtoi64_full_erange_junk() local
2397 err = qemu_strtoi64(str, NULL, 0, &res); in test_qemu_strtoi64_full_erange_junk()
2405 const char *str = "12345 foo"; in test_qemu_strtou64_correct() local
2411 err = qemu_strtou64(str, &endptr, 0, &res); in test_qemu_strtou64_correct()
2415 g_assert_true(endptr == str + 5); in test_qemu_strtou64_correct()
2434 const char *str = ""; in test_qemu_strtou64_empty() local
2440 err = qemu_strtou64(str, &endptr, 0, &res); in test_qemu_strtou64_empty()
2444 g_assert_true(endptr == str); in test_qemu_strtou64_empty()
2449 const char *str = " \t "; in test_qemu_strtou64_whitespace() local
2455 err = qemu_strtou64(str, &endptr, 0, &res); in test_qemu_strtou64_whitespace()
2459 g_assert_true(endptr == str); in test_qemu_strtou64_whitespace()
2464 const char *str = " xxxx \t abc"; in test_qemu_strtou64_invalid() local
2470 err = qemu_strtou64(str, &endptr, 0, &res); in test_qemu_strtou64_invalid()
2474 g_assert_true(endptr == str); in test_qemu_strtou64_invalid()
2479 const char *str = "123xxx"; in test_qemu_strtou64_trailing() local
2485 err = qemu_strtou64(str, &endptr, 0, &res); in test_qemu_strtou64_trailing()
2489 g_assert_true(endptr == str + 3); in test_qemu_strtou64_trailing()
2494 const char *str = "0123"; in test_qemu_strtou64_octal() local
2500 err = qemu_strtou64(str, &endptr, 8, &res); in test_qemu_strtou64_octal()
2504 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtou64_octal()
2508 err = qemu_strtou64(str, &endptr, 0, &res); in test_qemu_strtou64_octal()
2512 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtou64_octal()
2517 const char *str = "0123"; in test_qemu_strtou64_decimal() local
2523 err = qemu_strtou64(str, &endptr, 10, &res); in test_qemu_strtou64_decimal()
2527 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtou64_decimal()
2529 str = "123"; in test_qemu_strtou64_decimal()
2532 err = qemu_strtou64(str, &endptr, 0, &res); in test_qemu_strtou64_decimal()
2536 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtou64_decimal()
2541 const char *str = "0123"; in test_qemu_strtou64_hex() local
2547 err = qemu_strtou64(str, &endptr, 16, &res); in test_qemu_strtou64_hex()
2551 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtou64_hex()
2553 str = "0x123"; in test_qemu_strtou64_hex()
2556 err = qemu_strtou64(str, &endptr, 0, &res); in test_qemu_strtou64_hex()
2560 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtou64_hex()
2562 str = "0x"; in test_qemu_strtou64_hex()
2565 err = qemu_strtou64(str, &endptr, 16, &res); in test_qemu_strtou64_hex()
2569 g_assert_true(endptr == str + 1); in test_qemu_strtou64_hex()
2574 const char *str = "-18446744073709551615"; /* 1 mod 2^64 */ in test_qemu_strtou64_wrap() local
2580 err = qemu_strtou64(str, &endptr, 0, &res); in test_qemu_strtou64_wrap()
2584 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtou64_wrap()
2589 char *str = g_strdup_printf("%llu", ULLONG_MAX); in test_qemu_strtou64_max() local
2595 err = qemu_strtou64(str, &endptr, 0, &res); in test_qemu_strtou64_max()
2599 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtou64_max()
2600 g_free(str); in test_qemu_strtou64_max()
2605 const char *str; in test_qemu_strtou64_overflow() local
2610 str = "18446744073709551616"; /* 1 more than UINT64_MAX */ in test_qemu_strtou64_overflow()
2613 err = qemu_strtou64(str, &endptr, 0, &res); in test_qemu_strtou64_overflow()
2616 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtou64_overflow()
2618 str = "0x10000000000000000"; /* 65 bits, 64-bit sign bit clear */ in test_qemu_strtou64_overflow()
2621 err = qemu_strtou64(str, &endptr, 0, &res); in test_qemu_strtou64_overflow()
2624 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtou64_overflow()
2626 str = "0x18000000080000000"; /* 65 bits, 64-bit sign bit set */ in test_qemu_strtou64_overflow()
2629 err = qemu_strtou64(str, &endptr, 0, &res); in test_qemu_strtou64_overflow()
2632 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtou64_overflow()
2637 const char *str; in test_qemu_strtou64_underflow() local
2642 str = "-99999999999999999999999999999999999999999999"; in test_qemu_strtou64_underflow()
2645 err = qemu_strtou64(str, &endptr, 0, &res); in test_qemu_strtou64_underflow()
2648 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtou64_underflow()
2650 str = "-0x10000000000000000"; /* 65 bits, 64-bit sign bit clear */ in test_qemu_strtou64_underflow()
2653 err = qemu_strtou64(str, &endptr, 0, &res); in test_qemu_strtou64_underflow()
2656 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtou64_underflow()
2658 str = "-0x18000000080000000"; /* 65 bits, 64-bit sign bit set */ in test_qemu_strtou64_underflow()
2661 err = qemu_strtou64(str, &endptr, 0, &res); in test_qemu_strtou64_underflow()
2664 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtou64_underflow()
2669 const char *str = " \t -321"; in test_qemu_strtou64_negative() local
2675 err = qemu_strtou64(str, &endptr, 0, &res); in test_qemu_strtou64_negative()
2679 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtou64_negative()
2684 const char *str = " -0"; in test_qemu_strtou64_negzero() local
2690 err = qemu_strtou64(str, &endptr, 0, &res); in test_qemu_strtou64_negzero()
2694 g_assert_true(endptr == str + strlen(str)); in test_qemu_strtou64_negzero()
2699 const char *str = "18446744073709551614"; in test_qemu_strtou64_full_correct() local
2703 err = qemu_strtou64(str, NULL, 0, &res); in test_qemu_strtou64_full_correct()
2722 const char *str = ""; in test_qemu_strtou64_full_empty() local
2726 err = qemu_strtou64(str, NULL, 0, &res); in test_qemu_strtou64_full_empty()
2734 const char *str = " \t -321"; in test_qemu_strtou64_full_negative() local
2738 err = qemu_strtou64(str, NULL, 0, &res); in test_qemu_strtou64_full_negative()
2746 const char *str = " -0"; in test_qemu_strtou64_full_negzero() local
2750 err = qemu_strtou64(str, NULL, 0, &res); in test_qemu_strtou64_full_negzero()
2758 const char *str = "18446744073709551614xxxxxx"; in test_qemu_strtou64_full_trailing() local
2762 err = qemu_strtou64(str, NULL, 0, &res); in test_qemu_strtou64_full_trailing()
2770 char *str = g_strdup_printf("%lld", ULLONG_MAX); in test_qemu_strtou64_full_max() local
2774 err = qemu_strtou64(str, NULL, 0, &res); in test_qemu_strtou64_full_max()
2778 g_free(str); in test_qemu_strtou64_full_max()
2784 const char *str = "-99999999999999999999junk"; in test_qemu_strtou64_full_erange_junk() local
2788 err = qemu_strtou64(str, NULL, 0, &res); in test_qemu_strtou64_full_erange_junk()
2796 const char *str; in test_qemu_strtod_simple() local
2802 str = "1"; in test_qemu_strtod_simple()
2805 err = qemu_strtod(str, &endptr, &res); in test_qemu_strtod_simple()
2808 g_assert_true(endptr == str + 1); in test_qemu_strtod_simple()
2811 str = " -0.0"; in test_qemu_strtod_simple()
2814 err = qemu_strtod(str, &endptr, &res); in test_qemu_strtod_simple()
2818 g_assert_true(endptr == str + 5); in test_qemu_strtod_simple()
2821 str = "+.5"; in test_qemu_strtod_simple()
2824 err = qemu_strtod(str, &endptr, &res); in test_qemu_strtod_simple()
2827 g_assert_true(endptr == str + 3); in test_qemu_strtod_simple()
2830 str = "1.e+1"; in test_qemu_strtod_simple()
2833 err = qemu_strtod(str, &endptr, &res); in test_qemu_strtod_simple()
2836 g_assert_true(endptr == str + 5); in test_qemu_strtod_simple()
2839 str = "0x10"; in test_qemu_strtod_simple()
2842 err = qemu_strtod(str, &endptr, &res); in test_qemu_strtod_simple()
2845 g_assert_true(endptr == str + 4); in test_qemu_strtod_simple()
2850 const char *str; in test_qemu_strtod_einval() local
2856 str = ""; in test_qemu_strtod_einval()
2859 err = qemu_strtod(str, &endptr, &res); in test_qemu_strtod_einval()
2863 g_assert_true(endptr == str); in test_qemu_strtod_einval()
2866 str = NULL; in test_qemu_strtod_einval()
2869 err = qemu_strtod(str, &endptr, &res); in test_qemu_strtod_einval()
2876 str = " junk"; in test_qemu_strtod_einval()
2879 err = qemu_strtod(str, &endptr, &res); in test_qemu_strtod_einval()
2883 g_assert_true(endptr == str); in test_qemu_strtod_einval()
2888 const char *str; in test_qemu_strtod_erange() local
2894 str = "9e999"; in test_qemu_strtod_erange()
2897 err = qemu_strtod(str, &endptr, &res); in test_qemu_strtod_erange()
2900 g_assert_true(endptr == str + 5); in test_qemu_strtod_erange()
2902 str = "-9e+999"; in test_qemu_strtod_erange()
2905 err = qemu_strtod(str, &endptr, &res); in test_qemu_strtod_erange()
2908 g_assert_true(endptr == str + 7); in test_qemu_strtod_erange()
2911 str = "-9e-999"; in test_qemu_strtod_erange()
2914 err = qemu_strtod(str, &endptr, &res); in test_qemu_strtod_erange()
2919 g_assert_true(endptr == str + 7); in test_qemu_strtod_erange()
2924 const char *str; in test_qemu_strtod_nonfinite() local
2930 str = "inf"; in test_qemu_strtod_nonfinite()
2933 err = qemu_strtod(str, &endptr, &res); in test_qemu_strtod_nonfinite()
2937 g_assert_true(endptr == str + 3); in test_qemu_strtod_nonfinite()
2939 str = "-infinity"; in test_qemu_strtod_nonfinite()
2942 err = qemu_strtod(str, &endptr, &res); in test_qemu_strtod_nonfinite()
2946 g_assert_true(endptr == str + 9); in test_qemu_strtod_nonfinite()
2949 str = " NaN"; in test_qemu_strtod_nonfinite()
2952 err = qemu_strtod(str, &endptr, &res); in test_qemu_strtod_nonfinite()
2955 g_assert_true(endptr == str + 4); in test_qemu_strtod_nonfinite()
2960 const char *str; in test_qemu_strtod_trailing() local
2966 str = "1. "; in test_qemu_strtod_trailing()
2969 err = qemu_strtod(str, &endptr, &res); in test_qemu_strtod_trailing()
2972 g_assert_true(endptr == str + 2); in test_qemu_strtod_trailing()
2976 err = qemu_strtod(str, NULL, &res); in test_qemu_strtod_trailing()
2981 str = ".5e"; in test_qemu_strtod_trailing()
2984 err = qemu_strtod(str, &endptr, &res); in test_qemu_strtod_trailing()
2987 g_assert_true(endptr == str + 2); in test_qemu_strtod_trailing()
2991 err = qemu_strtod(str, NULL, &res); in test_qemu_strtod_trailing()
2996 str = "nan("; in test_qemu_strtod_trailing()
2999 err = qemu_strtod(str, &endptr, &res); in test_qemu_strtod_trailing()
3002 g_assert_true(endptr == str + 3); in test_qemu_strtod_trailing()
3006 err = qemu_strtod(str, NULL, &res); in test_qemu_strtod_trailing()
3013 const char *str; in test_qemu_strtod_erange_junk() local
3019 str = "1e-999junk"; in test_qemu_strtod_erange_junk()
3022 err = qemu_strtod(str, &endptr, &res); in test_qemu_strtod_erange_junk()
3027 g_assert_true(endptr == str + 6); in test_qemu_strtod_erange_junk()
3032 err = qemu_strtod(str, NULL, &res); in test_qemu_strtod_erange_junk()
3040 const char *str; in test_qemu_strtod_finite_simple() local
3046 str = "1"; in test_qemu_strtod_finite_simple()
3049 err = qemu_strtod_finite(str, &endptr, &res); in test_qemu_strtod_finite_simple()
3052 g_assert_true(endptr == str + 1); in test_qemu_strtod_finite_simple()
3055 str = " -0.0"; in test_qemu_strtod_finite_simple()
3058 err = qemu_strtod_finite(str, &endptr, &res); in test_qemu_strtod_finite_simple()
3062 g_assert_true(endptr == str + 5); in test_qemu_strtod_finite_simple()
3065 str = "+.5"; in test_qemu_strtod_finite_simple()
3068 err = qemu_strtod_finite(str, &endptr, &res); in test_qemu_strtod_finite_simple()
3071 g_assert_true(endptr == str + 3); in test_qemu_strtod_finite_simple()
3074 str = "1.e+1"; in test_qemu_strtod_finite_simple()
3077 err = qemu_strtod_finite(str, &endptr, &res); in test_qemu_strtod_finite_simple()
3080 g_assert_true(endptr == str + 5); in test_qemu_strtod_finite_simple()
3083 str = "0x10"; in test_qemu_strtod_finite_simple()
3086 err = qemu_strtod(str, &endptr, &res); in test_qemu_strtod_finite_simple()
3089 g_assert_true(endptr == str + 4); in test_qemu_strtod_finite_simple()
3094 const char *str; in test_qemu_strtod_finite_einval() local
3100 str = ""; in test_qemu_strtod_finite_einval()
3103 err = qemu_strtod_finite(str, &endptr, &res); in test_qemu_strtod_finite_einval()
3107 g_assert_true(endptr == str); in test_qemu_strtod_finite_einval()
3110 str = NULL; in test_qemu_strtod_finite_einval()
3113 err = qemu_strtod_finite(str, &endptr, &res); in test_qemu_strtod_finite_einval()
3120 str = " junk"; in test_qemu_strtod_finite_einval()
3123 err = qemu_strtod_finite(str, &endptr, &res); in test_qemu_strtod_finite_einval()
3127 g_assert_true(endptr == str); in test_qemu_strtod_finite_einval()
3132 const char *str; in test_qemu_strtod_finite_erange() local
3138 str = "9e999"; in test_qemu_strtod_finite_erange()
3141 err = qemu_strtod_finite(str, &endptr, &res); in test_qemu_strtod_finite_erange()
3145 g_assert_true(endptr == str); in test_qemu_strtod_finite_erange()
3147 str = "-9e+999"; in test_qemu_strtod_finite_erange()
3150 err = qemu_strtod_finite(str, &endptr, &res); in test_qemu_strtod_finite_erange()
3154 g_assert_true(endptr == str); in test_qemu_strtod_finite_erange()
3157 str = "-9e-999"; in test_qemu_strtod_finite_erange()
3160 err = qemu_strtod_finite(str, &endptr, &res); in test_qemu_strtod_finite_erange()
3165 g_assert_true(endptr == str + 7); in test_qemu_strtod_finite_erange()
3170 const char *str; in test_qemu_strtod_finite_nonfinite() local
3176 str = "inf"; in test_qemu_strtod_finite_nonfinite()
3179 err = qemu_strtod_finite(str, &endptr, &res); in test_qemu_strtod_finite_nonfinite()
3183 g_assert_true(endptr == str); in test_qemu_strtod_finite_nonfinite()
3185 str = "-infinity"; in test_qemu_strtod_finite_nonfinite()
3188 err = qemu_strtod_finite(str, &endptr, &res); in test_qemu_strtod_finite_nonfinite()
3192 g_assert_true(endptr == str); in test_qemu_strtod_finite_nonfinite()
3195 str = " NaN"; in test_qemu_strtod_finite_nonfinite()
3198 err = qemu_strtod_finite(str, &endptr, &res); in test_qemu_strtod_finite_nonfinite()
3202 g_assert_true(endptr == str); in test_qemu_strtod_finite_nonfinite()
3207 const char *str; in test_qemu_strtod_finite_trailing() local
3213 str = "1. "; in test_qemu_strtod_finite_trailing()
3216 err = qemu_strtod_finite(str, &endptr, &res); in test_qemu_strtod_finite_trailing()
3219 g_assert_true(endptr == str + 2); in test_qemu_strtod_finite_trailing()
3223 err = qemu_strtod_finite(str, NULL, &res); in test_qemu_strtod_finite_trailing()
3229 str = ".5e"; in test_qemu_strtod_finite_trailing()
3232 err = qemu_strtod_finite(str, &endptr, &res); in test_qemu_strtod_finite_trailing()
3235 g_assert_true(endptr == str + 2); in test_qemu_strtod_finite_trailing()
3239 err = qemu_strtod_finite(str, NULL, &res); in test_qemu_strtod_finite_trailing()
3244 str = "nan("; in test_qemu_strtod_finite_trailing()
3247 err = qemu_strtod_finite(str, &endptr, &res); in test_qemu_strtod_finite_trailing()
3251 g_assert_true(endptr == str); in test_qemu_strtod_finite_trailing()
3255 err = qemu_strtod_finite(str, NULL, &res); in test_qemu_strtod_finite_trailing()
3263 const char *str; in test_qemu_strtod_finite_erange_junk() local
3269 str = "1e-999junk"; in test_qemu_strtod_finite_erange_junk()
3272 err = qemu_strtod_finite(str, &endptr, &res); in test_qemu_strtod_finite_erange_junk()
3277 g_assert_true(endptr == str + 6); in test_qemu_strtod_finite_erange_junk()
3282 err = qemu_strtod_finite(str, NULL, &res); in test_qemu_strtod_finite_erange_junk()
3289 static void do_strtosz_full(const char *str, qemu_strtosz_fn fn, in do_strtosz_full() argument
3298 ret = fn(str, &endptr, &val); in do_strtosz_full()
3301 if (str) { in do_strtosz_full()
3302 g_assert_true(endptr == str + exp_ptr_offset); in do_strtosz_full()
3309 ret = fn(str, NULL, &val); in do_strtosz_full()
3314 static void do_strtosz(const char *str, int exp_ret, uint64_t exp_val, in do_strtosz() argument
3317 do_strtosz_full(str, qemu_strtosz, exp_ret, exp_val, exp_offset, in do_strtosz()
3321 static void do_strtosz_MiB(const char *str, int exp_ret, uint64_t exp_val, in do_strtosz_MiB() argument
3324 do_strtosz_full(str, qemu_strtosz_MiB, exp_ret, exp_val, exp_offset, in do_strtosz_MiB()
3328 static void do_strtosz_metric(const char *str, int exp_ret, uint64_t exp_val, in do_strtosz_metric() argument
3331 do_strtosz_full(str, qemu_strtosz_metric, exp_ret, exp_val, exp_offset, in do_strtosz_metric()
3561 char *str; in test_freq_to_str() local
3563 str = freq_to_str(999); in test_freq_to_str()
3564 g_assert_cmpstr(str, ==, "999 Hz"); in test_freq_to_str()
3565 g_free(str); in test_freq_to_str()
3567 str = freq_to_str(1000); in test_freq_to_str()
3568 g_assert_cmpstr(str, ==, "1 KHz"); in test_freq_to_str()
3569 g_free(str); in test_freq_to_str()
3571 str = freq_to_str(1010); in test_freq_to_str()
3572 g_assert_cmpstr(str, ==, "1.01 KHz"); in test_freq_to_str()
3573 g_free(str); in test_freq_to_str()
3578 char *str; in test_size_to_str() local
3580 str = size_to_str(0); in test_size_to_str()
3581 g_assert_cmpstr(str, ==, "0 B"); in test_size_to_str()
3582 g_free(str); in test_size_to_str()
3584 str = size_to_str(1); in test_size_to_str()
3585 g_assert_cmpstr(str, ==, "1 B"); in test_size_to_str()
3586 g_free(str); in test_size_to_str()
3588 str = size_to_str(1016); in test_size_to_str()
3589 g_assert_cmpstr(str, ==, "0.992 KiB"); in test_size_to_str()
3590 g_free(str); in test_size_to_str()
3592 str = size_to_str(1024); in test_size_to_str()
3593 g_assert_cmpstr(str, ==, "1 KiB"); in test_size_to_str()
3594 g_free(str); in test_size_to_str()
3596 str = size_to_str(512ull << 20); in test_size_to_str()
3597 g_assert_cmpstr(str, ==, "512 MiB"); in test_size_to_str()
3598 g_free(str); in test_size_to_str()