| 177 | |
| 178 | |
| 179 | std::string test_compare(const Events::Status &lhs, const Events::Status &rhs, const bool expect) |
| 180 | { |
| 181 | bool r = (lhs.major == rhs.major |
| 182 | && lhs.minor == rhs.minor |
| 183 | && lhs.message == rhs.message); |
| 184 | if (r != expect) |
| 185 | { |
| 186 | std::stringstream err; |
| 187 | err << "StatusEvent compare check FAIL: " |
| 188 | << "{" << lhs << "} == {" << rhs << "} returned " |
| 189 | << (r ? "true" : "false") |
| 190 | << " - expected: " |
| 191 | << (expect ? "true" : "false"); |
| 192 | return err.str(); |
| 193 | } |
| 194 | |
| 195 | r = (lhs.major != rhs.major |
| 196 | || lhs.minor != rhs.minor |
| 197 | || lhs.message != rhs.message); |
| 198 | if (r == expect) |
| 199 | { |
| 200 | std::stringstream err; |
| 201 | err << "Negative StatusEvent compare check FAIL: " |
| 202 | << "{" << lhs << "} == {" << rhs << "} returned " |
| 203 | << (r ? "true" : "false") |
| 204 | << " - expected: " |
| 205 | << (expect ? "true" : "false"); |
| 206 | return err.str(); |
| 207 | } |
| 208 | return ""; |
| 209 | } |
| 210 | |
| 211 | |
| 212 | TEST(StatusEvent, compare_eq_1) |