Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
fmt
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
fmt
Commits
4133e501
Commit
4133e501
authored
Jul 11, 2016
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'locale'
parents
44c926d9
0e6df7e5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
2 deletions
+5
-2
fmt/format.h
fmt/format.h
+2
-1
test/format-test.cc
test/format-test.cc
+3
-1
No files found.
fmt/format.h
View file @
4133e501
...
...
@@ -933,6 +933,7 @@ inline void format_decimal(Char *buffer, UInt value, unsigned num_digits,
}
unsigned
index
=
static_cast
<
unsigned
>
(
value
*
2
);
*--
buffer
=
Data
::
DIGITS
[
index
+
1
];
thousands_sep
(
buffer
);
*--
buffer
=
Data
::
DIGITS
[
index
];
}
...
...
@@ -2780,7 +2781,7 @@ void BasicWriter<Char>::write_int(T value, Spec spec) {
unsigned
num_digits
=
internal
::
count_digits
(
abs_value
);
fmt
::
StringRef
sep
=
internal
::
thousands_sep
(
std
::
localeconv
());
unsigned
size
=
static_cast
<
unsigned
>
(
num_digits
+
sep
.
size
()
*
(
num_digits
-
1
)
/
3
);
num_digits
+
sep
.
size
()
*
(
(
num_digits
-
1
)
/
3
)
);
CharPtr
p
=
prepare_int_buffer
(
size
,
spec
,
prefix
,
prefix_size
)
+
1
;
internal
::
format_decimal
(
get
(
p
),
abs_value
,
0
,
internal
::
ThousandsSep
(
sep
));
break
;
...
...
test/format-test.cc
View file @
4133e501
...
...
@@ -1229,7 +1229,9 @@ TEST(FormatterTest, FormatIntLocale) {
lconv
lc
=
{};
char
sep
[]
=
"--"
;
lc
.
thousands_sep
=
sep
;
EXPECT_CALL
(
mock
,
localeconv
()).
WillOnce
(
testing
::
Return
(
&
lc
));
EXPECT_CALL
(
mock
,
localeconv
()).
Times
(
3
).
WillRepeatedly
(
testing
::
Return
(
&
lc
));
EXPECT_EQ
(
"123"
,
format
(
"{:n}"
,
123
));
EXPECT_EQ
(
"1--234"
,
format
(
"{:n}"
,
1234
));
EXPECT_EQ
(
"1--234--567"
,
format
(
"{:n}"
,
1234567
));
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment