15 #ifndef JUNIT_EXPORTER__JUNIT_EXPORTER_HPP_
16 #define JUNIT_EXPORTER__JUNIT_EXPORTER_HPP_
18 #include <boost/filesystem/path.hpp>
20 #include <pugixml.hpp>
30 std::unordered_map<std::string, TestSuite> test_suites_;
35 void write(
const boost::filesystem::path & path);
39 const auto iter = test_suites_.find(suite_name);
41 if (iter != std::end(test_suites_)) {
43 std::begin(iter->second), std::end(iter->second),
44 [&](
const auto & each_case) { return each_case.name == case_name; });
52 return std::accumulate(
53 std::cbegin(test_suites_), std::cend(test_suites_), 0,
54 [](
const auto sum,
const auto & each_suite) {
55 const auto & each_cases = std::get<1>(each_suite);
57 return sum + std::accumulate(
58 std::cbegin(each_cases), std::cend(each_cases), 0.0,
59 [](
const auto sum,
const auto & each_case) {
return sum + each_case.time; });
63 template <
typename... Ts>
69 if (not
contains(suite_name, case_name)) {
70 test_suites_[suite_name].emplace_back(
71 case_name, suite_name, std::forward<decltype(
xs)>(
xs)...);
Definition: test_suites.hpp:27
TestSuites()
Definition: test_suites.cpp:24
auto getTotalTime() const
Definition: test_suites.hpp:50
void write(const boost::filesystem::path &path)
Definition: test_suites.cpp:29
auto contains(const std::string &suite_name, const std::string &case_name) const
Definition: test_suites.hpp:37
void addTestCase(const std::string &suite_name, const std::string &case_name, Ts &&... xs)
Definition: test_suites.hpp:64
Definition: test_case.hpp:23
Definition: junit5.hpp:25
std::string string
Definition: junit5.hpp:26