Improve test

This commit is contained in:
Shawn Zhong 2023-01-17 22:51:39 -06:00
parent 4556ea12de
commit a7d70b5dfd

View File

@ -426,13 +426,6 @@ TEST(ranges_test, container_adaptor) {
EXPECT_EQ(fmt::format("{}", s), "[1, 2]");
}
{
std::stack<int, std::vector<int>> s;
s.push(1);
s.push(2);
EXPECT_EQ(fmt::format("{}", s), "[1, 2]");
}
{
std::queue<int> q;
q.push(1);
@ -449,6 +442,16 @@ TEST(ranges_test, container_adaptor) {
EXPECT_EQ(fmt::format("{}", q), "[4, 3, 2, 1]");
}
{
std::stack<char, std::string> s;
s.push('a');
s.push('b');
// Note: The output is formatted as a string because the underlying
// container is a string. This behavior is conforming to the standard
// [container.adaptors.format].
EXPECT_EQ(fmt::format("{}", s), "ab");
}
{
struct my_container_adaptor {
using value_type = int;