| 757 | } |
| 758 | |
| 759 | std::vector<std::string> select_tests_to_run(const std::vector<std::string> &selected_test_cases, |
| 760 | const std::map<std::string, test_case> &test_function) { |
| 761 | std::vector<std::string> test_cases; |
| 762 | std::vector<std::string> error_test_cases; |
| 763 | if (selected_test_cases.empty()) { |
| 764 | for (auto &test : test_function) { |
| 765 | std::string name; |
| 766 | test_case func; |
| 767 | tie(name, func) = test; |
| 768 | test_cases.emplace_back(name); |
| 769 | } |
| 770 | } else { |
| 771 | for (auto &name : selected_test_cases) { |
| 772 | if (test_function.count(name)) |
| 773 | test_cases.emplace_back(name); |
| 774 | else |
| 775 | error_test_cases.emplace_back(name); |
| 776 | } |
| 777 | if (!error_test_cases.empty()) { |
| 778 | std::cerr << "Invalid arguments. The following test cases are unknown: "; |
| 779 | for (auto &name : error_test_cases) |
| 780 | std::cerr << "\t" << name << std::endl; |
| 781 | exit(1); |
| 782 | } |
| 783 | } |
| 784 | return test_cases; |
| 785 | } |