| 146 | // ============================================================================ |
| 147 | |
| 148 | int run_all(const RunOptions& opts) { |
| 149 | const auto& entries = get_entries(); |
| 150 | |
| 151 | int passed = 0; |
| 152 | int failed = 0; |
| 153 | int skipped = 0; |
| 154 | |
| 155 | for (const auto& entry : entries) { |
| 156 | // Skip if test doesn't match filter |
| 157 | if (!opts.test_filter.empty()) { |
| 158 | if (fl::string(entry.name).find(opts.test_filter) == fl::string::npos) { |
| 159 | continue; |
| 160 | } |
| 161 | } |
| 162 | |
| 163 | // Skip if file doesn't match file filter (for .hpp detector files) |
| 164 | if (const char* file_filter = fl::getenv("FL_TEST_FILE_FILTER")) { |
| 165 | // Only run tests from the specified file (e.g., "backbeat.hpp") |
| 166 | if (fl::string(entry.file).find(file_filter) == fl::string::npos) { |
| 167 | continue; |
| 168 | } |
| 169 | } |
| 170 | |
| 171 | // Skip if decorator says to skip |
| 172 | if (entry.skip) { |
| 173 | skipped++; |
| 174 | if (opts.show_success) { |
| 175 | fl::cout << "SKIP: " << entry.name << " (" << entry.file << ":" << entry.line << ")" |
| 176 | << fl::endl; |
| 177 | } |
| 178 | continue; |
| 179 | } |
| 180 | |
| 181 | // Run test with SUBCASE support |
| 182 | bool test_passed = true; |
| 183 | SubcaseCtx ctx; |
| 184 | auto t_start = fl::chrono::steady_clock::now(); |
| 185 | fl::vector<fl::string> all_failures; |
| 186 | |
| 187 | do { |
| 188 | ctx.depth = 0; |
| 189 | ctx.needs_rerun = false; |
| 190 | |
| 191 | // Reset seen counters for this iteration |
| 192 | for (auto& node : ctx.path) { |
| 193 | node.seen = 0; |
| 194 | } |
| 195 | |
| 196 | _fl_get_subcase_ctx() = &ctx; |
| 197 | |
| 198 | TestState test_state; |
| 199 | _fl_get_test_state() = &test_state; |
| 200 | |
| 201 | // Run the test function |
| 202 | entry.func(); |
| 203 | |
| 204 | if (test_state.checks_failed > 0 || test_state.requires_failed > 0) { |
| 205 | test_passed = false; |