#ifndef __GTUNIT_H__
#define __GTUNIT_H__
#include "gttest.h"
#include "allocator.h"
/*===============================================*/
/* new */
/*===============================================*/
//! @fn new
//! @param [in] s サイズ
//! @param [in] f ファイル
//! @param [in] l ライン
//! @return メモリ
static void* operator new( size_t s, const char* f, int l ) throw()
{
return Alloc::Get()->Allocate( s, f, l );
}
/*===============================================*/
/* delete */
/*===============================================*/
//! @fn delete
//! @note ダミー
//! @param [out] p メモリ
//! @param [in] f ファイル
//! @param [in] l ライン
static void operator delete( void* p, const char* f, int l ) throw()
{
(void)p;
(void)f;
(void)l;
}
/*===============================================*/
/* delete */
/*===============================================*/
//! @fn delete
//! @param [out] p メモリ
static void operator delete( void* p ) throw()
{
Alloc::Get()->Deallocate( p );
}
/*===============================================*/
/* new */
/*===============================================*/
//! @def new
#define new new( __FILE__, __LINE__ )
/*===============================================*/
/* _GT_GTEST_TEST_ */
/*===============================================*/
//! @def _GT_GTEST_TEST_
#define _GT_GTEST_TEST_(test_case_name, test_name, parent_class, parent_id)\
class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) : public parent_class {\
public:\
GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {}\
private:\
virtual void TestBody();\
virtual void TestEntity();/* テスト本体 */\
static ::testing::TestInfo* const test_info_;\
GTEST_DISALLOW_COPY_AND_ASSIGN_(\
GTEST_TEST_CLASS_NAME_(test_case_name, test_name));\
};\
\
::testing::TestInfo* const GTEST_TEST_CLASS_NAME_(test_case_name, test_name)\
::test_info_ =\
::testing::internal::MakeAndRegisterTestInfo(\
#test_case_name, #test_name, "", "", \
(parent_id), \
parent_class::SetUpTestCase, \
parent_class::TearDownTestCase, \
new ::testing::internal::TestFactoryImpl<\
GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>);\
void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()\
{\
Allocator alloc;\
TestEntity();\
ASSERT_TRUE( alloc.Check() );\
}\
void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestEntity()
/*===============================================*/
/* GT_TEST_FUNC */
/*===============================================*/
//! @def GT_TEST_FUNC
#define GT_TEST_FUNC(test_case_name, test_name)\
_GT_GTEST_TEST_(test_case_name, test_name,\
::testing::Test, ::testing::internal::GetTestTypeId())
/*===============================================*/
/* GT_TEST_CLASS */
/*===============================================*/
//! @def GT_TEST_CLASS
#define GT_TEST_CLASS(test_fixture, test_name)\
_GT_GTEST_TEST_(test_fixture, test_name, test_fixture,\
::testing::internal::GetTypeId<test_fixture>())
/*===============================================*/
/* GT_FORM */
/*===============================================*/
//! @def GT_FORM
#define GT_FORM testing::Test
#endif//__GTUNIT_H__
最終更新:2009年02月14日 15:48