| 114 | |
| 115 | template <typename F> |
| 116 | void test(const std::string &name, F f) { |
| 117 | stack.push_back(name); |
| 118 | if (!should_run()) { |
| 119 | stack.pop_back(); |
| 120 | return; |
| 121 | } |
| 122 | |
| 123 | ++tests; |
| 124 | out << indent() << name << "\n"; |
| 125 | |
| 126 | int before_failures = failures; |
| 127 | int before_assertions = assertions; |
| 128 | |
| 129 | run_with_exceptions([&] { f(*this); }, "test"); |
| 130 | |
| 131 | int new_failures = failures - before_failures; |
| 132 | int new_assertions = assertions - before_assertions; |
| 133 | |
| 134 | print_result(name, new_failures, new_assertions); |
| 135 | |
| 136 | stack.pop_back(); |
| 137 | } |
| 138 | |
| 139 | template <typename F> |
| 140 | void test(F f) { |