#ifndef arc__validate__test_hxx_ #define arc__validate__test_hxx_ #include #include #include #include #include #include #include #define ARC_VALIDATE_DEFINE_TEST_3(file, line, name) \ static void test_func_##line(); \ static ::arc::validate::test_t test_##line(file, line, name, test_func_##line); \ static void test_func_##line() #define ARC_VALIDATE_DEFINE_TEST_2(file, line, name) ARC_VALIDATE_DEFINE_TEST_3(file, line, name) #ifndef ARC_VALIDATE_UNPREFIXED_MACROS # define ARC_VALIDATE_DEFINE_TEST(name) ARC_VALIDATE_DEFINE_TEST_2(__FILE__, __LINE__, #name) #else # define DEFINE_TEST(name) ARC_VALIDATE_DEFINE_TEST_2(__FILE__, __LINE__, #name) #endif namespace arc::validate { /// Represents a single test case. /// class LIBARC_VALIDATE_SYMEXPORT test_t { public: test_t(std::string, int, std::string, std::function); test_t(test_t const&) = delete; test_t(test_t&&) = delete; ~test_t() noexcept; std::string const& file() const; int line() const; std::string const& name() const; std::function const& function() const; test_t& operator=(test_t const&) = delete; test_t& operator=(test_t&&) = delete; static std::vector get_tests(); static std::vector get_tests(std::set const&, std::set const&); private: std::string file_; int line_; std::string name_; std::function function_; /// Holds a map of all registered tests. /// static std::map tests_; }; } // namespace arc::validate #endif