Improve StringRef test

This commit is contained in:
Victor Zverovich 2015-02-17 06:45:45 -08:00
parent 6a52fc164a
commit 5b0a9bbe85

View File

@ -699,8 +699,11 @@ void test_count_digits() {
} }
TEST(UtilTest, StringRef) { TEST(UtilTest, StringRef) {
char space[100] = "some string"; // Test that StringRef::size() returns string length, not buffer size.
EXPECT_EQ(std::strlen(space), StringRef(space).size()); enum {BUFFER_SIZE = 100};
char str[BUFFER_SIZE] = "some string";
EXPECT_EQ(std::strlen(str), StringRef(str).size());
EXPECT_LT(std::strlen(str), BUFFER_SIZE);
} }
TEST(UtilTest, CountDigits) { TEST(UtilTest, CountDigits) {