Lines Matching refs:fmt

814 void test_floating_from_chars(const chars_format fmt) {
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
836 if (fmt != chars_format::hex) { // "e5" are valid hexits
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);
886 switch (fmt) {
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});
892 … test_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});
899 … test_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});
902 … test_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);
915 … test_from_chars<T>("." + string(6000, '0') + "1", fmt, 6002, errc::result_out_of_range, T{0});
916 … test_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});
920 … test_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);
957 … test_from_chars<T>("." + string(2000, '0') + "1", fmt, 2002, errc::result_out_of_range, T{0});
958 … test_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});
962 … test_from_chars<T>("-." + string(300, '0') + "1", fmt, 303, errc::result_out_of_range, T{-0.0});
980 …for (const auto& fmt : {chars_format::general, chars_format::scientific, chars_format::fixed, char… in all_floating_tests()
981 test_floating_from_chars<float>(fmt); in all_floating_tests()
982 test_floating_from_chars<double>(fmt); in all_floating_tests()
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()
1021 if (t.fmt == chars_format{}) { in all_floating_tests()
1024 test_floating_to_chars(t.value, t.fmt, nullopt, t.correct); in all_floating_tests()
1030 if (t.fmt == chars_format{}) { in all_floating_tests()
1033 test_floating_to_chars(t.value, t.fmt, nullopt, t.correct); in all_floating_tests()
1039 test_floating_to_chars(t.value, t.fmt, t.precision, t.correct); in all_floating_tests()
1042 test_floating_to_chars(t.value, t.fmt, t.precision, t.correct); in all_floating_tests()
1045 test_floating_to_chars(t.value, t.fmt, t.precision, t.correct); in all_floating_tests()
1048 test_floating_to_chars(t.value, t.fmt, t.precision, t.correct); in all_floating_tests()
1051 test_floating_to_chars(t.value, t.fmt, t.precision, t.correct); in all_floating_tests()
1054 test_floating_to_chars(t.value, t.fmt, t.precision, t.correct); in all_floating_tests()
1057 test_floating_to_chars(t.value, t.fmt, t.precision, t.correct); in all_floating_tests()
1060 test_floating_to_chars(t.value, t.fmt, t.precision, t.correct); in all_floating_tests()
1063 test_floating_to_chars(t.value, t.fmt, t.precision, t.correct); in all_floating_tests()
1066 test_floating_to_chars(t.value, t.fmt, t.precision, t.correct); in all_floating_tests()
1069 test_floating_to_chars(t.value, t.fmt, t.precision, t.correct); in all_floating_tests()
1072 test_floating_to_chars(t.value, t.fmt, t.precision, t.correct); in all_floating_tests()
1075 test_floating_to_chars(t.value, t.fmt, t.precision, t.correct); in all_floating_tests()
1078 test_floating_to_chars(t.value, t.fmt, t.precision, t.correct); in all_floating_tests()