[btree_damage_visitor] Introduce a DamagedKeys matcher in the tests.

This commit is contained in:
Joe Thornber 2013-05-17 11:42:55 +01:00
parent 08b2749191
commit 38dcde0c37
2 changed files with 5 additions and 6 deletions

View File

@ -18,11 +18,6 @@ namespace persistent_data {
desc_(desc) { desc_(desc) {
} }
// FIXME: Write a matcher instead. Does _not_ compare the descriptions
bool operator ==(damage const &rhs) const {
return (lost_keys_ == rhs.lost_keys_);
}
range<uint64_t> lost_keys_; range<uint64_t> lost_keys_;
std::string desc_; std::string desc_;
}; };

View File

@ -225,6 +225,10 @@ namespace {
//---------------------------------- //----------------------------------
MATCHER_P(DamagedKeys, keys, "") {
return arg.lost_keys_ == keys;
}
class value_visitor_mock { class value_visitor_mock {
public: public:
MOCK_METHOD1(visit, void(thing const &)); MOCK_METHOD1(visit, void(thing const &));
@ -270,7 +274,7 @@ namespace {
} }
void expect_damage(unsigned level, range<uint64_t> keys) { void expect_damage(unsigned level, range<uint64_t> keys) {
EXPECT_CALL(damage_visitor_, visit(Eq(damage(keys, "foo")))).Times(1); EXPECT_CALL(damage_visitor_, visit(DamagedKeys(keys))).Times(1);
} }
//-------------------------------- //--------------------------------