#pragma once #include #include #include #include #include #include "../common.hpp" namespace saw { namespace test { class test_runner; class test_case { private: std::string file; uint line; std::string description; bool matched_filter; test_case* next; test_case** prev; friend class test_runner; public: test_case(const std::string& file_, uint line_, const std::string& description_); ~test_case(); virtual void run() = 0; }; } } #define SAW_TEST(description) \ class SAW_UNIQUE_NAME(test_case) : public ::saw::test::test_case { \ public: \ SAW_UNIQUE_NAME(test_case)(): ::saw::test::test_case(__FILE__,__LINE__,description) {} \ void run() override; \ }SAW_UNIQUE_NAME(test_case_); \ void SAW_UNIQUE_NAME(test_case)::run() #define SAW_EXPECT(expr, msg_split) \ if( ! (expr) ){ \ auto msg = msg_split; \ throw std::runtime_error{std::string{msg}};\ } #define SAW_EOV_EXPECT(eov_expr, msg_split) \ if( (eov_expr.is_error()) ){ \ auto& err = eov_expr.get_error(); \ std::stringstream sstr; \ sstr< 0u){ \ sstr<<" [Message] "<