#pragma once #include #include #include #include #include #include #include #include //#include //#include #include #include struct test_status { std::size_t tests_run = 0; std::size_t tests_failed = 0; std::size_t tests_passed = 0; std::vector failures; }; inline std::string build_name(const std::string &pretty, const std::string &method) { return pretty.substr(0, pretty.find("::") + 2) + method; } #define register_test(test) register_test_internal([this]() { test(); }, build_name(__FUNCTION__, #test)); class test_suite { public: static test_status go(); protected: static void register_test_internal(std::function t, const std::string &function) { tests().push_back(std::make_pair(t, function)); } private: static std::vector, std::string>> &tests(); };