Skip to content

Commit

Permalink
Merge 9fd2051 into 11ca8b1
Browse files Browse the repository at this point in the history
  • Loading branch information
srz-zumix committed Oct 16, 2018
2 parents 11ca8b1 + 9fd2051 commit ae4529e
Show file tree
Hide file tree
Showing 31 changed files with 1,091 additions and 363 deletions.
4 changes: 2 additions & 2 deletions include/impl/iutest_core.ipp
Expand Up @@ -6,7 +6,7 @@
*
* @author t.shirayanagi
* @par copyright
* Copyright (C) 2011-2017, Takazumi Shirayanagi\n
* Copyright (C) 2011-2018, Takazumi Shirayanagi\n
* This software is released under the new BSD License,
* see LICENSE
*/
Expand Down Expand Up @@ -138,7 +138,7 @@ IUTEST_IPP_INLINE int UnitTest::Run()
return RunImpl();
}

#if IUTEST_HAS_EXCEPTIONS && IUTEST_HAS_SEH
#if IUTEST_HAS_SEH && IUTEST_HAS_EXCEPTIONS
IUTEST_IPP_INLINE int UnitTest::RunOnMSC()
{
_EXCEPTION_POINTERS* ep = NULL;
Expand Down
4 changes: 2 additions & 2 deletions include/impl/iutest_core_impl.ipp
Expand Up @@ -211,7 +211,7 @@ IUTEST_IPP_INLINE void UnitTestImpl::InitializeImpl()
}
#endif

#if IUTEST_HAS_EXCEPTIONS && (defined(_MSC_VER) && (_MSC_VER >= 1400)) && !defined(IUTEST_OS_WINDOWS_MOBILE)
#if IUTEST_HAS_INVALID_PARAMETER_HANDLER
_set_invalid_parameter_handler(OnInvalidParameter);
#endif
}
Expand All @@ -226,7 +226,7 @@ IUTEST_IPP_INLINE void UnitTestImpl::TerminateImpl()
}
}

#if IUTEST_HAS_EXCEPTIONS && (defined(_MSC_VER) && (_MSC_VER >= 1400)) && !defined(IUTEST_OS_WINDOWS_MOBILE)
#if IUTEST_HAS_INVALID_PARAMETER_HANDLER

IUTEST_PRAGMA_CRT_SECURE_WARN_DISABLE_BEGIN()

