| 26 | namespace unittest { |
| 27 | |
| 28 | std::string test_empty(const Events::Log &ev, const bool expect) |
| 29 | { |
| 30 | bool r = ev.empty(); |
| 31 | if (expect != r) |
| 32 | { |
| 33 | return std::string("test_empty(): ") |
| 34 | + "ev.empty() = " + (r ? "true" : "false") |
| 35 | + " [expected: " + (expect ? "true" : "false") + "]"; |
| 36 | } |
| 37 | |
| 38 | r = (LogGroup::UNDEFINED == ev.group |
| 39 | && LogCategory::UNDEFINED == ev.category |
| 40 | && ev.message.empty()); |
| 41 | if (expect != r) |
| 42 | { |
| 43 | return std::string("test_empty() - Member check: ") |
| 44 | + "(" + std::to_string((unsigned)ev.group) + ", " |
| 45 | + std::to_string((unsigned)ev.category) + "', " |
| 46 | + "'" + ev.message + "', " |
| 47 | + "message.size=" + std::to_string(ev.message.size()) + ") ..." |
| 48 | + " is " + (r ? "EMPTY" : "NON-EMPTY") |
| 49 | + " [expected: " + (expect ? "EMPTY" : "NON-EMPTY") + "]"; |
| 50 | } |
| 51 | return ""; |
| 52 | }; |
| 53 | |
| 54 | |
| 55 | TEST(LogEvent, init_empty) |