[詳解]
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;
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() {}
167 #if IUTEST_HAS_AUTOFIXTURE_PARAM_TEST
168 virtual void Body() {}
170 virtual void Body() = 0;
172 virtual void TearDown() {}
175 static void SetUpTestCase() {}
176 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;
221 detail::iuITestInfoMediator* m_test_info;
222 #if IUTEST_HAS_GENRAND
223 detail::iuRandom m_random;
224 unsigned int m_random_seed;
231 template<
typename ParamType>
235 : param(p), index(i) {}
259 IUTEST_CHECK_(s_params != NULL) <<
"GetParam() can only use the value-parameterized test";
260 IUTEST_ANALYSIS_ASSUME(s_params != NULL);
269 static const typename tuples::tuple_element<N, ParamType>::type&
GetParam()
280 return detail::MakeIndexName(info.index);
291 const T* WithParamInterface<T>::s_params = NULL;
298 class TestWithParam :
public Test,
public WithParamInterface<T>
305 #if !defined(IUTEST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(IUTEST_NO_FUNCTION_TEMPLATE_ORDERING)
311 class is_useful_testfixture :
public iutest_type_traits::false_type {};
313 namespace is_useful_testfixture_helper
317 class is_override_setup {
318 template<
bool b,
typename U>
struct impl {
typedef iutest_type_traits::false_type type; };
319 template<
typename U>
struct impl<true, U>
323 static no_t check(
void(Test::*)());
324 static yes_t check(...);
325 typedef iutest_type_traits::bool_constant<
sizeof(check(&U::SetUp)) ==
sizeof(yes_t) > type;
328 typedef typename impl< iutest_type_traits::is_base_of<Test, T>::value, T>::type type;
334 class is_useful_testfixture<void (int(T))> :
public is_useful_testfixture_helper::is_override_setup<T>::type
340 inline bool IsDisableTestName(const ::std::string& name)
342 if( detail::IsStringForwardMatching(name,
"DISABLED_")
343 || detail::IsStringContains(name,
"/DISABLED_") )
354 template<
typename DMY>
358 # include "impl/iutest_body.ipp"
361 #endif // INCG_IRIS_IUTEST_BODY_HPP_3EEA6706_9954_4330_B292_129667FA6B96_
テストベース
Definition: iutest_body.hpp:43
static const ParamType & GetParam()
パラメータの取得
Definition: iutest_body.hpp:258
テスト情報クラス
Definition: iutest_info.hpp:32
static bool IsSkipped()
スキップされたかどうか
Definition: iutest_body.hpp:114
static void RecordProperty(const ::std::string &key, const T &value)
テスト結果の情報追加
Definition: iutest_body.hpp:134
std::string PrintToString(const T &v)
文字列化
Definition: iutest_printers.hpp:678
static const tuples::tuple_element< N, ParamType >::type & GetParam()
パラメータの取得
Definition: iutest_body.hpp:270
#define IUTEST_CXX_NOEXCEPT_SPEC
noexcept specification definition
Definition: iutest_compiler.hpp:734
T ParamType
パラメータ型
Definition: iutest_body.hpp:249
static bool HasFatalFailure()
致命的なエラーが出たかどうか
Definition: iutest_body.hpp:87
unsigned int genrand(unsigned int max)
Definition: iutest_body.hpp:152
const TestInfo * test_info_
テスト中に簡単にアクセス可能なように
Definition: iutest_body.hpp:215
iutest root namespace
Definition: iutest_charcode.hpp:31
テスト全体の管理者
Definition: iutest_core.hpp:33
#define IUTEST_CXX_FINAL
final definition
Definition: iutest_compiler.hpp:679
static const TestInfo * GetCurrentTestInfo()
実行中の TestInfo の取得
Definition: iutest_body.hpp:67
unsigned int genrand()
乱数の生成
Definition: iutest_body.hpp:146
static const ::std::string MakeTestParamName(const TestParamInfoType &info)
テスト名の生成
Definition: iutest_body.hpp:279
static bool HasFailure()
エラーが出たかどうか
Definition: iutest_body.hpp:105
パラメータテストベース
Definition: iutest_body.hpp:29
TestParamInfo< T > TestParamInfoType
パラメータ情報型
Definition: iutest_body.hpp:250
unsigned int random_seed() const IUTEST_CXX_NOEXCEPT_SPEC
Definition: iutest_body.hpp:159
float genrandf()
Definition: iutest_body.hpp:157
static bool HasNonfatalFailure()
致命的ではないエラーが出たかどうか
Definition: iutest_body.hpp:96
detail::iuRandom & random_engine()
Definition: iutest_body.hpp:162
static void RecordProperty(const ::std::string &key, const ::std::string &value)
テスト結果の情報追加
値のパラメータ化テストのパラメータ情報
Definition: iutest_body.hpp:233
static Test * GetCurrentTest()
実行中の Test の取得
Definition: iutest_body.hpp:80
パラメータテストインターフェース
Definition: iutest_body.hpp:28
#define IUTEST_CHECK_(condition)
内部エラーチェック
Definition: iutest_port.hpp:60