Expand Down
17 changes: 10 additions & 7 deletions include/impl/iutest_default_printer.ipp
Expand Up @@ -79,23 +79,26 @@ IUTEST_IPP_INLINE void DefaultResultPrintListener::OnTestRecordProperty(const Te
{
detail::iuConsole::output("iutest record property:\n %s=%s\n", test_property.key(), test_property.value());
}
IUTEST_IPP_INLINE void DefaultResultPrintListener::OnTestEnd(const TestInfo& test_info)
IUTEST_IPP_INLINE void DefaultResultPrintListener::PrintTestResult(const TestInfo& test_info) const
{
if( test_info.HasFailure() )
{
detail::iuConsole::color_output(detail::iuConsole::red , "[ FAILED ] ");
detail::iuConsole::output("%s.%s", test_info.test_case_name(), test_info.test_name_with_where().c_str());
return;
}
else if( test_info.is_skipped() )
if( test_info.is_skipped() )
{
detail::iuConsole::color_output(detail::iuConsole::yellow, "[ SKIPPED ] ");
detail::iuConsole::output("%s.%s", test_info.test_case_name(), test_info.name());
return;
}
else
{
detail::iuConsole::color_output(detail::iuConsole::green , "[ OK ] ");
detail::iuConsole::output("%s.%s", test_info.test_case_name(), test_info.name());
}
detail::iuConsole::color_output(detail::iuConsole::green , "[ OK ] ");
detail::iuConsole::output("%s.%s", test_info.test_case_name(), test_info.name());
}
IUTEST_IPP_INLINE void DefaultResultPrintListener::OnTestEnd(const TestInfo& test_info)
{
PrintTestResult(test_info);
if( TestFlag::IsEnableFlag(TestFlag::PRINT_TIME) )
{
#if defined(IUTEST_NOT_SUPPORT_STOPWATCH)
Expand Down
4 changes: 2 additions & 2 deletions include/impl/iutest_info.ipp
Expand Up @@ -6,7 +6,7 @@
*
* @author t.shirayanagi
* @par copyright
* Copyright (C) 2011-2016, Takazumi Shirayanagi\n
* Copyright (C) 2011-2018, Takazumi Shirayanagi\n
* This software is released under the new BSD License,
* see LICENSE
*/
Expand Down Expand Up @@ -111,7 +111,7 @@ IUTEST_IPP_INLINE void TestInfo::RunImpl()
}
}

#if IUTEST_HAS_EXCEPTIONS && IUTEST_HAS_SEH
#if IUTEST_HAS_SEH && IUTEST_HAS_EXCEPTIONS
#if IUTEST_HAS_MINIDUMP

IUTEST_IPP_INLINE void TestInfo::MiniDump(_EXCEPTION_POINTERS* ep)
Expand Down
6 changes: 3 additions & 3 deletions include/internal/iutest_compiler.hpp
Expand Up @@ -175,7 +175,7 @@
//! inline variable
#if !defined(IUTEST_HAS_INLINE_VARIABLE)
#if defined(__clang__)
# if (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 9)) && IUTEST_HAS_CXX1Z
# if IUTEST_HAS_CXX1Z && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 9))
# define IUTEST_HAS_INLINE_VARIABLE 1
# endif
#endif
Expand Down Expand Up @@ -1099,7 +1099,7 @@
//! has __if_exists
#if !defined(IUTEST_HAS_IF_EXISTS)
# if defined(__clang__)
# if (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 5) ) && IUTEST_HAS_MS_EXTENSIONS
# if IUTEST_HAS_MS_EXTENSIONS && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 5) )
# define IUTEST_HAS_IF_EXISTS 1
# endif
# elif defined(_MSC_VER) && _MSC_VER >= 1310
Expand Down Expand Up @@ -1145,7 +1145,7 @@
# define IUTEST_HAS_MS_CXX_MODULE 0
#endif

#if defined(IUTEST_MODULE_EXPORT)
#if IUTEST_HAS_MS_CXX_MODULE
# define IUTEST_CXX_MODULE_EXPORT export
#else
# define IUTEST_CXX_MODULE_EXPORT
Expand Down
2 changes: 1 addition & 1 deletion include/internal/iutest_core_impl.hpp
Expand Up @@ -141,7 +141,7 @@ class UnitTestImpl
void TerminateImpl();

private:
#if IUTEST_HAS_EXCEPTIONS && (defined(_MSC_VER) && (_MSC_VER >= 1400)) && !defined(IUTEST_OS_WINDOWS_MOBILE)
#if IUTEST_HAS_INVALID_PARAMETER_HANDLER

IUTEST_PRAGMA_CRT_SECURE_WARN_DISABLE_BEGIN()

Expand Down
4 changes: 2 additions & 2 deletions include/internal/iutest_exception.hpp
Expand Up @@ -6,7 +6,7 @@
*
* @author t.shirayanagi
* @par copyright
* Copyright (C) 2011-2016, Takazumi Shirayanagi\n
* Copyright (C) 2011-2018, Takazumi Shirayanagi\n
* This software is released under the new BSD License,
* see LICENSE
*/
Expand Down Expand Up @@ -48,7 +48,7 @@ inline ::std::string FormatCxxException(const char* description)
} // end of namespace detail
} // end of namespace iutest

#if IUTEST_HAS_EXCEPTIONS && IUTEST_HAS_SEH
#if IUTEST_HAS_SEH && IUTEST_HAS_EXCEPTIONS
#include <iomanip>

