mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-25 06:21:00 +00:00
Fix FormatInt.
This commit is contained in:
parent
2951f8b3d8
commit
eded10cf31
2
format.h
2
format.h
@ -1140,7 +1140,7 @@ class FormatInt {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit FormatInt(int value) {
|
explicit FormatInt(int value) {
|
||||||
uint64_t abs_value = value;
|
unsigned abs_value = value;
|
||||||
bool negative = value < 0;
|
bool negative = value < 0;
|
||||||
if (negative)
|
if (negative)
|
||||||
abs_value = 0 - value;
|
abs_value = 0 - value;
|
||||||
|
@ -1287,6 +1287,7 @@ TEST(FormatterTest, Examples) {
|
|||||||
|
|
||||||
TEST(FormatIntTest, FormatInt) {
|
TEST(FormatIntTest, FormatInt) {
|
||||||
EXPECT_EQ("42", fmt::FormatInt(42).str());
|
EXPECT_EQ("42", fmt::FormatInt(42).str());
|
||||||
|
EXPECT_EQ("-42", fmt::FormatInt(-42).str());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
Loading…
Reference in New Issue
Block a user