| 91 | } |
| 92 | |
| 93 | ::testing::AssertionResult validate_iterator( |
| 94 | KeyValueDB::WholeSpaceIterator it, |
| 95 | string expected_prefix, |
| 96 | const string &expected_key, |
| 97 | const string &expected_value) { |
| 98 | if (!it->valid()) { |
| 99 | return ::testing::AssertionFailure() |
| 100 | << __func__ |
| 101 | << " iterator not valid"; |
| 102 | } |
| 103 | |
| 104 | if (!it->raw_key_is_prefixed(expected_prefix)) { |
| 105 | return ::testing::AssertionFailure() |
| 106 | << __func__ |
| 107 | << " expected raw_key_is_prefixed() == TRUE" |
| 108 | << " got FALSE"; |
| 109 | } |
| 110 | |
| 111 | if (it->raw_key_is_prefixed("??__SomeUnexpectedValue__??")) { |
| 112 | return ::testing::AssertionFailure() |
| 113 | << __func__ |
| 114 | << " expected raw_key_is_prefixed() == FALSE" |
| 115 | << " got TRUE"; |
| 116 | } |
| 117 | |
| 118 | pair<string,string> key = it->raw_key(); |
| 119 | |
| 120 | if (expected_prefix != key.first) { |
| 121 | return ::testing::AssertionFailure() |
| 122 | << __func__ |
| 123 | << " expected prefix '" << expected_prefix << "'" |
| 124 | << " got prefix '" << key.first << "'"; |
| 125 | } |
| 126 | |
| 127 | if (expected_key != it->key()) { |
| 128 | return ::testing::AssertionFailure() |
| 129 | << __func__ |
| 130 | << " expected key '" << expected_key << "'" |
| 131 | << " got key '" << it->key() << "'"; |
| 132 | } |
| 133 | |
| 134 | if (it->key() != key.second) { |
| 135 | return ::testing::AssertionFailure() |
| 136 | << __func__ |
| 137 | << " key '" << it->key() << "'" |
| 138 | << " does not match" |
| 139 | << " pair key '" << key.second << "'"; |
| 140 | } |
| 141 | |
| 142 | if (_bl_to_str(it->value()) != expected_value) { |
| 143 | return ::testing::AssertionFailure() |
| 144 | << __func__ |
| 145 | << " key '(" << key.first << "," << key.second << ")''" |
| 146 | << " expected value '" << expected_value << "'" |
| 147 | << " got value '" << _bl_to_str(it->value()) << "'"; |
| 148 | } |
| 149 | |
| 150 | return ::testing::AssertionSuccess(); |
nothing calls this directly
no test coverage detected