Skip to content

Commit

Permalink
update r855
Browse files Browse the repository at this point in the history
  • Loading branch information
srz-zumix committed May 24, 2015
1 parent 2daf2c7 commit d19f3a2
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 21 deletions.
2 changes: 1 addition & 1 deletion doc/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = iutest
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 1.11.99.15
PROJECT_NUMBER = 1.11.99.16

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
40 changes: 23 additions & 17 deletions include/internal/iutest_internal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* @author t.shirayanagi
* @par copyright
* Copyright (C) 2011-2014, Takazumi Shirayanagi\n
* Copyright (C) 2011-2015, Takazumi Shirayanagi\n
* This software is released under the new BSD License,
* see LICENSE
*/
Expand Down Expand Up @@ -65,19 +65,25 @@
#endif

#if IUTEST_HAS_IF_EXISTS
# define IIUT_CHECK_TESTFIXTURE(testfixture_) \
# define IIUT_CHECK_TESTFIXTURE_(testfixture_) \
IUTEST_IF_EXISTS(testfixture_, IUTEST_IF_EXISTS(testfixture_::SetUp, \
IUTEST_STATIC_ASSERT_MSG( \
(!::iutest_type_traits::is_base_of< ::iutest::Test, testfixture_ >::value) \
, #testfixture_ " is fixture class, mistake the IUTEST_F?"); \
) )
#else
# define IIUT_CHECK_TESTFIXTURE(testfixture_)
# define IIUT_CHECK_TESTFIXTURE_(testfixture_) \
IUTEST_STATIC_ASSERT_MSG( \
(! ::iutest::detail::is_useful_testfixture< void (int (testfixture_)) >::value) \
, #testfixture_ " is fixture class, mistake the IUTEST_F?");
#endif
#define IIUT_CHECK_TESTFIXTURE(testfixture_) IIUT_CHECK_TESTFIXTURE_(IIUT_TO_VARNAME_(testfixture_))

#if !defined(IUTEST_TEST_STRICT_)
#define IUTEST_TEST_STRICT_(testcase_, testname_, parent_class_, type_id_) \
IIUT_CHECK_TESTFIXTURE(testcase_) \
IUTEST_TEST_(testcase_, testname_, parent_class_, type_id_)
#endif

#define IUTEST_TEST_F_(testfixture_, testname_) IUTEST_TEST_(testfixture_, testname_, IIUT_TO_VARNAME_(testfixture_) \
, ::iutest::internal::GetTypeId< IIUT_TO_VARNAME_(testfixture_) >())
Expand All @@ -91,7 +97,7 @@

/**
* @internal
* @brief テストクラス定義マクロ
* @brief Test class defined macro
*/
#define IUTEST_TEST_(testcase_, testname_, parent_class_, type_id_) \
class IUTEST_TEST_CLASS_NAME_(testcase_, testname_) : public parent_class_ { \
Expand All @@ -107,7 +113,7 @@

/**
* @internal
* @brief テストクラス定義マクロ
* @brief Test class defined macro
* 関数の中はコンパイルできなくてもよい
*/
#define IUTEST_TEST_IGNORE_(testcase_, testname_, parent_class_, type_id_) \
Expand Down Expand Up @@ -138,7 +144,7 @@

/**
* @internal
* @brief パラメタライズテスト定義マクロ
* @brief Parameterized test class defined macro
*/
#define IIUT_TEST_PMZ_(testcase_, testname_, method_, parent_class_, type_id_, ...) \
class IUTEST_TEST_CLASS_NAME_(testcase_, testname_); \
Expand All @@ -160,14 +166,14 @@

/**
* @internal
* @brief ASSERTION メッセージ処理
* @brief Assertion message
*/
#define IUTEST_MESSAGE_AT(file_, line_, msg_, result_type_) ::iutest::AssertionHelper(file_, line_, msg_, result_type_) = ::iutest::AssertionHelper::Fixed()
#define IUTEST_MESSAGE(msg_, result_type_) IUTEST_MESSAGE_AT(__FILE__, __LINE__, msg_, result_type_)

/**
* @internal
* @brief ASSERT メッセージ処理
* @brief ASSERT message
*/
#define IUTEST_ASSERT_FAILURE(msg) IUTEST_ASSERT_FAILURE_AT(msg, __FILE__, __LINE__)

Expand All @@ -179,23 +185,23 @@

/**
* @internal
* @brief EXPECT メッセージ処理
* @brief EXPECT message
*/
#define IUTEST_EXPECT_FAILURE(msg) IUTEST_EXPECT_FAILURE_AT(msg, __FILE__, __LINE__)

#define IUTEST_EXPECT_FAILURE_AT(msg, file, line) IUTEST_MESSAGE_AT(file, line, msg, ::iutest::TestPartResult::kNonFatalFailure)

/**
* @internal
* @brief INFORM メッセージ処理
* @brief INFORM message
*/
#define IUTEST_INFORM_FAILURE(msg) IUTEST_INFORM_FAILURE_AT(msg, __FILE__, __LINE__)

#define IUTEST_INFORM_FAILURE_AT(msg, file, line) IUTEST_MESSAGE_AT(file, line, msg, ::iutest::TestPartResult::kWarning)

/**
* @internal
* @brief ASSUME メッセージ処理
* @brief ASSUME message
*/
#define IUTEST_ASSUME_FAILURE(msg) IUTEST_ASSUME_FAILURE_AT(msg, __FILE__, __LINE__)

Expand All @@ -207,7 +213,7 @@

/**
* @internal
* @brief SKIP メッセージ処理
* @brief SKIP message
*/
#define IUTEST_SKIP_MESSAGE(msg) IUTEST_SKIP_MESSAGE_AT(msg, __FILE__, __LINE__)

Expand Down Expand Up @@ -235,7 +241,7 @@
#if IUTEST_HAS_EXCEPTIONS
/**
* @internal
* @brief throw テスト用マクロ
* @brief throw assertion defined macro
*/
#define IUTEST_TEST_THROW_(statement, expected_exception, on_failure) \
IUTEST_AMBIGUOUS_ELSE_BLOCKER_ \
Expand All @@ -257,7 +263,7 @@

/**
* @internal
* @brief throw テスト用マクロ
* @brief throw value assertion defined macro
*/
#define IUTEST_TEST_THROW_VALUE_(statement, expected_exception, expected_exception_value, on_failure, pred_formatter) \
IUTEST_AMBIGUOUS_ELSE_BLOCKER_ \
Expand Down Expand Up @@ -294,7 +300,7 @@

/**
* @internal
* @brief any throw テスト用マクロ
* @brief any throw assertion defined macro
*/
#define IUTEST_TEST_ANY_THROW_(statement, on_failure) \
IUTEST_AMBIGUOUS_ELSE_BLOCKER_ \
Expand All @@ -310,7 +316,7 @@

/**
* @internal
* @brief no throw テスト用マクロ
* @brief no throw assertion defined macro
*/
#define IUTEST_TEST_NO_THROW_(statement, on_failure) \
IUTEST_AMBIGUOUS_ELSE_BLOCKER_ \
Expand Down Expand Up @@ -396,7 +402,7 @@

/**
* @internal
* @brief テストマクロ
* @brief all flavor assertion macro
* @{
*/
#define IUTEST_TEST_EQ(expected, actual, on_failure) IUTEST_PRED_FORMAT2_( ::iutest::internal::EqHelper<IUTEST_IS_NULLLITERAL(expected)>::Compare, expected, actual, on_failure )
Expand Down
42 changes: 41 additions & 1 deletion include/iutest_body.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* @author t.shirayanagi
* @par copyright
* Copyright (C) 2011-2014, Takazumi Shirayanagi\n
* Copyright (C) 2011-2015, Takazumi Shirayanagi\n
* This software is released under the new BSD License,
* see LICENSE
*/
Expand Down Expand Up @@ -273,6 +273,46 @@ class TestWithParam : public Test, public WithParamInterface<T>
{
};

namespace detail
{

/**
* @brief 有益な TestFixture が定義されているかどうか
*/
template<typename T>
class is_useful_testfixture : public iutest_type_traits::false_type {};

#if !defined(IUTEST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(IUTEST_NO_FUNCTION_TEMPLATE_ORDERING)

namespace is_useful_testfixture_helper
{

template<typename T>
class is_override_setup {
template<bool b, typename U>struct impl { typedef iutest_type_traits::false_type type; };
template<typename U>struct impl<true, U>
{
typedef int yes_t;
typedef char no_t;
static no_t check(void(Test::*)());
static yes_t check(...);
typedef iutest_type_traits::bool_constant< sizeof(&U::SetUp) == sizeof(yes_t) > type;
};
public:
typedef typename impl< iutest_type_traits::is_base_of<Test, T>::value, T>::type type;
};

}

template<typename T>
class is_useful_testfixture<void(int(T))> : public is_useful_testfixture_helper::is_override_setup<T>::type
{
};

#endif

}

} // end of namespace iutest

template<typename DMY>
Expand Down
4 changes: 2 additions & 2 deletions include/iutest_ver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@

//======================================================================
// define
#define IUTEST_VER 0x01119915u //!< iutest version 1.11.99.15
#define IUTEST_VER 0x01119916u //!< iutest version 1.11.99.16
#define IUTEST_MAJORVER 0x01u //!< Major Version
#define IUTEST_MINORVER 0x11u //!< Minor Version
#define IUTEST_BUILD 0x99u //!< Build
#define IUTEST_REVISION 0x15u //!< Revision
#define IUTEST_REVISION 0x16u //!< Revision

/**
* @mainpage
Expand Down

0 comments on commit d19f3a2

Please sign in to comment.