| 122 | } |
| 123 | |
| 124 | void OnTestEnd(const ::testing::TestInfo& testInfo) override { |
| 125 | auto ts = std::chrono::duration_cast<std::chrono::duration<double>>( |
| 126 | std::chrono::system_clock::now().time_since_epoch()); |
| 127 | |
| 128 | std::string_view status = "good"; |
| 129 | if (testInfo.result()->Failed()) { |
| 130 | status = "fail"; |
| 131 | } else if (testInfo.result()->Skipped()) { |
| 132 | status = "skipped"; |
| 133 | } |
| 134 | |
| 135 | std::ostringstream messages; |
| 136 | std::unordered_map<std::string, double> properties; |
| 137 | |
| 138 | { |
| 139 | if (testInfo.value_param()) { |
| 140 | messages << "Value param:\n " << testInfo.value_param() << "\n"; |
| 141 | } |
| 142 | |
| 143 | if (testInfo.type_param()) { |
| 144 | messages << "Type param:\n " << testInfo.type_param() << "\n"; |
| 145 | } |
| 146 | |
| 147 | std::string_view sep; |
| 148 | for (int i = 0; i < testInfo.result()->total_part_count(); ++i) { |
| 149 | auto part = testInfo.result()->GetTestPartResult(i); |
| 150 | if (part.failed()) { |
| 151 | messages << sep; |
| 152 | if (part.file_name()) { |
| 153 | messages << StripRoot(part.file_name()) << ":" << part.line_number() << ":\n"; |
| 154 | } |
| 155 | messages << part.message(); |
| 156 | messages << "\n"; |
| 157 | sep = "\n"; |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | for (int i = 0; i < testInfo.result()->test_property_count(); ++i) { |
| 162 | auto& property = testInfo.result()->GetTestProperty(i); |
| 163 | |
| 164 | double value; |
| 165 | |
| 166 | try { |
| 167 | value = std::stod(property.value()); |
| 168 | } catch (std::invalid_argument&) { |
| 169 | messages |
| 170 | << sep |
| 171 | << "Arcadia CI only supports numeric properties, property " |
| 172 | << property.key() << "=" << EscapeJson(property.value()) << " is not a number\n"; |
| 173 | std::cerr |
| 174 | << "Arcadia CI only supports numeric properties, property " |
| 175 | << property.key() << "=" << EscapeJson(property.value()) << " is not a number\n" |
| 176 | << std::flush; |
| 177 | status = "fail"; |
| 178 | sep = "\n"; |
| 179 | continue; |
| 180 | } catch (std::out_of_range&) { |
| 181 | messages |
nothing calls this directly
no test coverage detected