diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2021-02-19 14:35:55 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2021-02-19 14:35:55 +0000 |
commit | e5c1ec987937d03677eeab3ff97e13f7be62b1f4 (patch) | |
tree | 5fa39ffb9d87fc896c1d5a95fbe1109b193898b6 /persistence | |
parent | b206dd0a2b7610618079162cff55c9ed68a81920 (diff) |
Use a helper for bool -> vespalib::Trinary
Diffstat (limited to 'persistence')
-rw-r--r-- | persistence/src/tests/spi/clusterstatetest.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/persistence/src/tests/spi/clusterstatetest.cpp b/persistence/src/tests/spi/clusterstatetest.cpp index 17c4c3dc635..51131f5b187 100644 --- a/persistence/src/tests/spi/clusterstatetest.cpp +++ b/persistence/src/tests/spi/clusterstatetest.cpp @@ -141,6 +141,10 @@ lib::Distribution::DistributionConfig getCfg(uint16_t redundancy, uint16_t ready return config; } +Trinary toTrinary(bool v) { + return v ? Trinary::True : Trinary::False; +} + } TEST(ClusterStateTest, testReady) @@ -155,35 +159,35 @@ TEST(ClusterStateTest, testReady) { lib::Distribution d(getCfg(3, 0)); ClusterState state(s, 0, d); - EXPECT_EQ(Trinary::False, state.shouldBeReady(b)); + EXPECT_EQ(toTrinary(false), state.shouldBeReady(b)); } // Only node 0 with 1 ready copy. for (uint32_t i = 0; i < 3; ++i) { lib::Distribution d(getCfg(3, 1)); ClusterState state(s, i, d); - EXPECT_EQ((i == 0) ? Trinary::True : Trinary::False, state.shouldBeReady(b)); + EXPECT_EQ(toTrinary(i == 0), state.shouldBeReady(b)); } // All of them with 3 ready copies for (uint32_t i = 0; i < 3; ++i) { lib::Distribution d(getCfg(3, 3)); ClusterState state(s, i, d); - EXPECT_EQ(Trinary::True, state.shouldBeReady(b)); + EXPECT_EQ(toTrinary(true), state.shouldBeReady(b)); } // Node 0 and node 1 with 2 ready copies. for (uint32_t i = 0; i < 3; ++i) { lib::Distribution d(getCfg(3, 2)); ClusterState state(s, i, d); - EXPECT_EQ((i == 0 || i == 2) ? Trinary::True : Trinary::False, state.shouldBeReady(b)); + EXPECT_EQ(toTrinary(i == 0 || i == 2), state.shouldBeReady(b)); } // All of them with 3 ready copies for (uint32_t i = 0; i < 3; ++i) { lib::Distribution d(getCfg(3, 3)); ClusterState state(s, i, d); - EXPECT_EQ(Trinary::True, state.shouldBeReady(b)); + EXPECT_EQ(toTrinary(true), state.shouldBeReady(b)); } lib::ClusterState s2("version:1 storage:3 .0.s:d distributor:3"); @@ -192,13 +196,13 @@ TEST(ClusterStateTest, testReady) for (uint32_t i = 0; i < 3; ++i) { lib::Distribution d(getCfg(3, 2)); ClusterState state(s2, i, d); - EXPECT_EQ((i == 1 || i == 2) ? Trinary::True : Trinary::False, state.shouldBeReady(b)); + EXPECT_EQ(toTrinary(i == 1 || i == 2), state.shouldBeReady(b)); } for (uint32_t i = 0; i < 3; ++i) { lib::Distribution d(getCfg(3, 1)); ClusterState state(s2, i, d); - EXPECT_EQ((i == 2) ? Trinary::True : Trinary::False, state.shouldBeReady(b)); + EXPECT_EQ(toTrinary(i == 2), state.shouldBeReady(b)); } } |