You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
795 B
41 lines
795 B
|
4 years ago
|
|
||
|
|
#include <gtest/gtest.h>
|
||
|
|
|
||
|
|
#include "utils/format_int.hpp"
|
||
|
|
|
||
|
|
namespace devilution {
|
||
|
|
namespace {
|
||
|
|
|
||
|
|
TEST(FormatIntegerTest, OneDigit)
|
||
|
|
{
|
||
|
|
EXPECT_EQ(FormatInteger(1), "1");
|
||
|
|
EXPECT_EQ(FormatInteger(-1), "-1");
|
||
|
|
}
|
||
|
|
|
||
|
|
TEST(FormatIntegerTest, TwoDigits)
|
||
|
|
{
|
||
|
|
EXPECT_EQ(FormatInteger(12), "12");
|
||
|
|
EXPECT_EQ(FormatInteger(-12), "-12");
|
||
|
|
}
|
||
|
|
|
||
|
|
TEST(FormatIntegerTest, ThreeDigits)
|
||
|
|
{
|
||
|
|
EXPECT_EQ(FormatInteger(123), "123");
|
||
|
|
EXPECT_EQ(FormatInteger(-123), "-123");
|
||
|
|
}
|
||
|
|
|
||
|
|
TEST(FormatIntegerTest, FourDigits)
|
||
|
|
{
|
||
|
|
EXPECT_EQ(FormatInteger(1234), "1,234");
|
||
|
|
EXPECT_EQ(FormatInteger(-1234), "-1,234");
|
||
|
|
}
|
||
|
|
|
||
|
|
TEST(FormatIntegerTest, SevenDigits)
|
||
|
|
{
|
||
|
|
EXPECT_EQ(FormatInteger(1234567), "1,234,567");
|
||
|
|
EXPECT_EQ(FormatInteger(-1234567), "-1,234,567");
|
||
|
|
}
|
||
|
|
|
||
|
|
} // namespace
|
||
|
|
} // namespace devilution
|