15 #ifndef INCG_IRIS_IUTEST_BODY_HPP_3EEA6706_9954_4330_B292_129667FA6B96_
16 #define INCG_IRIS_IUTEST_BODY_HPP_3EEA6706_9954_4330_B292_129667FA6B96_
27 template<
typename T>
class WithParamInterface;
28 template<
typename T>
class TestWithParam;
33 ::std::string MakeIndexName(
size_t index);
44 IUTEST_PP_DISALLOW_COPY_AND_ASSIGN(
Test);
50 #if IUTEST_HAS_GENRAND
54 CurrentTestObserver::s_current =
this;
59 CurrentTestObserver::s_current = NULL;
69 if( curr == NULL || curr->m_test_info == NULL )
73 return curr->m_test_info->ptr();
118 #if !defined(IUTEST_NO_FUNCTION_TEMPLATE_ORDERING)
124 static void RecordProperty(const ::std::string& key, const ::std::string& value);
133 static void RecordProperty(const ::std::string& key,
const T& value)
138 #if IUTEST_HAS_GENRAND
145 unsigned int genrand() {
return m_random.genrand(); }
151 unsigned int genrand(
unsigned int max) {
return m_random.genrand(max); }
156 float genrandf() {
return m_random.genrandf(); }
166 virtual void SetUp() {}
173 #if IUTEST_HAS_TESTCASE
174 static void SetUpTestCase() {}
175 static void TearDownTestCase() {}
182 void Run(detail::iuITestInfoMediator* test_info);
189 static void RecordPropertyString(const ::std::string& key, const ::std::string& value);
192 struct should_be_SetUp {};
196 template<
typename DMY>
200 static Test* s_current;
205 typedef Observer<void> CurrentTestObserver;
208 class TestRecordPropertyHelper
218 friend class UnitTestImpl;
220 friend class detail::UncaughtScopedTrace;
222 detail::iuITestInfoMediator* m_test_info;
223 #if IUTEST_HAS_GENRAND
224 detail::iuRandom m_random;
225 unsigned int m_random_seed;
232 template<
typename ParamType>
236 : param(p), index(i) {}
260 IUTEST_CHECK_(s_params != NULL) <<
"GetParam() can only use the value-parameterized test";
261 IUTEST_ANALYSIS_ASSUME(s_params != NULL);
270 static const typename tuples::tuple_element<N, ParamType>::type&
GetParam()
281 return detail::MakeIndexName(info.index);
292 const T* WithParamInterface<T>::s_params = NULL;
299 class TestWithParam :
public Test,
public WithParamInterface<T>
306 #if !defined(IUTEST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(IUTEST_NO_FUNCTION_TEMPLATE_ORDERING)
312 class is_useful_testfixture :
public iutest_type_traits::false_type {};
314 namespace is_useful_testfixture_helper
318 class is_override_setup {
319 template<
bool b,
typename U>
struct impl {
typedef iutest_type_traits::false_type type; };
320 template<
typename U>
struct impl<true, U>
324 static no_t check(
void(Test::*)());
325 static yes_t check(...);
326 typedef iutest_type_traits::bool_constant<
sizeof(check(&U::SetUp)) ==
sizeof(yes_t) > type;
329 typedef typename impl< iutest_type_traits::is_base_of<Test, T>::value, T>::type type;
335 class is_useful_testfixture<void (int(T))> :
public is_useful_testfixture_helper::is_override_setup<T>::type
341 inline bool IsDisableTestName(const ::std::string& name)
343 if( detail::IsStringForwardMatching(name,
"DISABLED_")
344 || detail::IsStringContains(name,
"/DISABLED_") )
355 template<
typename DMY>
359 # include "impl/iutest_body.ipp"
テストベース
Definition: iutest_body.hpp:44
detail::iuRandom & random_engine()
Definition: iutest_body.hpp:162
unsigned int random_seed() const IUTEST_CXX_NOEXCEPT_SPEC
Definition: iutest_body.hpp:159
const TestInfo * test_info_
テスト中に簡単にアクセス可能なように
Definition: iutest_body.hpp:215
static bool HasFatalFailure()
致命的なエラーが出たかどうか
Definition: iutest_body.hpp:87
float genrandf()
Definition: iutest_body.hpp:157
static Test * GetCurrentTest()
実行中の Test の取得
Definition: iutest_body.hpp:80
static void RecordProperty(const ::std::string &key, const ::std::string &value)
テスト結果の情報追加
static void TearDownTestSuite()
test suite tear down
Definition: iutest_body.hpp:173
virtual void TearDown()
実行後処理
Definition: iutest_body.hpp:169
virtual void Body()
テスト実装部
Definition: iutest_body.hpp:168
static const TestInfo * GetCurrentTestInfo()
実行中の TestInfo の取得
Definition: iutest_body.hpp:67
static bool HasNonfatalFailure()
致命的ではないエラーが出たかどうか
Definition: iutest_body.hpp:96
static bool IsSkipped()
スキップされたかどうか
Definition: iutest_body.hpp:114
static bool HasFailure()
エラーが出たかどうか
Definition: iutest_body.hpp:105
virtual void SetUp()
実行前処理
Definition: iutest_body.hpp:167
static void SetUpTestSuite()
test suite setup
Definition: iutest_body.hpp:172
unsigned int genrand()
乱数の生成
Definition: iutest_body.hpp:146
テスト情報クラス
Definition: iutest_info.hpp:38
テスト全体の管理者
Definition: iutest_core.hpp:36
パラメータテストインターフェース
Definition: iutest_body.hpp:248
static const ParamType & GetParam()
パラメータの取得
Definition: iutest_body.hpp:259
static const ::std::string MakeTestParamName(const TestParamInfoType &info)
テスト名の生成
Definition: iutest_body.hpp:280
T ParamType
パラメータ型
Definition: iutest_body.hpp:250
TestParamInfo< T > TestParamInfoType
パラメータ情報型
Definition: iutest_body.hpp:251
#define IUTEST_CXX_FINAL
final definition
Definition: iutest_compiler.hpp:756
#define IUTEST_CXX_NOEXCEPT_SPEC
noexcept specification definition
Definition: iutest_compiler.hpp:811
#define IUTEST_CHECK_(condition)
内部エラーチェック
Definition: iutest_port.hpp:63
iutest root namespace
Definition: iutest_charcode.hpp:33
std::string PrintToString(const T &v)
文字列化
Definition: iutest_printers.hpp:767
値のパラメータ化テストのパラメータ情報
Definition: iutest_body.hpp:235