Updated ranges-test.cc.
This commit is contained in:
parent
d2ef18c7d7
commit
f65bcb8b08
@ -21,29 +21,29 @@
|
|||||||
TEST(RangesTest, FormatVector) {
|
TEST(RangesTest, FormatVector) {
|
||||||
std::vector<int32_t> iv{1, 2, 3, 5, 7, 11};
|
std::vector<int32_t> iv{1, 2, 3, 5, 7, 11};
|
||||||
auto ivf = fmt::format("{}", iv);
|
auto ivf = fmt::format("{}", iv);
|
||||||
EXPECT_EQ("{1,2,3,5,7,11}", ivf);
|
EXPECT_EQ("{1, 2, 3, 5, 7, 11}", ivf);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(RangesTest, FormatVector2) {
|
TEST(RangesTest, FormatVector2) {
|
||||||
std::vector<std::vector<int32_t>> ivv{{1, 2}, {3, 5}, {7, 11}};
|
std::vector<std::vector<int32_t>> ivv{{1, 2}, {3, 5}, {7, 11}};
|
||||||
auto ivf = fmt::format("{}", ivv);
|
auto ivf = fmt::format("{}", ivv);
|
||||||
EXPECT_EQ("{{1,2},{3,5},{7,11}}", ivf);
|
EXPECT_EQ("{{1, 2}, {3, 5}, {7, 11}}", ivf);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(RangesTest, FormatMap) {
|
TEST(RangesTest, FormatMap) {
|
||||||
std::map<std::string, int32_t> simap{{"one", 1}, {"two", 2}};
|
std::map<std::string, int32_t> simap{{"one", 1}, {"two", 2}};
|
||||||
EXPECT_EQ("{(one,1),(two,2)}", fmt::format("{}", simap));
|
EXPECT_EQ("{(one, 1), (two, 2)}", fmt::format("{}", simap));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(RangesTest, FormatPair) {
|
TEST(RangesTest, FormatPair) {
|
||||||
std::pair<int64_t, float> pa1{42, 3.14159265358979f};
|
std::pair<int64_t, float> pa1{42, 3.14159265358979f};
|
||||||
EXPECT_EQ("(42,3.14159)", fmt::format("{}", pa1));
|
EXPECT_EQ("(42, 3.14159)", fmt::format("{}", pa1));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(RangesTest, FormatTuple) {
|
TEST(RangesTest, FormatTuple) {
|
||||||
std::tuple<int64_t, float, std::string> tu1{42, 3.14159265358979f,
|
std::tuple<int64_t, float, std::string> tu1{42, 3.14159265358979f,
|
||||||
"this is tuple"};
|
"this is tuple"};
|
||||||
EXPECT_EQ("(42,3.14159,this is tuple)", fmt::format("{}", tu1));
|
EXPECT_EQ("(42, 3.14159, this is tuple)", fmt::format("{}", tu1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// check if 'if constexpr' is supported.
|
/// check if 'if constexpr' is supported.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user