mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 04:02:41 +01:00
[ADT] Follow up to fix bug in "Add makeVisitor to STLExtras.h"
Address mistakenly comparing the pointer values of two C-style strings rather than comparing their contents in the unit tests for makeVisitor, added in 6d6f35eb7b92c6dd4478834497752f4e963db16d
This commit is contained in:
parent
ade0ec7fb0
commit
62d5b36f28
@ -777,9 +777,9 @@ TEST(STLExtrasTest, MakeVisitorOneCallable) {
|
||||
|
||||
TEST(STLExtrasTest, MakeVisitorTwoCallables) {
|
||||
auto Visitor =
|
||||
makeVisitor([](int) { return "int"; }, [](std::string) { return "str"; });
|
||||
EXPECT_EQ(Visitor(42), "int");
|
||||
EXPECT_EQ(Visitor("foo"), "str");
|
||||
makeVisitor([](int) { return 0; }, [](std::string) { return 1; });
|
||||
EXPECT_EQ(Visitor(42), 0);
|
||||
EXPECT_EQ(Visitor("foo"), 1);
|
||||
}
|
||||
|
||||
TEST(STLExtrasTest, MakeVisitorCallableMultipleOperands) {
|
||||
@ -793,20 +793,20 @@ TEST(STLExtrasTest, MakeVisitorDefaultCase) {
|
||||
{
|
||||
auto Visitor = makeVisitor([](int I) { return I + 100; },
|
||||
[](float F) { return F * 2; },
|
||||
[](auto) { return "unhandled type"; });
|
||||
[](auto) { return -1; });
|
||||
EXPECT_EQ(Visitor(24), 124);
|
||||
EXPECT_EQ(Visitor(2.f), 4.f);
|
||||
EXPECT_EQ(Visitor(2.), "unhandled type");
|
||||
EXPECT_EQ(Visitor(Visitor), "unhandled type");
|
||||
EXPECT_EQ(Visitor(2.), -1);
|
||||
EXPECT_EQ(Visitor(Visitor), -1);
|
||||
}
|
||||
{
|
||||
auto Visitor = makeVisitor([](auto) { return "unhandled type"; },
|
||||
auto Visitor = makeVisitor([](auto) { return -1; },
|
||||
[](int I) { return I + 100; },
|
||||
[](float F) { return F * 2; });
|
||||
EXPECT_EQ(Visitor(24), 124);
|
||||
EXPECT_EQ(Visitor(2.f), 4.f);
|
||||
EXPECT_EQ(Visitor(2.), "unhandled type");
|
||||
EXPECT_EQ(Visitor(Visitor), "unhandled type");
|
||||
EXPECT_EQ(Visitor(2.), -1);
|
||||
EXPECT_EQ(Visitor(Visitor), -1);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user