X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libtest%2Fresult.hpp;h=79acbb40ede8e6bed81bfbb55966802b4454b8f8;hb=bd8a989e9f0d0c115ae771732c9199589e3043fd;hp=784ae72bbd12d7bb4e9de4f9360b56ba8a39af00;hpb=fde9567090d20b035433241720f00cfbe6e66bf2;p=awesomized%2Flibmemcached diff --git a/libtest/result.hpp b/libtest/result.hpp index 784ae72b..79acbb40 100644 --- a/libtest/result.hpp +++ b/libtest/result.hpp @@ -36,79 +36,21 @@ #pragma once -#include - -namespace libtest { - -class __test_result : public std::exception -{ -public: - __test_result(const char *file, int line, const char *func); - - int line() - { - return _line; - } - - const char* file() - { - return _file; - } - - const char* func() - { - return _func; - } - -private: - int _line; - const char* _file; - const char* _func; -}; - -class __success : public __test_result -{ -public: - __success(const char *file, int line, const char *func); - - const char* what() const throw() - { - return "SUCCESS"; - } - -private: -}; - -class __skipped : public __test_result -{ -public: - __skipped(const char *file, int line, const char *func); - - const char* what() const throw() - { - return "SKIPPED"; - } - -private: -}; - -class __failure : public __test_result -{ -public: - __failure(const char *file, int line, const char *func, const std::string&); - - const char* what() const throw() - { - return _error_message; - } - -private: - char _error_message[BUFSIZ]; -}; - - -} // namespace libtest +#include +#include +#include +#include #define _SUCCESS throw libtest::__success(LIBYATL_DEFAULT_PARAM) -#define SKIP throw libtest::__skipped(LIBYATL_DEFAULT_PARAM) -#define FAIL(__mesg) throw libtest::__failure(LIBYATL_DEFAULT_PARAM, __mesg) + +#define SKIP(...) \ +do \ +{ \ + throw libtest::__skipped(LIBYATL_DEFAULT_PARAM, __VA_ARGS__); \ +} while (0) + +#define FAIL(...) \ +do \ +{ \ + throw libtest::__failure(LIBYATL_DEFAULT_PARAM, __VA_ARGS__); \ +} while (0)