Lines Matching refs:test_from_chars

407 void test_from_chars(const string_view input, const BaseOrFmt base_or_fmt, const size_t correct_idx,  in test_from_chars()  function
451 test_from_chars<T>("", base, 0, inv_arg); // no characters in test_integer_from_chars()
452 test_from_chars<T>("@1", base, 0, inv_arg); // '@' is bogus in test_integer_from_chars()
453 test_from_chars<T>(".1", base, 0, inv_arg); // '.' is bogus, for integers in test_integer_from_chars()
454test_from_chars<T>("+1", base, 0, inv_arg); // '+' is bogus, N4713 23.20.3 [charconv.from.chars]/3 in test_integer_from_chars()
456test_from_chars<T>(" 1", base, 0, inv_arg); // ' ' is bogus, no whitespace in subject sequence in test_integer_from_chars()
459 test_from_chars<T>("-1", base, 0, inv_arg); // "and only if value has a signed type" in test_integer_from_chars()
464 test_from_chars<T>("-", base, 0, inv_arg); // '-' followed by no characters in test_integer_from_chars()
465 test_from_chars<T>("-@1", base, 0, inv_arg); // '-' followed by bogus '@' in test_integer_from_chars()
466 test_from_chars<T>("-.1", base, 0, inv_arg); // '-' followed by bogus '.' in test_integer_from_chars()
467 test_from_chars<T>("-+1", base, 0, inv_arg); // '-' followed by bogus '+' in test_integer_from_chars()
468 test_from_chars<T>("- 1", base, 0, inv_arg); // '-' followed by bogus ' ' in test_integer_from_chars()
469 test_from_chars<T>("--1", base, 0, inv_arg); // '-' can't be repeated in test_integer_from_chars()
481 test_from_chars<T>(bogus + "1"s, base, 0, inv_arg); // bogus digit (for this base) in test_integer_from_chars()
482test_from_chars<T>("-"s + bogus + "1"s, base, 0, inv_arg); // '-' followed by bogus digit in test_integer_from_chars()
486 test_from_chars<T>(string(100, '0'), base, 100, errc{}, static_cast<T>(0)); in test_integer_from_chars()
487 test_from_chars<T>(string(100, '0') + "11"s, base, 102, errc{}, static_cast<T>(base + 1)); in test_integer_from_chars()
491 test_from_chars<T>("-0", base, 2, errc{}, static_cast<T>(0)); in test_integer_from_chars()
492 test_from_chars<T>("-"s + string(100, '0'), base, 101, errc{}, static_cast<T>(0)); in test_integer_from_chars()
493test_from_chars<T>("-"s + string(100, '0') + "11"s, base, 103, errc{}, static_cast<T>(-base - 1)); in test_integer_from_chars()
498 test_from_chars<T>("11", base, 2, errc{}, static_cast<T>(base + 1)); in test_integer_from_chars()
499 test_from_chars<T>("11@@@", base, 2, errc{}, static_cast<T>(base + 1)); in test_integer_from_chars()
502 test_from_chars<T>(string(100, '1'), base, 100, out_ran); in test_integer_from_chars()
503 test_from_chars<T>(string(100, '1') + "@@@"s, base, 100, out_ran); in test_integer_from_chars()
506 test_from_chars<T>("-"s + string(100, '1'), base, 101, out_ran); in test_integer_from_chars()
507 test_from_chars<T>("-"s + string(100, '1') + "@@@"s, base, 101, out_ran); in test_integer_from_chars()
515test_from_chars<T>(string(1, static_cast<char>('A' + i)), 36, 1, errc{}, static_cast<T>(10 + i)); in test_integer_from_chars()
516test_from_chars<T>(string(1, static_cast<char>('a' + i)), 36, 1, errc{}, static_cast<T>(10 + i)); in test_integer_from_chars()
520 test_from_chars<T>("0x1729", 16, 1, errc{}, static_cast<T>(0)); // reads '0', stops at 'x' in test_integer_from_chars()
521 test_from_chars<T>("0X1729", 16, 1, errc{}, static_cast<T>(0)); // reads '0', stops at 'X' in test_integer_from_chars()
524 test_from_chars<T>("-0x1729", 16, 2, errc{}, static_cast<T>(0)); // reads "-0", stops at 'x' in test_integer_from_chars()
525 test_from_chars<T>("-0X1729", 16, 2, errc{}, static_cast<T>(0)); // reads "-0", stops at 'X' in test_integer_from_chars()
549 test_from_chars<unsigned int>("4294967289", 10, 10, errc{}, 4294967289U); // not risky in all_integer_tests()
550test_from_chars<unsigned int>("4294967294", 10, 10, errc{}, 4294967294U); // risky with good digit in all_integer_tests()
551test_from_chars<unsigned int>("4294967295", 10, 10, errc{}, 4294967295U); // risky with max digit in all_integer_tests()
552 test_from_chars<unsigned int>("4294967296", 10, 10, out_ran); // risky with bad digit in all_integer_tests()
553 test_from_chars<unsigned int>("4294967300", 10, 10, out_ran); // beyond risky in all_integer_tests()
555 test_from_chars<int>("2147483639", 10, 10, errc{}, 2147483639); // not risky in all_integer_tests()
556 test_from_chars<int>("2147483646", 10, 10, errc{}, 2147483646); // risky with good digit in all_integer_tests()
557 test_from_chars<int>("2147483647", 10, 10, errc{}, 2147483647); // risky with max digit in all_integer_tests()
558 test_from_chars<int>("2147483648", 10, 10, out_ran); // risky with bad digit in all_integer_tests()
559 test_from_chars<int>("2147483650", 10, 10, out_ran); // beyond risky in all_integer_tests()
561 test_from_chars<int>("-2147483639", 10, 11, errc{}, -2147483639); // not risky in all_integer_tests()
562 test_from_chars<int>("-2147483647", 10, 11, errc{}, -2147483647); // risky with good digit in all_integer_tests()
563 test_from_chars<int>("-2147483648", 10, 11, errc{}, -2147483647 - 1); // risky with max digit in all_integer_tests()
564 test_from_chars<int>("-2147483649", 10, 11, out_ran); // risky with bad digit in all_integer_tests()
565 test_from_chars<int>("-2147483650", 10, 11, out_ran); // beyond risky in all_integer_tests()
815 test_from_chars<T>("", fmt, 0, inv_arg); // no characters
816 test_from_chars<T>("@1", fmt, 0, inv_arg); // '@' is bogus
817 test_from_chars<T>("z1", fmt, 0, inv_arg); // 'z' is bogus
818 test_from_chars<T>(".", fmt, 0, inv_arg); // '.' without digits is bogus
819 test_from_chars<T>("+1", fmt, 0, inv_arg); // '+' is bogus
820 test_from_chars<T>(" 1", fmt, 0, inv_arg); // ' ' is bogus
821 test_from_chars<T>("p5", fmt, 0, inv_arg); // binary-exponent-part without digits is bogus
822 test_from_chars<T>("in", fmt, 0, inv_arg); // incomplete inf is bogus
823 test_from_chars<T>("na", fmt, 0, inv_arg); // incomplete nan is bogus
825 test_from_chars<T>("-", fmt, 0, inv_arg); // '-' followed by no characters
826 test_from_chars<T>("-@1", fmt, 0, inv_arg); // '-' followed by bogus '@'
827 test_from_chars<T>("-z1", fmt, 0, inv_arg); // '-' followed by bogus 'z'
828 test_from_chars<T>("-.", fmt, 0, inv_arg); // '-' followed by bogus '.'
829 test_from_chars<T>("-+1", fmt, 0, inv_arg); // '-' followed by bogus '+'
830 test_from_chars<T>("- 1", fmt, 0, inv_arg); // '-' followed by bogus ' '
831 test_from_chars<T>("-p5", fmt, 0, inv_arg); // '-' followed by bogus binary-exponent-part
832 test_from_chars<T>("-in", fmt, 0, inv_arg); // '-' followed by bogus incomplete inf
833 test_from_chars<T>("-na", fmt, 0, inv_arg); // '-' followed by bogus incomplete nan
834 test_from_chars<T>("--1", fmt, 0, inv_arg); // '-' can't be repeated
837 test_from_chars<T>("e5", fmt, 0, inv_arg); // exponent-part without digits is bogus
838 test_from_chars<T>("-e5", fmt, 0, inv_arg); // '-' followed by bogus exponent-part
844 test_from_chars<T>("InF", fmt, 3, errc{}, inf);
845 test_from_chars<T>("infinite", fmt, 3, errc{}, inf);
846 test_from_chars<T>("iNfInItY", fmt, 8, errc{}, inf);
847 test_from_chars<T>("InfinityMeow", fmt, 8, errc{}, inf);
849 test_from_chars<T>("-InF", fmt, 4, errc{}, -inf);
850 test_from_chars<T>("-infinite", fmt, 4, errc{}, -inf);
851 test_from_chars<T>("-iNfInItY", fmt, 9, errc{}, -inf);
852 test_from_chars<T>("-InfinityMeow", fmt, 9, errc{}, -inf);
854 test_from_chars<T>("NaN", fmt, 3, errc{}, qnan);
855 test_from_chars<T>("nanotech", fmt, 3, errc{}, qnan);
856 test_from_chars<T>("nan(", fmt, 3, errc{}, qnan);
857 test_from_chars<T>("nan(@)", fmt, 3, errc{}, qnan);
858 test_from_chars<T>("nan(()", fmt, 3, errc{}, qnan);
859 test_from_chars<T>("nan(abc", fmt, 3, errc{}, qnan);
860 test_from_chars<T>("nan()", fmt, 5, errc{}, qnan);
861 test_from_chars<T>("nan(abc)def", fmt, 8, errc{}, qnan);
862 test_from_chars<T>("nan(_09AZaz)", fmt, 12, errc{}, qnan);
863 test_from_chars<T>("nan(int)", fmt, 8, errc{}, qnan);
864 test_from_chars<T>("nan(snap)", fmt, 9, errc{}, qnan);
866 test_from_chars<T>("-NaN", fmt, 4, errc{}, -qnan);
867 test_from_chars<T>("-nanotech", fmt, 4, errc{}, -qnan);
868 test_from_chars<T>("-nan(", fmt, 4, errc{}, -qnan);
869 test_from_chars<T>("-nan(@)", fmt, 4, errc{}, -qnan);
870 test_from_chars<T>("-nan(()", fmt, 4, errc{}, -qnan);
871 test_from_chars<T>("-nan(abc", fmt, 4, errc{}, -qnan);
872 test_from_chars<T>("-nan()", fmt, 6, errc{}, -qnan);
873 test_from_chars<T>("-nan(abc)def", fmt, 9, errc{}, -qnan);
874 test_from_chars<T>("-nan(_09AZaz)", fmt, 13, errc{}, -qnan);
875 test_from_chars<T>("-nan(int)", fmt, 9, errc{}, -qnan);
876 test_from_chars<T>("-nan(snap)", fmt, 10, errc{}, -qnan);
880 test_from_chars<T>("nan(InD)", fmt, 8, errc{}, -qnan);
881 test_from_chars<T>("-nan(InD)", fmt, 9, errc{}, -qnan);
883 test_from_chars<T>("nan(SnAn)", fmt, 9, errc{}, nullopt, TestFromCharsMode::SignalingNaN);
884 test_from_chars<T>("-nan(SnAn)", fmt, 10, errc{}, nullopt, TestFromCharsMode::SignalingNaN);
888 test_from_chars<T>("1729", fmt, 4, errc{}, T{1729});
889 test_from_chars<T>("1729e3", fmt, 6, errc{}, T{1729000});
890 test_from_chars<T>("10", fmt, 2, errc{}, T{10});
891 test_from_chars<T>("11.", fmt, 3, errc{}, T{11});
892test_from_chars<T>("12.13", fmt, 5, errc{}, static_cast<T>(12.13)); // avoid truncation warning
893 test_from_chars<T>(".14", fmt, 3, errc{}, static_cast<T>(.14)); // avoid truncation warning
894 test_from_chars<T>("20e5", fmt, 4, errc{}, T{2000000});
895 test_from_chars<T>("21.e5", fmt, 5, errc{}, T{2100000});
896 test_from_chars<T>("22.23e5", fmt, 7, errc{}, T{2223000});
897 test_from_chars<T>(".24e5", fmt, 5, errc{}, T{24000});
898 test_from_chars<T>("33e+5", fmt, 5, errc{}, T{3300000});
899test_from_chars<T>("33e-5", fmt, 5, errc{}, static_cast<T>(.00033)); // avoid truncation warning
900 test_from_chars<T>("4E7", fmt, 3, errc{}, T{40000000});
901 test_from_chars<T>("-00123abc", fmt, 6, errc{}, T{-123});
902test_from_chars<T>(".0045000", fmt, 8, errc{}, static_cast<T>(.0045)); // avoid truncation warning
903 test_from_chars<T>("000", fmt, 3, errc{}, T{0});
904 test_from_chars<T>("0e9999", fmt, 6, errc{}, T{0});
905 test_from_chars<T>("0e-9999", fmt, 7, errc{}, T{0});
906 test_from_chars<T>("-000", fmt, 4, errc{}, T{-0.0});
907 test_from_chars<T>("-0e9999", fmt, 7, errc{}, T{-0.0});
908 test_from_chars<T>("-0e-9999", fmt, 8, errc{}, T{-0.0});
909 test_from_chars<T>("1e9999", fmt, 6, errc::result_out_of_range, inf);
910 test_from_chars<T>("-1e9999", fmt, 7, errc::result_out_of_range, -inf);
911 test_from_chars<T>("1e-9999", fmt, 7, errc::result_out_of_range, T{0});
912 test_from_chars<T>("-1e-9999", fmt, 8, errc::result_out_of_range, T{-0.0});
913 test_from_chars<T>("1" + string(6000, '0'), fmt, 6001, errc::result_out_of_range, inf);
914 test_from_chars<T>("-1" + string(6000, '0'), fmt, 6002, errc::result_out_of_range, -inf);
915test_from_chars<T>("." + string(6000, '0') + "1", fmt, 6002, errc::result_out_of_range, T{0});
916test_from_chars<T>("-." + string(6000, '0') + "1", fmt, 6003, errc::result_out_of_range, T{-0.0});
917 test_from_chars<T>("1" + string(500, '0'), fmt, 501, errc::result_out_of_range, inf);
918 test_from_chars<T>("-1" + string(500, '0'), fmt, 502, errc::result_out_of_range, -inf);
919 test_from_chars<T>("." + string(500, '0') + "1", fmt, 502, errc::result_out_of_range, T{0});
920test_from_chars<T>("-." + string(500, '0') + "1", fmt, 503, errc::result_out_of_range, T{-0.0});
923 test_from_chars<T>("1729", fmt, 0, inv_arg);
924 test_from_chars<T>("1729e3", fmt, 6, errc{}, T{1729000});
927 test_from_chars<T>("1729", fmt, 4, errc{}, T{1729});
928 test_from_chars<T>("1729e3", fmt, 4, errc{}, T{1729});
931 test_from_chars<T>("0x123", fmt, 1, errc{}, T{0});
932 test_from_chars<T>("a0", fmt, 2, errc{}, T{160});
933 test_from_chars<T>("a1.", fmt, 3, errc{}, T{161});
934 test_from_chars<T>("a2.a3", fmt, 5, errc{}, T{162.63671875});
935 test_from_chars<T>(".a4", fmt, 3, errc{}, T{0.640625});
936 test_from_chars<T>("a0p5", fmt, 4, errc{}, T{5120});
937 test_from_chars<T>("a1.p5", fmt, 5, errc{}, T{5152});
938 test_from_chars<T>("a2.a3p5", fmt, 7, errc{}, T{5204.375});
939 test_from_chars<T>(".a4p5", fmt, 5, errc{}, T{20.5});
940 test_from_chars<T>("a0p+5", fmt, 5, errc{}, T{5120});
941 test_from_chars<T>("a0p-5", fmt, 5, errc{}, T{5});
942 test_from_chars<T>("ABCDEFP3", fmt, 8, errc{}, T{90075000});
943 test_from_chars<T>("-00cdrom", fmt, 5, errc{}, T{-205});
944 test_from_chars<T>(".00ef000", fmt, 8, errc{}, T{0.0036468505859375});
945 test_from_chars<T>("000", fmt, 3, errc{}, T{0});
946 test_from_chars<T>("0p9999", fmt, 6, errc{}, T{0});
947 test_from_chars<T>("0p-9999", fmt, 7, errc{}, T{0});
948 test_from_chars<T>("-000", fmt, 4, errc{}, T{-0.0});
949 test_from_chars<T>("-0p9999", fmt, 7, errc{}, T{-0.0});
950 test_from_chars<T>("-0p-9999", fmt, 8, errc{}, T{-0.0});
951 test_from_chars<T>("1p9999", fmt, 6, errc::result_out_of_range, inf);
952 test_from_chars<T>("-1p9999", fmt, 7, errc::result_out_of_range, -inf);
953 test_from_chars<T>("1p-9999", fmt, 7, errc::result_out_of_range, T{0});
954 test_from_chars<T>("-1p-9999", fmt, 8, errc::result_out_of_range, T{-0.0});
955 test_from_chars<T>("1" + string(2000, '0'), fmt, 2001, errc::result_out_of_range, inf);
956 test_from_chars<T>("-1" + string(2000, '0'), fmt, 2002, errc::result_out_of_range, -inf);
957test_from_chars<T>("." + string(2000, '0') + "1", fmt, 2002, errc::result_out_of_range, T{0});
958test_from_chars<T>("-." + string(2000, '0') + "1", fmt, 2003, errc::result_out_of_range, T{-0.0});
959 test_from_chars<T>("1" + string(300, '0'), fmt, 301, errc::result_out_of_range, inf);
960 test_from_chars<T>("-1" + string(300, '0'), fmt, 302, errc::result_out_of_range, -inf);
961 test_from_chars<T>("." + string(300, '0') + "1", fmt, 302, errc::result_out_of_range, T{0});
962test_from_chars<T>("-." + string(300, '0') + "1", fmt, 303, errc::result_out_of_range, T{-0.0});
989 test_from_chars<float>(t.input, t.fmt, t.correct_idx, t.correct_ec, t.correct_value); in all_floating_tests()
994 test_from_chars<double>(t.input, t.fmt, t.correct_idx, t.correct_ec, t.correct_value); in all_floating_tests()
1005 test_from_chars<float>(lwg_2403, chars_format::general, 56, errc{}, correct_float); in all_floating_tests()
1006 test_from_chars<double>(lwg_2403, chars_format::general, 56, errc{}, correct_double); in all_floating_tests()
1012test_from_chars<float>(p.first, chars_format::general, strlen(p.first), errc{}, _Bit_cast<float>(p… in all_floating_tests()
1016test_from_chars<double>(p.first, chars_format::general, strlen(p.first), errc{}, _Bit_cast<double>… in all_floating_tests()