32class ItBase :
public Runnable {
34 std::string description;
35 std::list<Result> results;
44 explicit ItBase(std::source_location location) noexcept : Runnable(location) {}
51 explicit ItBase(std::source_location location,
const char* description) noexcept
52 : Runnable(location), description(description) {}
64 [[nodiscard]] std::string
get_description() const noexcept {
return description; }
71 this->description = description;
86 template <Util::is_not_functional T>
87 ExpectationValue<T> expect(T value, std::source_location location = std::source_location::current());
98 template <Util::is_functional T>
99 ExpectationFunc<T> expect(T block, std::source_location location = std::source_location::current());
110 template <
typename T>
112 std::source_location location = std::source_location::current());
123 template <
typename T>
133 std::source_location location = std::source_location::current());
135 void add_result(
const Result& result) { results.push_back(result); }
136 std::list<Result>& get_results() noexcept {
return results; }
137 [[nodiscard]]
const std::list<Result>& get_results() const noexcept {
return results; }
138 void clear_results() noexcept { results.clear(); }
140 [[nodiscard]] Result get_result()
const override {
141 auto default_result = Result::success(this->get_location());
142 if (results.empty()) {
143 return default_result;
146 return std::accumulate(results.begin(), results.end(), default_result, &Result::reduce);
ItBase(std::source_location location, const char *description) noexcept
Create an BaseIt with an explicit description.
Definition it_base.hpp:51
ItBase(std::source_location location) noexcept
Create an BaseIt without an explicit description.
Definition it_base.hpp:44