Don't assume that StringRef::compare returns +/-1

This commit is contained in:
vitaut 2015-11-11 06:44:57 -08:00
parent 477962884e
commit d6d019aa12

View File

@ -726,8 +726,8 @@ TEST(UtilTest, StringRefCompare) {
EXPECT_EQ(0, StringRef("foo").compare(StringRef("foo"))); EXPECT_EQ(0, StringRef("foo").compare(StringRef("foo")));
EXPECT_GT(StringRef("fop").compare(StringRef("foo")), 0); EXPECT_GT(StringRef("fop").compare(StringRef("foo")), 0);
EXPECT_LT(StringRef("foo").compare(StringRef("fop")), 0); EXPECT_LT(StringRef("foo").compare(StringRef("fop")), 0);
EXPECT_EQ(1, StringRef("foo").compare(StringRef("fo"))); EXPECT_GT(StringRef("foo").compare(StringRef("fo")), 0);
EXPECT_EQ(-1, StringRef("fo").compare(StringRef("foo"))); EXPECT_LT(StringRef("fo").compare(StringRef("foo")), 0);
CheckOp<std::equal_to>(); CheckOp<std::equal_to>();
CheckOp<std::not_equal_to>(); CheckOp<std::not_equal_to>();
CheckOp<std::less>(); CheckOp<std::less>();