summaryrefslogtreecommitdiff
path: root/absl/strings
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2023-03-09 11:38:28 -0800
committerGravatar Copybara-Service <copybara-worker@google.com>2023-03-09 11:39:14 -0800
commit761f04dca7fd6d27e620f09b1b170c3c5c1b3180 (patch)
tree2c0c06b8e7ea93937337e4bdb9de51cff643040a /absl/strings
parent5df3ac3b29927d4d64faf81fcc88ec25b076af9d (diff)
Improve readability of ::testing::ElementsAre and ::testing::Le in unit tests assertions.
PiperOrigin-RevId: 515396682 Change-Id: I1b07d94611323569b199e1f4d03c7c49147c6bfb
Diffstat (limited to 'absl/strings')
-rw-r--r--absl/strings/cord_test.cc14
1 files changed, 8 insertions, 6 deletions
diff --git a/absl/strings/cord_test.cc b/absl/strings/cord_test.cc
index 5603e94c..3fe3967f 100644
--- a/absl/strings/cord_test.cc
+++ b/absl/strings/cord_test.cc
@@ -58,6 +58,8 @@ using absl::cord_internal::CordRepSubstring;
using absl::cord_internal::CordzUpdateTracker;
using absl::cord_internal::kFlatOverhead;
using absl::cord_internal::kMaxFlatLength;
+using ::testing::ElementsAre;
+using ::testing::Le;
static std::string RandomLowercaseString(RandomEngine* rng);
static std::string RandomLowercaseString(RandomEngine* rng, size_t length);
@@ -618,7 +620,7 @@ TEST_P(CordTest, AppendEmptyBufferToTree) {
TEST_P(CordTest, AppendSmallBuffer) {
absl::Cord cord;
absl::CordBuffer buffer = absl::CordBuffer::CreateWithDefaultLimit(3);
- ASSERT_THAT(buffer.capacity(), ::testing::Le(15));
+ ASSERT_THAT(buffer.capacity(), Le(15));
memcpy(buffer.data(), "Abc", 3);
buffer.SetLength(3);
cord.Append(std::move(buffer));
@@ -632,7 +634,7 @@ TEST_P(CordTest, AppendSmallBuffer) {
EXPECT_EQ(buffer.length(), 0); // NOLINT
EXPECT_GT(buffer.capacity(), 0); // NOLINT
- EXPECT_THAT(cord.Chunks(), ::testing::ElementsAre("Abcdefgh"));
+ EXPECT_THAT(cord.Chunks(), ElementsAre("Abcdefgh"));
}
TEST_P(CordTest, AppendAndPrependBufferArePrecise) {
@@ -671,7 +673,7 @@ TEST_P(CordTest, AppendAndPrependBufferArePrecise) {
TEST_P(CordTest, PrependSmallBuffer) {
absl::Cord cord;
absl::CordBuffer buffer = absl::CordBuffer::CreateWithDefaultLimit(3);
- ASSERT_THAT(buffer.capacity(), ::testing::Le(15));
+ ASSERT_THAT(buffer.capacity(), Le(15));
memcpy(buffer.data(), "Abc", 3);
buffer.SetLength(3);
cord.Prepend(std::move(buffer));
@@ -685,7 +687,7 @@ TEST_P(CordTest, PrependSmallBuffer) {
EXPECT_EQ(buffer.length(), 0); // NOLINT
EXPECT_GT(buffer.capacity(), 0); // NOLINT
- EXPECT_THAT(cord.Chunks(), ::testing::ElementsAre("defghAbc"));
+ EXPECT_THAT(cord.Chunks(), ElementsAre("defghAbc"));
}
TEST_P(CordTest, AppendLargeBuffer) {
@@ -707,7 +709,7 @@ TEST_P(CordTest, AppendLargeBuffer) {
EXPECT_EQ(buffer.length(), 0); // NOLINT
EXPECT_GT(buffer.capacity(), 0); // NOLINT
- EXPECT_THAT(cord.Chunks(), ::testing::ElementsAre(s1, s2));
+ EXPECT_THAT(cord.Chunks(), ElementsAre(s1, s2));
}
TEST_P(CordTest, PrependLargeBuffer) {
@@ -729,7 +731,7 @@ TEST_P(CordTest, PrependLargeBuffer) {
EXPECT_EQ(buffer.length(), 0); // NOLINT
EXPECT_GT(buffer.capacity(), 0); // NOLINT
- EXPECT_THAT(cord.Chunks(), ::testing::ElementsAre(s2, s1));
+ EXPECT_THAT(cord.Chunks(), ElementsAre(s2, s1));
}
class CordAppendBufferTest : public testing::TestWithParam<bool> {