| 146 | } // namespace std |
| 147 | |
| 148 | class utils { |
| 149 | public: |
| 150 | template <typename T> |
| 151 | static T get_key(std::size_t counter); |
| 152 | |
| 153 | template <typename T> |
| 154 | static T get_value(std::size_t counter); |
| 155 | |
| 156 | template <typename HMap> |
| 157 | static HMap get_filled_hash_map(std::size_t nb_elements); |
| 158 | |
| 159 | /** |
| 160 | * The ordered_map equality operator only compares the m_values structure as |
| 161 | * it is sufficient for ensuring equality. This method do a more extensive |
| 162 | * comparison to ensure that the internal state of the map is coherent. |
| 163 | */ |
| 164 | template <typename HMap> |
| 165 | static bool test_is_equal(const HMap& lhs, const HMap& rhs) { |
| 166 | if (lhs != rhs) { |
| 167 | return false; |
| 168 | } |
| 169 | |
| 170 | if(lhs.size() != rhs.size()) { |
| 171 | return false; |
| 172 | } |
| 173 | |
| 174 | for (const auto& val_lhs : lhs) { |
| 175 | auto it_rhs = rhs.find(val_lhs.first); |
| 176 | if (it_rhs == rhs.end()) { |
| 177 | return false; |
| 178 | } |
| 179 | |
| 180 | if (val_lhs.first != it_rhs->first) { |
| 181 | return false; |
| 182 | } |
| 183 | |
| 184 | if (val_lhs.second != it_rhs->second) { |
| 185 | return false; |
| 186 | } |
| 187 | } |
| 188 | |
| 189 | for (const auto& val_rhs : rhs) { |
| 190 | auto it_lhs = lhs.find(val_rhs.first); |
| 191 | if (it_lhs == lhs.end()) { |
| 192 | return false; |
| 193 | } |
| 194 | |
| 195 | if (it_lhs->first != val_rhs.first) { |
| 196 | return false; |
| 197 | } |
| 198 | |
| 199 | if (it_lhs->second != val_rhs.second) { |
| 200 | return false; |
| 201 | } |
| 202 | } |
| 203 | |
| 204 | return true; |
| 205 | } |
nothing calls this directly
no outgoing calls
no test coverage detected