aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFergus Henderson <fergus@google.com>2024-04-30 07:15:22 -0700
committerCopybara-Service <copybara-worker@google.com>2024-04-30 07:16:25 -0700
commit0941ce7fd95104ba5f4678c41802a3229db1d5eb (patch)
tree05ef416efec1e18857e39d9a9d204cc0bb2bd590
parentf638e34270be76d15decb08f0e5d48b6f1f1b2c8 (diff)
downloadabseil-cpp-0941ce7fd95104ba5f4678c41802a3229db1d5eb.tar.gz
Enable Cord tests with Crc.
PiperOrigin-RevId: 629403229 Change-Id: I24762df161f8a0ea41e59765ec68273f8607166b
-rw-r--r--absl/strings/cord_test.cc28
1 files changed, 13 insertions, 15 deletions
diff --git a/absl/strings/cord_test.cc b/absl/strings/cord_test.cc
index ad96aafa..c4a7288a 100644
--- a/absl/strings/cord_test.cc
+++ b/absl/strings/cord_test.cc
@@ -243,12 +243,14 @@ class CordTestPeer {
ABSL_NAMESPACE_END
} // namespace absl
-// The CordTest fixture runs all tests with and without Cord Btree enabled,
-// and with our without expected CRCs being set on the subject Cords.
-class CordTest : public testing::TestWithParam<int> {
+
+
+// The CordTest fixture runs all tests with and without expected CRCs being set
+// on the subject Cords.
+class CordTest : public testing::TestWithParam<bool /*useCrc*/> {
public:
- // Returns true if test is running with btree enabled.
- bool UseCrc() const { return GetParam() == 2 || GetParam() == 3; }
+ // Returns true if test is running with Crc enabled.
+ bool UseCrc() const { return GetParam(); }
void MaybeHarden(absl::Cord& c) {
if (UseCrc()) {
c.SetExpectedChecksum(1);
@@ -260,20 +262,16 @@ class CordTest : public testing::TestWithParam<int> {
}
// Returns human readable string representation of the test parameter.
- static std::string ToString(testing::TestParamInfo<int> param) {
- switch (param.param) {
- case 0:
- return "Btree";
- case 1:
- return "BtreeHardened";
- default:
- assert(false);
- return "???";
+ static std::string ToString(testing::TestParamInfo<bool> useCrc) {
+ if (useCrc.param) {
+ return "BtreeHardened";
+ } else {
+ return "Btree";
}
}
};
-INSTANTIATE_TEST_SUITE_P(WithParam, CordTest, testing::Values(0, 1),
+INSTANTIATE_TEST_SUITE_P(WithParam, CordTest, testing::Bool(),
CordTest::ToString);
TEST(CordRepFlat, AllFlatCapacities) {