• R/O
  • SSH
  • HTTPS

iris-fmw: Commit


Commit MetaInfo

Revision149 (tree)
Time2011-07-01 18:52:18
Authorshirayanagi

Log Message

iutest 更新
doxygen ファイル追加
ログ出力修正
時間計測を一部対応

Change Summary

Incremental Difference

--- trunk/framework/testsuite/iutest/include/iutest_ver.h (revision 148)
+++ trunk/framework/testsuite/iutest/include/iutest_ver.h (revision 149)
@@ -25,10 +25,10 @@
2525
2626 //======================================================================
2727 // define
28-#define IUTEST_VER 0x00010000 //!< iutest version 0.1.0.0
28+#define IUTEST_VER 0x00010100 //!< iutest version 0.1.1.0
2929 #define IUTEST_MAJORVER 0x00
3030 #define IUTEST_MINORVER 0x01
31-#define IUTEST_REVISION 0x00
31+#define IUTEST_REVISION 0x01
3232 #define IUTEST_BUILD 0x00
3333
3434
--- trunk/framework/testsuite/iutest/include/iutest_result.h (revision 148)
+++ trunk/framework/testsuite/iutest/include/iutest_result.h (revision 149)
@@ -64,7 +64,7 @@
6464 if( val1 op val2 ) return TestResult::Success(); \
6565 else { \
6666 return TestResult::Failure() << expr1 << " " #op " " << expr2 \
67- << "\nExpected: " << val1 << "\nactual: " << val2; \
67+ << "\n Expected: " << val1 << "\n actual: " << val2; \
6868 } \
6969 }
7070
@@ -80,7 +80,7 @@
8080 {
8181 if( val ) return TestResult::Success();
8282 return TestResult::Failure() << expr
83- << "\nExpected: " << val << "\nactual: true";
83+ << "\n Expected: " << val << "\n actual: true";
8484 }
8585
8686 template<typename T>
@@ -88,9 +88,38 @@
8888 {
8989 if( !val ) return TestResult::Success();
9090 return TestResult::Failure() << expr
91- << "\nExpected: " << val << "\nactual: false";
91+ << "\n Expected: " << val << "\n actual: false";
9292 }
9393
94+TestResult CompareHelperSTREQ(const char* expr1, const char* expr2
95+ , const char* val1, const char* val2)
96+{
97+ if( strcmp(val1, val2) == 0 ) return TestResult::Success();
98+ return TestResult::Failure() << expr1 << " == " << expr2
99+ << "\n Expected: " << val1 << "\n actual: " << val2;
100+}
101+TestResult CompareHelperSTREQ(const char* expr1, const char* expr2
102+ , const wchar_t* val1, const wchar_t* val2)
103+{
104+ if( wcscmp(val1, val2) == 0 ) return TestResult::Success();
105+ return TestResult::Failure() << expr1 << " == " << expr2
106+ << "\n Expected: " << val1 << "\n actual: " << val2;
107+}
108+TestResult CompareHelperSTRNE(const char* expr1, const char* expr2
109+ , const char* val1, const char* val2)
110+{
111+ if( strcmp(val1, val2) != 0 ) return TestResult::Success();
112+ return TestResult::Failure() << expr1 << " != " << expr2
113+ << "\n Expected: " << val1 << "\n actual: " << val2;
114+}
115+TestResult CompareHelperSTRNE(const char* expr1, const char* expr2
116+ , const wchar_t* val1, const wchar_t* val2)
117+{
118+ if( wcscmp(val1, val2) != 0 ) return TestResult::Success();
119+ return TestResult::Failure() << expr1 << " != " << expr2
120+ << "\n Expected: " << val1 << "\n actual: " << val2;
121+}
122+
94123 } // end of namespace iutest
95124
96125 #endif
--- trunk/framework/testsuite/iutest/include/iutest.h (revision 148)
+++ trunk/framework/testsuite/iutest/include/iutest.h (revision 149)
@@ -50,7 +50,8 @@
5050 #define IUTEST_RUN_ALL_TESTS() ::iutest::UnitTest::Run()
5151
5252 /**
53- * @brief テスト
53+ * @brief ASSERT テスト
54+ * @{
5455 */
5556 #define IUTEST_ASSERT_EQ(v1, v2) IUTEST_ASSERT_EQ_(v1, v2)
5657 #define IUTEST_ASSERT_NE(v1, v2) IUTEST_ASSERT_NE_(v1, v2)
@@ -62,4 +63,32 @@
6263 #define IUTEST_ASSERT_TRUE(v) IUTEST_ASSERT_TRUE_(v)
6364 #define IUTEST_ASSERT_FALSE(v) IUTEST_ASSERT_FALSE_(v)
6465
66+#define IUTEST_ASSERT_STREQ(v1, v2) IUTEST_ASSERT_STREQ_(v1, v2)
67+#define IUTEST_ASSERT_STRNE(v1, v2) IUTEST_ASSERT_STRNE_(v1, v2)
68+
69+/**
70+ * @}
71+*/
72+
73+/**
74+ * @brief EXPECT テスト
75+ * @{
76+*/
77+#define IUTEST_EXPECT_EQ(v1, v2) IUTEST_EXPECT_EQ_(v1, v2)
78+#define IUTEST_EXPECT_NE(v1, v2) IUTEST_EXPECT_NE_(v1, v2)
79+#define IUTEST_EXPECT_LE(v1, v2) IUTEST_EXPECT_LE_(v1, v2)
80+#define IUTEST_EXPECT_LT(v1, v2) IUTEST_EXPECT_LT_(v1, v2)
81+#define IUTEST_EXPECT_GE(v1, v2) IUTEST_EXPECT_GE_(v1, v2)
82+#define IUTEST_EXPECT_GT(v1, v2) IUTEST_EXPECT_GT_(v1, v2)
83+
84+#define IUTEST_EXPECT_TRUE(v) IUTEST_EXPECT_TRUE_(v)
85+#define IUTEST_EXPECT_FALSE(v) IUTEST_EXPECT_FALSE_(v)
86+
87+#define IUTEST_EXPECT_STREQ(v1, v2) IUTEST_EXPECT_STREQ_(v1, v2)
88+#define IUTEST_EXPECT_STRNE(v1, v2) IUTEST_EXPECT_STRNE_(v1, v2)
89+
90+/**
91+ * @}
92+*/
93+
6594 #endif
--- trunk/framework/testsuite/iutest/include/iutest_types.h (revision 148)
+++ trunk/framework/testsuite/iutest/include/iutest_types.h (revision 149)
@@ -24,12 +24,54 @@
2424 {
2525
2626 //======================================================================
27-// include
27+// struct
28+/**
29+ * @internal
30+ * @brief type_least_t
31+*/
32+template<int SIZE>
33+struct type_least_t {};
34+
35+template<>
36+struct type_least_t<1>
37+{
38+ typedef char Int;
39+ typedef unsigned char UInt;
40+};
41+template<>
42+struct type_least_t<2>
43+{
44+ typedef short Int;
45+ typedef unsigned short UInt;
46+};
47+template<>
48+struct type_least_t<4>
49+{
50+ typedef int Int;
51+ typedef unsigned int UInt;
52+};
53+template<>
54+struct type_least_t<8>
55+{
56+#if defined(_WIN32)
57+ typedef __int64 Int;
58+ typedef unsigned __int64 UInt;
59+#else
60+ typedef long long Int;
61+ typedef unsigned long long UInt;
62+#endif
63+};
64+
65+//======================================================================
66+// typedef
2867 typedef void* TestTypeId;
2968
3069 typedef void (*SetupMethod)(void);
3170 typedef void (*TearDownMethod)(void);
3271
72+typedef type_least_t<8>::UInt TimeInMillsec;
73+
74+
3375 } // end of namespace iutest
3476
3577 #endif
--- trunk/framework/testsuite/iutest/include/iutest_core.h (revision 148)
+++ trunk/framework/testsuite/iutest/include/iutest_core.h (revision 149)
@@ -28,60 +28,108 @@
2828
2929 //======================================================================
3030 // class
31-class UnitTest
31+class UnitTestImpl
3232 {
33+ friend class UnitTest;
3334 typedef detail::iu_list<TestCase> collection;
35+public:
36+ UnitTestImpl(void) : m_testnum(0) {}
3437
3538 public:
36- static void Run(void) { UnitTestImpl::GetInstance().Run(); }
37- static void AddInfo(TestCase* pCase, TestInfo* pInfo) { UnitTestImpl::GetInstance().AddInfo(pCase, pInfo); }
38-
39-private:
40- class UnitTestImpl
39+ int Run(void)
4140 {
42- public:
43- UnitTestImpl(void) : m_testnum(0) {}
44-
45- public:
46- int Run(void)
41+ bool result = true;
4742 {
48- bool result = true;
4943 collection it = m_collection;
5044 detail::iuConsole::color_output(detail::iuConsole::green, "[==========] ");
5145 detail::iuConsole::output("%d tests from %d testcase\n", m_testnum, m_collection.count() );
5246 while(it != NULL)
5347 {
54- if( !it->Run() ) result = false;
48+ if( it->Run() )
49+ {
50+ result = false;
51+ }
5552 ++it;
5653 }
5754 detail::iuConsole::color_output(detail::iuConsole::green, "[==========] ");
5855 detail::iuConsole::output("%d tests from %d testcase run\n", m_testnum, m_collection.count() );
59-
60- return result ? 0 : 1;
6156 }
6257
63- void AddInfo(TestCase* pCase, TestInfo* pInfo)
6458 {
65- collection& list = m_collection;
66- TestCase* p = list.find(pCase, collection::EqualOp());
67- if( p == NULL )
59+ int passed = 0;
60+ int failed = 0;
6861 {
69- p = pCase;
70- list.push_back(p);
62+ collection it = m_collection;
63+ while(it != NULL)
64+ {
65+ TestCase::collection it2 = it->m_collection;
66+ while( it2 != NULL )
67+ {
68+ if( it2->m_result )
69+ ++passed;
70+ else
71+ ++failed;
72+ ++it2;
73+ }
74+ ++it;
75+ }
76+ detail::iuConsole::color_output(detail::iuConsole::green, "[ PASSED ] ");
77+ detail::iuConsole::output("%d tests.\n", passed );
7178 }
72- ++m_testnum;
73- p->push_back(pInfo);
79+ if( failed )
80+ {
81+ detail::iuConsole::color_output(detail::iuConsole::red, "[ FAILED ] ");
82+ detail::iuConsole::output("%d tests.\n", failed );
83+
84+ collection it = m_collection;
85+ while(it != NULL && failed )
86+ {
87+ TestCase::collection it2 = it->m_collection;
88+ while( it2 != NULL )
89+ {
90+ if( !it2->m_result )
91+ {
92+ --failed;
93+ detail::iuConsole::color_output(detail::iuConsole::red, "[ FAILED ] ");
94+ detail::iuConsole::output("%s.%s\n", it2->m_testcase.c_str(), it2->m_testname.c_str());
95+ }
96+ ++it2;
97+ }
98+ ++it;
99+ }
100+ }
74101 }
102+ return result ? 0 : 1;
103+ }
75104
76- public:
77- static UnitTestImpl& GetInstance(void) { static UnitTestImpl inst; return inst; }
105+ void AddInfo(TestCase* pCase, TestInfo* pInfo)
106+ {
107+ collection& list = m_collection;
108+ TestCase* p = list.find(pCase, collection::EqualOp());
109+ if( p == NULL )
110+ {
111+ p = pCase;
112+ list.push_back(p);
113+ }
114+ ++m_testnum;
115+ p->push_back(pInfo);
116+ }
78117
79- private:
80- int m_testnum;
81- collection m_collection;
82- };
118+public:
119+ static UnitTestImpl& GetInstance(void) { static UnitTestImpl inst; return inst; }
120+
121+private:
122+ int m_testnum;
123+ collection m_collection;
83124 };
84125
126+class UnitTest
127+{
128+public:
129+ static void Run(void) { UnitTestImpl::GetInstance().Run(); }
130+ static void AddInfo(TestCase* pCase, TestInfo* pInfo) { UnitTestImpl::GetInstance().AddInfo(pCase, pInfo); }
131+};
132+
85133 template<class Tester>
86134 class TestInstance
87135 {
--- trunk/framework/testsuite/iutest/include/internal/iutest_internal.h (revision 148)
+++ trunk/framework/testsuite/iutest/include/internal/iutest_internal.h (revision 149)
@@ -25,11 +25,13 @@
2525 //======================================================================
2626 // define
2727 /**
28+ * @internal
2829 * @brief テスト名作成マクロ
2930 */
3031 #define IUTEST_TEST_CLASS_NAME_(tester_, testname_) iu_##tester_##_##testname_##_Test
3132
3233 /**
34+ * @internal
3335 * @brief テストクラス定義マクロ
3436 */
3537 #define IUTEST_TEST_(tester_, parent_, testname_) \
@@ -44,7 +46,8 @@
4446
4547
4648 /**
47- * @brief テスト
49+ * @internal
50+ * @brief ASSERT メッセージ処理
4851 */
4952 #define ASSERT_FAILER(msg) do { \
5053 IUTEST_BREAK(); \
@@ -56,6 +59,22 @@
5659 } while(0)
5760
5861
62+/**
63+ * @internal
64+ * @brief EXPECT メッセージ処理
65+*/
66+#define EXPECT_FAILER(msg) do { \
67+ IUTEST_BREAK(); \
68+ iutest::detail::iuConsole::output(__FILE__ ":" IUTEST_PP_TOSTRING(__LINE__) ": "); \
69+ iutest::detail::iuConsole::output(msg); \
70+ iutest::detail::iuConsole::output("\n"); \
71+ iutest::Test::CommitFailed(); \
72+ } while(0)
73+
74+/**
75+ * @internal
76+ * @biref 比較検証マクロ
77+*/
5978 #define IUTEST_TEST_IMPL_(comp, on_failer) do { \
6079 const iutest::TestResult tr = (comp); \
6180 if( !tr ) \
@@ -63,7 +82,9 @@
6382 } while(0)
6483
6584 /**
66- * @brief テスト
85+ * @internal
86+ * @brief ASSERT テスト
87+ * @{
6788 */
6889 #define IUTEST_ASSERT_EQ_(v1, v2) IUTEST_TEST_IMPL_( (iutest::CompareHelperEQ(#v1, #v2, v1, v2)), ASSERT_FAILER)
6990 #define IUTEST_ASSERT_NE_(v1, v2) IUTEST_TEST_IMPL_( (iutest::CompareHelperNE(#v1, #v2, v1, v2)), ASSERT_FAILER)
@@ -75,4 +96,34 @@
7596 #define IUTEST_ASSERT_TRUE_(v) IUTEST_TEST_IMPL_( (iutest::CompareHelperTrue(#v, v)) , ASSERT_FAILER)
7697 #define IUTEST_ASSERT_FALSE_(v) IUTEST_TEST_IMPL_( (iutest::CompareHelperFalse(#v, v)), ASSERT_FAILER)
7798
99+#define IUTEST_ASSERT_STREQ_(v1, v2) IUTEST_TEST_IMPL_( (iutest::CompareHelperSTREQ(#v1, #v2, v1, v2)), ASSERT_FAILER)
100+#define IUTEST_ASSERT_STRNE_(v1, v2) IUTEST_TEST_IMPL_( (iutest::CompareHelperSTRNE(#v1, #v2, v1, v2)), ASSERT_FAILER)
101+
102+/**
103+ * @}
104+*/
105+
106+/**
107+ * @internal
108+ * @brief EXPECT テスト
109+ * @{
110+*/
111+#define IUTEST_EXPECT_EQ_(v1, v2) IUTEST_TEST_IMPL_( (iutest::CompareHelperEQ(#v1, #v2, v1, v2)), EXPECT_FAILER)
112+#define IUTEST_EXPECT_NE_(v1, v2) IUTEST_TEST_IMPL_( (iutest::CompareHelperNE(#v1, #v2, v1, v2)), EXPECT_FAILER)
113+#define IUTEST_EXPECT_LE_(v1, v2) IUTEST_TEST_IMPL_( (iutest::CompareHelperLE(#v1, #v2, v1, v2)), EXPECT_FAILER)
114+#define IUTEST_EXPECT_LT_(v1, v2) IUTEST_TEST_IMPL_( (iutest::CompareHelperLT(#v1, #v2, v1, v2)), EXPECT_FAILER)
115+#define IUTEST_EXPECT_GE_(v1, v2) IUTEST_TEST_IMPL_( (iutest::CompareHelperGE(#v1, #v2, v1, v2)), EXPECT_FAILER)
116+#define IUTEST_EXPECT_GT_(v1, v2) IUTEST_TEST_IMPL_( (iutest::CompareHelperGT(#v1, #v2, v1, v2)), EXPECT_FAILER)
117+
118+#define IUTEST_EXPECT_TRUE_(v) IUTEST_TEST_IMPL_( (iutest::CompareHelperTrue(#v, v)) , EXPECT_FAILER)
119+#define IUTEST_EXPECT_FALSE_(v) IUTEST_TEST_IMPL_( (iutest::CompareHelperFalse(#v, v)), EXPECT_FAILER)
120+
121+#define IUTEST_EXPECT_STREQ_(v1, v2) IUTEST_TEST_IMPL_( (iutest::CompareHelperSTREQ(#v1, #v2, v1, v2)), EXPECT_FAILER)
122+#define IUTEST_EXPECT_STRNE_(v1, v2) IUTEST_TEST_IMPL_( (iutest::CompareHelperSTRNE(#v1, #v2, v1, v2)), EXPECT_FAILER)
123+
124+/**
125+ * @}
126+*/
127+
128+
78129 #endif
--- trunk/framework/testsuite/iutest/include/internal/iutest_stopwatch.h (nonexistent)
+++ trunk/framework/testsuite/iutest/include/internal/iutest_stopwatch.h (revision 149)
@@ -0,0 +1,84 @@
1+//======================================================================
2+//-----------------------------------------------------------------------
3+/**
4+ * @file iutest_stopwatch.h
5+ * @brief iris unit test 時間計測 ファイル
6+ *
7+ * @author t.sirayanagi
8+ * @version 1.0
9+ *
10+ * @par copyright
11+ * Copyright (C) 2011 Takazumi Shirayanagi\n
12+ * The new BSD License is applied to this software.
13+ * see LICENSE
14+*/
15+//-----------------------------------------------------------------------
16+//======================================================================
17+#ifndef INCG_IRIS_iutest_stopwatch_H_
18+#define INCG_IRIS_iutest_stopwatch_H_
19+
20+//======================================================================
21+// include
22+#include <time.h>
23+#include "iutest_util.h"
24+#include "../iutest_types.h"
25+
26+namespace iutest {
27+namespace detail
28+{
29+
30+
31+//======================================================================
32+// class
33+/**
34+ * @internal
35+ * @brief ストップウォッチクラス
36+*/
37+class iuStopWatch
38+{
39+private:
40+ TimeInMillsec m_begin;
41+public:
42+ iuStopWatch(void) : m_begin(0) {}
43+
44+public:
45+ static TimeInMillsec get_millsec(void)
46+ {
47+#if defined(_IUTEST_NOT_SUPPORT_STOPWATCH)
48+ return 0;
49+#else
50+
51+#if defined(_IUTEST_SUPPORT_GETTIMEOFDAY)
52+ timeval tv;
53+ gettimeofday(&tv, NULL);
54+ return static_cast<TimeInMillsec>(tv.tv_sec) * 1000 + static_cast<TimeInMillsec>(tv.tv_usec) / 1000;
55+#elif defined(_IUTEST_SUPPORT_CLOCK)
56+ return clock() * 1000 / CLOCKS_PER_SEC;
57+
58+#else
59+
60+#if defined(_IUTEST_OS_WINDOWS)
61+ return GetTickCount();
62+#else
63+ return 0;
64+#endif
65+
66+#endif
67+
68+#endif
69+ }
70+public:
71+ void start(void)
72+ {
73+ m_begin = get_millsec();
74+ }
75+ TimeInMillsec stop(void)
76+ {
77+ return get_millsec() - m_begin;
78+ }
79+};
80+
81+} // end of namespace detail
82+} // end of namespace iutest
83+
84+#endif
--- trunk/framework/testsuite/iutest/include/internal/iutest_util.h (revision 148)
+++ trunk/framework/testsuite/iutest/include/internal/iutest_util.h (revision 149)
@@ -43,8 +43,21 @@
4343 #define IUTEST_PP_TOSTRING(z) IUTEST_PP_TOSTRING_(z)
4444 #define IUTEST_PP_TOSTRING_(z) #z
4545
46+#if defined(_WIN32)
47+# define _IUTEST_OS_WINDOWS
48+#endif
49+
50+#if defined(_IUTEST_OS_WINDOWS)
51+# if defined(__CYGWIN__)
52+# include <sys/time.h>
53+# define _IUTEST_SUPPORT_GETTIMEOFDAY
54+# endif
55+#endif
56+
4657 #if defined(_WIN32_WCE)
58+# define _IUTEST_OS_WINDOWS_MOBILE
4759 # define _IUTEST_NOT_COLORCONSOLE
60+# undef _IUTEST_SUPPORT_GETTIMEOFDAY
4861 #endif
4962
5063 namespace iutest {
@@ -56,6 +69,10 @@
5669
5770 //======================================================================
5871 // struct
72+/**
73+ * @internal
74+ * @brief TypeId Generator Implementation
75+*/
5976 template<typename TN>
6077 struct TestTypeIdHelper { public: static bool _dummy; };
6178
@@ -66,6 +83,10 @@
6683
6784 //======================================================================
6885 // function
86+/**
87+ * @internal
88+ * @brief TypeId Generator
89+*/
6990 template<typename TN>
7091 TestTypeId GetTestTypeId(void)
7192 {
@@ -72,6 +93,10 @@
7293 return &(helper::TestTypeIdHelper<TN>::_dummy);
7394 }
7495
96+/**
97+ * @internal
98+ * @brief auto_ptr
99+*/
75100 template<typename TN>
76101 class auto_ptr
77102 {
--- trunk/framework/testsuite/iutest/include/internal/iutest_console.h (revision 148)
+++ trunk/framework/testsuite/iutest/include/internal/iutest_console.h (revision 149)
@@ -20,7 +20,7 @@
2020 //======================================================================
2121 // include
2222 #include "iutest_util.h"
23-#if defined(_WIN32)
23+#if defined(_IUTEST_OS_WINDOWS)
2424 # include <windows.h>
2525 #endif
2626 #include <stdio.h>
@@ -37,6 +37,7 @@
3737 //======================================================================
3838 // class
3939 /**
40+ * @internal
4041 * @brief コンソールクラス
4142 */
4243 class iuConsole
@@ -69,7 +70,7 @@
6970 #if defined(_IUTEST_NOT_COLORCONSOLE)
7071 IUTEST_VPRINTF(fmt, va);
7172 #else
72-#if defined(_WIN32)
73+#if defined(_IUTEST_OS_WINDOWS)
7374 {
7475 WORD attr[] = {
7576 0,
--- trunk/framework/testsuite/iutest/include/internal/iutest_factory.h (revision 148)
+++ trunk/framework/testsuite/iutest/include/internal/iutest_factory.h (revision 149)
@@ -35,7 +35,8 @@
3535 //======================================================================
3636 // class
3737 /**
38- * @brief テスト生成クラス
38+ * @internal
39+ * @brief テスト生成クラスインターフェース
3940 */
4041 class iuFactoryBase
4142 {
@@ -42,6 +43,11 @@
4243 public:
4344 virtual auto_ptr<Test> Create(void) = 0;
4445 };
46+
47+/**
48+ * @internal
49+ * @brief テスト生成クラス
50+*/
4551 template<class Tester>
4652 class iuFactory : public iuFactoryBase
4753 {
--- trunk/framework/testsuite/iutest/include/internal/iutest_list.h (revision 148)
+++ trunk/framework/testsuite/iutest/include/internal/iutest_list.h (revision 149)
@@ -26,6 +26,10 @@
2626
2727 //======================================================================
2828 // class
29+/**
30+ * @internal
31+ * @brief リストノード
32+*/
2933 template<typename TN>
3034 class iu_list_node
3135 {
@@ -41,6 +45,10 @@
4145 value_ptr operator -> (void) { return next; }
4246 };
4347
48+/**
49+ * @internal
50+ * @brief リストクラス
51+*/
4452 template<typename NODE>
4553 class iu_list
4654 {
--- trunk/framework/testsuite/iutest/include/iutest_case.h (revision 148)
+++ trunk/framework/testsuite/iutest/include/iutest_case.h (revision 149)
@@ -29,6 +29,9 @@
2929 // class
3030 class TestCase : public detail::iu_list_node<TestCase>
3131 {
32+ friend class UnitTest;
33+ friend class UnitTestImpl;
34+
3235 typedef detail::iu_list<TestInfo> collection;
3336 public:
3437 TestCase(const char* testcase, TestTypeId id, SetupMethod setup, TearDownMethod teardown)
--- trunk/framework/testsuite/iutest/include/iutest_info.h (revision 148)
+++ trunk/framework/testsuite/iutest/include/iutest_info.h (revision 149)
@@ -21,6 +21,7 @@
2121 // include
2222 #include "internal/iutest_factory.h"
2323 #include "internal/iutest_console.h"
24+#include "internal/iutest_stopwatch.h"
2425 #include "iutest_types.h"
2526 #include <string>
2627
@@ -34,6 +35,8 @@
3435 */
3536 class TestInfo : public detail::iu_list_node<TestInfo>
3637 {
38+ friend class UnitTest;
39+ friend class UnitTestImpl;
3740 public:
3841 /**
3942 * @brief コンストラクタ
@@ -60,13 +63,18 @@
6063 detail::iuConsole::output("%s.%s\n", m_testcase.c_str(), m_testname.c_str() );
6164
6265 m_result = true;
66+ detail::iuStopWatch sw;
67+ TimeInMillsec elapsed = 0;
6368 try
6469 {
6570 detail::auto_ptr<Test> p = m_factory->Create();
71+ sw.start();
6672 m_result = p->Run();
73+ elapsed = sw.stop();
6774 }
6875 catch (...)
6976 {
77+ elapsed = sw.stop();
7078 m_result = false;
7179 }
7280
@@ -73,13 +81,16 @@
7381 if( m_result )
7482 {
7583 detail::iuConsole::color_output(detail::iuConsole::green, "[ OK ] ");
76- detail::iuConsole::output("%s.%s\n", m_testcase.c_str(), m_testname.c_str() );
7784 }
7885 else
7986 {
8087 detail::iuConsole::color_output(detail::iuConsole::red, "[ FAILED ] ");
81- detail::iuConsole::output("%s.%s\n", m_testcase.c_str(), m_testname.c_str() );
8288 }
89+#if defined(_IUTEST_NOT_SUPPORT_STOPWATCH)
90+ detail::iuConsole::output("%s.%s (--ms)\n", m_testcase.c_str(), m_testname.c_str() );
91+#else
92+ detail::iuConsole::output("%s.%s (%dms)\n", m_testcase.c_str(), m_testname.c_str(), elapsed );
93+#endif
8394 m_should_run = true;
8495
8596 return m_result;
--- trunk/framework/testsuite/iutest/samples/main.cpp (revision 148)
+++ trunk/framework/testsuite/iutest/samples/main.cpp (revision 149)
@@ -110,6 +110,18 @@
110110 IUTEST_ASSERT_GT(y, x);
111111 }
112112
113+IUTEST(TestOp, STREQ)
114+{
115+ const char e[] = "test";
116+ IUTEST_ASSERT_STREQ(e, "test");
117+}
118+
119+IUTEST(TestOp, STRNE)
120+{
121+ const wchar_t e[] = L"test";
122+ IUTEST_ASSERT_STRNE(e, L"tset");
123+}
124+
113125 #endif
114126
115127 #if defined(SHOW_FAILER) // Failer Test
@@ -142,6 +154,19 @@
142154 IUTEST_ASSERT_FALSE(true);
143155 }
144156
157+IUTEST(TestExpectFailer, EQ)
158+{
159+ IUTEST_EXPECT_EQ(0.1, 1);
160+ IUTEST_EXPECT_NE(0, 0);
161+ IUTEST_EXPECT_LE(2, 0);
162+ IUTEST_EXPECT_LT(0, 0);
163+ IUTEST_EXPECT_GE(0, 2);
164+ IUTEST_EXPECT_GT(0, 0);
165+ IUTEST_EXPECT_TRUE(0);
166+ IUTEST_EXPECT_FALSE(1);
167+}
168+
169+
145170 #endif
146171
147172
--- trunk/framework/testsuite/iutest/doc/make_html.bat (nonexistent)
+++ trunk/framework/testsuite/iutest/doc/make_html.bat (revision 149)
@@ -0,0 +1,8 @@
1+doxygen.exe Doxyfile
2+if errorlevel 1 goto error
3+
4+exit
5+
6+:error
7+pause
8+
--- trunk/framework/testsuite/iutest/doc/index.html (nonexistent)
+++ trunk/framework/testsuite/iutest/doc/index.html (revision 149)
@@ -0,0 +1,8 @@
1+<html>
2+<head>
3+<title>マニュアル</title>
4+</head>
5+<frameset frameborder=1>
6+<frame src="html/index.html"></frame>
7+</frameset>
8+</html>
\ No newline at end of file
Show on old repository browser