Add decimal separator support to float

This commit is contained in:
Victor Zverovich
2021-07-18 07:39:22 -07:00
parent 9730a2af0a
commit 6ea6cf9464
2 changed files with 101 additions and 50 deletions

View File

@@ -301,10 +301,12 @@ template <typename Char> struct small_grouping : std::numpunct<Char> {
Char do_thousands_sep() const override { return ','; }
};
TEST(locale_test, double_decimal_point) {
TEST(locale_test, localized_double) {
auto loc = std::locale(std::locale(), new numpunct<char>());
EXPECT_EQ("1?23", fmt::format(loc, "{:L}", 1.23));
EXPECT_EQ("1?230000", fmt::format(loc, "{:Lf}", 1.23));
EXPECT_EQ("1~234?5", fmt::format(loc, "{:L}", 1234.5));
EXPECT_EQ("12~000", fmt::format(loc, "{:L}", 12000.0));
}
TEST(locale_test, format) {