1 #pragma once 2 3 #include <cstdint> 4 #include <functional> 5 #include <iostream> 6 #include <string> 7 #include <utility> 8 #include <vector> 9 10 #include <helpers/assertions.hpp> 11 #include <helpers/path_helper.hpp> 12 //#include <helpers/temporary_directory.hpp> 13 //#include <helpers/temporary_file.hpp> 14 #include <helpers/timing.hpp> 15 #include <helpers/xml_helper.hpp> 16 17 struct test_status 18 { 19 std::size_t tests_run = 0; 20 std::size_t tests_failed = 0; 21 std::size_t tests_passed = 0; 22 std::vector<std::string> failures; 23 }; 24 25 std::string build_name(const std::string &pretty, const std::string &method); 26 27 #define register_test(test) register_test_internal([this]() { test(); }, build_name(__FUNCTION__, #test)); 28 29 class test_suite 30 { 31 public: 32 static test_status go(); 33 34 protected: register_test_internal(std::function<void ()> t,const std::string & function)35 static void register_test_internal(std::function<void()> t, const std::string &function) 36 { 37 tests().push_back(std::make_pair(t, function)); 38 } 39 40 private: 41 static std::vector<std::pair<std::function<void(void)>, std::string>> &tests(); 42 }; 43