namespace iutest {
Expand Down
11 changes: 11 additions & 0 deletions include/internal/iutest_stdlib.hpp
Expand Up @@ -668,6 +668,17 @@ using tuples::get;
# define IUTEST_HAS_STRSTREAM 0
#endif

//! _set_invalid_parameter_handler が使用可能かどうか
#if !defined(IUTEST_HAS_INVALID_PARAMETER_HANDLER)
# if IUTEST_HAS_EXCEPTIONS && (defined(_MSC_VER) && (_MSC_VER >= 1400)) && !defined(IUTEST_OS_WINDOWS_MOBILE)
# define IUTEST_HAS_INVALID_PARAMETER_HANDLER 1
# endif
#endif

#if !defined(IUTEST_HAS_INVALID_PARAMETER_HANDLER)
# define IUTEST_HAS_INVALID_PARAMETER_HANDLER 0
#endif

namespace iutest {
namespace detail
{
Expand Down
4 changes: 2 additions & 2 deletions include/internal/iutest_string.hpp
Expand Up @@ -155,8 +155,8 @@ inline int iu_vsnprintf(char* dst, size_t size, const char* format, va_list va)
*/
inline int iu_vsnprintf(char* dst, size_t size, const char* format, va_list va)
{
#if defined(__CYGWIN__) && defined(__STRICT_ANSI__) \
&& (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) && (__cplusplus >= 201103L)
#if defined(__CYGWIN__) \
&& (defined(__STRICT_ANSI__) && (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) && (__cplusplus >= 201103L))
return wrapper::iu_vsnprintf(dst, size, format, va);
#elif (defined(__MINGW__) || defined(__MINGW32__) || defined(__MINGW64__)) && defined(__STRICT_ANSI__)
return wrapper::iu_vsnprintf(dst, size, format, va);
Expand Down
6 changes: 3 additions & 3 deletions include/iutest_assertion.hpp
Expand Up @@ -6,7 +6,7 @@
*
* @author t.shirayanagi
* @par copyright
* Copyright (C) 2011-2017, Takazumi Shirayanagi\n
* Copyright (C) 2011-2018, Takazumi Shirayanagi\n
* This software is released under the new BSD License,
* see LICENSE
*/
Expand Down Expand Up @@ -475,8 +475,8 @@ IIUT_DECL_COMPARE_HELPER_(LT, < )
IIUT_DECL_COMPARE_HELPER_(GE, >=)
IIUT_DECL_COMPARE_HELPER_(GT, > )

#undef DECL_COMPARE_HELPER_I_
#undef DECL_COMPARE_HELPER_
#undef IIUT_DECL_COMPARE_HELPER_I_
#undef IIUT_DECL_COMPARE_HELPER_

/**
* @}
Expand Down
2 changes: 1 addition & 1 deletion include/iutest_config.hpp
Expand Up @@ -329,7 +329,7 @@

#if !defined(IUTEST_HAS_CATCH_SEH_EXCEPTION_ASSERTION)
//! 例外アサーションで SEH をキャッチ可能かどうか
# if IUTEST_HAS_LAMBDA_STATEMENTS && IUTEST_HAS_SEH
# if IUTEST_HAS_SEH && IUTEST_HAS_LAMBDA_STATEMENTS
# define IUTEST_HAS_CATCH_SEH_EXCEPTION_ASSERTION 1
# else
# define IUTEST_HAS_CATCH_SEH_EXCEPTION_ASSERTION 0
Expand Down
2 changes: 1 addition & 1 deletion include/iutest_core.hpp
Expand Up @@ -126,7 +126,7 @@ class UnitTest : public UnitTestImpl
int Run();

private:
#if IUTEST_HAS_EXCEPTIONS && IUTEST_HAS_SEH
#if IUTEST_HAS_SEH && IUTEST_HAS_EXCEPTIONS
int RunOnMSC();
#endif
int RunImpl();
Expand Down
2 changes: 1 addition & 1 deletion include/iutest_info.hpp
Expand Up @@ -182,7 +182,7 @@ class TestInfo
private:
void RunImpl();

#if IUTEST_HAS_EXCEPTIONS && IUTEST_HAS_SEH
#if IUTEST_HAS_SEH && IUTEST_HAS_EXCEPTIONS
#if IUTEST_HAS_MINIDUMP
void MiniDump(_EXCEPTION_POINTERS* ep);
#endif
Expand Down
42 changes: 21 additions & 21 deletions include/iutest_matcher.hpp
Expand Up @@ -84,7 +84,7 @@ inline iu_ostream& operator << (iu_ostream& os, const IMatcher& msg)
* @{
*/

#define DECL_COMPARE_MATCHER(name, op) \
#define IIUT_DECL_COMPARE_MATCHER(name, op) \
template<typename T>class IUTEST_PP_CAT(name, Matcher): public IMatcher{ \
public: explicit IUTEST_PP_CAT(name, Matcher)(const T& v) : m_expected(v) {}\
::std::string WhichIs() const IUTEST_CXX_OVERRIDE { \
Expand All @@ -98,7 +98,7 @@ inline iu_ostream& operator << (iu_ostream& os, const IMatcher& msg)
private: const T& m_expected; \
}

#define DECL_COMPARE_MATCHER2(name, op) \
#define IIUT_DECL_COMPARE_MATCHER2(name, op) \
class IUTEST_PP_CAT(Twofold, IUTEST_PP_CAT(name, Matcher)): public IMatcher{ \
public: ::std::string WhichIs() const IUTEST_CXX_OVERRIDE { return #name; } \
template<typename T, typename U>AssertionResult operator () \
Expand All @@ -112,25 +112,25 @@ inline iu_ostream& operator << (iu_ostream& os, const IMatcher& msg)
IUTEST_PRAGMA_WARN_PUSH()
IUTEST_PRAGMA_WARN_DISABLE_SIGN_COMPARE()

DECL_COMPARE_MATCHER(Ne, !=);
DECL_COMPARE_MATCHER(Le, <=);
DECL_COMPARE_MATCHER(Lt, < );
DECL_COMPARE_MATCHER(Ge, >=);
DECL_COMPARE_MATCHER(Gt, > );
IIUT_DECL_COMPARE_MATCHER(Ne, !=);
IIUT_DECL_COMPARE_MATCHER(Le, <=);
IIUT_DECL_COMPARE_MATCHER(Lt, < );
IIUT_DECL_COMPARE_MATCHER(Ge, >=);
IIUT_DECL_COMPARE_MATCHER(Gt, > );

DECL_COMPARE_MATCHER2(Eq, ==);
DECL_COMPARE_MATCHER2(Ne, !=);
DECL_COMPARE_MATCHER2(Le, <=);
DECL_COMPARE_MATCHER2(Lt, < );
DECL_COMPARE_MATCHER2(Ge, >=);
DECL_COMPARE_MATCHER2(Gt, > );
IIUT_DECL_COMPARE_MATCHER2(Eq, ==);
IIUT_DECL_COMPARE_MATCHER2(Ne, !=);
IIUT_DECL_COMPARE_MATCHER2(Le, <=);
IIUT_DECL_COMPARE_MATCHER2(Lt, < );
IIUT_DECL_COMPARE_MATCHER2(Ge, >=);
IIUT_DECL_COMPARE_MATCHER2(Gt, > );

IUTEST_PRAGMA_WARN_POP()

#undef DECL_COMPARE_MATCHER
#undef DECL_COMPARE_MATCHER2
#undef IIUT_DECL_COMPARE_MATCHER
#undef IIUT_DECL_COMPARE_MATCHER2

#define DECL_STR_COMPARE_MATCHER(name) \
#define IIUT_DECL_STR_COMPARE_MATCHER(name) \
template<typename T>class IUTEST_PP_CAT(name, Matcher): public IMatcher { \
public: IUTEST_PP_CAT(name, Matcher)(const T& value) : m_expected(value) {} \
template<typename U>AssertionResult operator ()(const U& actual) const { \
Expand All @@ -146,12 +146,12 @@ IUTEST_PRAGMA_WARN_POP()
const T& m_expected; \
}

DECL_STR_COMPARE_MATCHER(StrEq);
DECL_STR_COMPARE_MATCHER(StrNe);
DECL_STR_COMPARE_MATCHER(StrCaseEq);
DECL_STR_COMPARE_MATCHER(StrCaseNe);
IIUT_DECL_STR_COMPARE_MATCHER(StrEq);
IIUT_DECL_STR_COMPARE_MATCHER(StrNe);
IIUT_DECL_STR_COMPARE_MATCHER(StrCaseEq);
IIUT_DECL_STR_COMPARE_MATCHER(StrCaseNe);

#undef DECL_COMPARE_MATCHER
#undef IIUT_DECL_COMPARE_MATCHER

/**
* @}
Expand Down
10 changes: 5 additions & 5 deletions include/iutest_package.hpp
Expand Up @@ -31,11 +31,11 @@

#if IUTEST_HAS_PACKAGE

#define IUTEST_CONCAT_PACKAGE_(testcase_name) IIUT_CONCAT_PACKAGE_I(testcase_name)
#define IIUT_CONCAT_PACKAGE_I(testcase_name) \
#define IUTEST_CONCAT_PACKAGE_(testcasename_) IIUT_CONCAT_PACKAGE_I(testcasename_)
#define IIUT_CONCAT_PACKAGE_I(testcasename_) \
iuTest_ConcatTestCaseName( iuTest_GetTestCasePackageName( \
static_cast<iuTest_TestCasePackage*>(NULL)) \
, #testcase_name)
, #testcasename_)

#define IUTEST_GET_PACKAGENAME_() \
iuTest_GetTestCasePackageName( static_cast<iuTest_TestCasePackage*>(NULL) )
Expand Down Expand Up @@ -100,8 +100,8 @@

#else

#define IUTEST_CONCAT_PACKAGE_(testcase_name) IIUT_CONCAT_PACKAGE_I(testcase_name)
#define IIUT_CONCAT_PACKAGE_I(testcase_name) #testcase_name
#define IUTEST_CONCAT_PACKAGE_(testcasename_) IIUT_CONCAT_PACKAGE_I(testcasename_)
#define IIUT_CONCAT_PACKAGE_I(testcasename_) #testcasename_
#define IIUT_PACKAGE_(name) namespace name
#define IUTEST_GET_PACKAGENAME_() ""

Expand Down

0 comments on commit ae4529e

Please sign in to comment.