Don't assume that char_traits::compare returns +/-1 (#225)

This commit is contained in:
vitaut 2015-11-10 06:40:20 -08:00
parent 8b86a74ad5
commit aa741bafe6

View File

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