• R/O
  • SSH
  • HTTPS

iris-fmw: Commit


Commit MetaInfo

Revision245 (tree)
Time2011-12-09 22:56:25
Authorshirayanagi

Log Message

iutest v0.10.1.0
HRESULT の文字列出力対応
IUTEST_ASSERT_*_THROW がメッセージ追記に対応していなかったので修正

Change Summary

Incremental Difference

--- trunk/framework/sample/Windows/unittest/src/iutest/gtest/main.cc (revision 244)
+++ trunk/framework/sample/Windows/unittest/src/iutest/gtest/main.cc (revision 245)
@@ -6,6 +6,4 @@
66 int main(int argc, char **argv) {
77 testing::InitGoogleTest(&argc, argv);
88 return RUN_ALL_TESTS();
9-}
10-
11-
9+}
--- trunk/framework/testsuite/iutest/include/iutest_ver.h (revision 244)
+++ trunk/framework/testsuite/iutest/include/iutest_ver.h (revision 245)
@@ -25,10 +25,10 @@
2525
2626 //======================================================================
2727 // define
28-#define IUTEST_VER 0x00100000 //!< iutest version 0.10.0,0
28+#define IUTEST_VER 0x00100100 //!< iutest version 0.10.1,0
2929 #define IUTEST_MAJORVER 0x00
3030 #define IUTEST_MINORVER 0x10
31-#define IUTEST_BUILD 0x00
31+#define IUTEST_BUILD 0x01
3232 #define IUTEST_REVISION 0x00
3333
3434 } // end of namespace iutest
--- trunk/framework/testsuite/iutest/include/iutest_assertion.h (revision 244)
+++ trunk/framework/testsuite/iutest/include/iutest_assertion.h (revision 245)
@@ -424,7 +424,7 @@
424424 {
425425 if( SUCCEEDED(hr) ) return AssertionSuccess();
426426 return AssertionFailure() << "error: Value of: " << expr
427- << "\n Actual: SUCCEEDED(hr)" << "\nExpected: " << hr;
427+ << "\n Actual: SUCCEEDED(hr)" << "\nExpected: " << hr << ": " << detail::win::GetHResultString(hr);
428428 }
429429 static AssertionResult CompareHelperHRFalse(const char* expr, HRESULT hr)
430430 {
--- trunk/framework/testsuite/iutest/include/iutest.h (revision 244)
+++ trunk/framework/testsuite/iutest/include/iutest.h (revision 245)
@@ -526,7 +526,7 @@
526526 #if defined(_IUTEST_DEBUG)
527527 detail::iuDebugInitialize();
528528 #endif
529- TestEnv::event_listeners().set_default_result_printer(&m_result_printer);
529+ TestEnv::event_listeners().set_default_result_printer(new iuDefalutResultPrintListener());
530530 }
531531 /**
532532 * @brief コマンドライン引数の解析
@@ -537,8 +537,9 @@
537537 TestEnv::ParseCommandLine(argc, argv);
538538 if( TestFlag::IsEnableFlag(TestFlag::OUTPUT_XML_REPORT) )
539539 {
540- m_xml_generator.SetFilePath(TestEnv::xml_report_file());
541- TestEnv::event_listeners().set_default_xml_generator(&m_xml_generator);
540+ iuDefaultXmlGeneratorListener* listener = new iuDefaultXmlGeneratorListener();
541+ listener->SetFilePath(TestEnv::xml_report_file());
542+ TestEnv::event_listeners().set_default_xml_generator(listener);
542543 }
543544
544545 UnitTest::instance().Initialize();
@@ -569,10 +570,6 @@
569570 }
570571 return ret;
571572 }
572-
573-private:
574- iuDefaultXmlGeneratorListener m_xml_generator;
575- iuDefalutResultPrintListener m_result_printer;
576573 };
577574
578575 //======================================================================
--- trunk/framework/testsuite/iutest/include/iutest_env.h (revision 244)
+++ trunk/framework/testsuite/iutest/include/iutest_env.h (revision 245)
@@ -21,6 +21,7 @@
2121 // include
2222 #include "internal/iutest_random.h"
2323 #include "internal/iutest_regex.h"
24+#include "internal/iutest_os.h"
2425 #include "iutest_listener.h"
2526 #include <stdlib.h>
2627 #include <string>
@@ -255,39 +256,39 @@
255256 {
256257 {
257258 int var = 0;
258- if( GetEnvironmentInt("IUTEST_ALSO_RUN_DISABLED_TESTS", var) )
259+ if( detail::GetEnvironmentInt("IUTEST_ALSO_RUN_DISABLED_TESTS", var) )
259260 {
260261 if( var ) TestFlag::SetFlag(TestFlag::RUN_DISABLED_TESTS);
261262 }
262- if( GetEnvironmentInt("IUTEST_SHUFFLE", var) )
263+ if( detail::GetEnvironmentInt("IUTEST_SHUFFLE", var) )
263264 {
264265 if( var ) TestFlag::SetFlag(TestFlag::SHUFFLE_TESTS);
265266 }
266- if( GetEnvironmentInt("IUTEST_RANDOM_SEED", var) )
267+ if( detail::GetEnvironmentInt("IUTEST_RANDOM_SEED", var) )
267268 {
268269 init_random((unsigned int)var);
269270 }
270- if( GetEnvironmentInt("IUTEST_CATCH_EXCEPTIONS", var) )
271+ if( detail::GetEnvironmentInt("IUTEST_CATCH_EXCEPTIONS", var) )
271272 {
272273 TestFlag::SetFlag(TestFlag::CATCH_EXCEPTION
273274 , var ? TestFlag::MASK : ~(TestFlag::CATCH_EXCEPTION) );
274275 }
275- if( GetEnvironmentInt("IUTEST_BREAK_ON_FAILURE", var) )
276+ if( detail::GetEnvironmentInt("IUTEST_BREAK_ON_FAILURE", var) )
276277 {
277278 TestFlag::SetFlag(TestFlag::BREAK_ON_FAILURE
278279 , var ? TestFlag::MASK : ~(TestFlag::BREAK_ON_FAILURE) );
279280 }
280- if( GetEnvironmentInt("IUTEST_THROW_ON_FAILURE", var) )
281+ if( detail::GetEnvironmentInt("IUTEST_THROW_ON_FAILURE", var) )
281282 {
282283 TestFlag::SetFlag(TestFlag::THROW_ON_FAILURE
283284 , var ? TestFlag::MASK : ~(TestFlag::THROW_ON_FAILURE) );
284285 }
285- if( GetEnvironmentInt("IUTEST_PRINT_TIME", var) )
286+ if( detail::GetEnvironmentInt("IUTEST_PRINT_TIME", var) )
286287 {
287288 TestFlag::SetFlag(TestFlag::PRINT_TIME
288289 , var ? TestFlag::MASK : ~(TestFlag::PRINT_TIME) );
289290 }
290- if( GetEnvironmentInt("IUTEST_REPEAT", var) )
291+ if( detail::GetEnvironmentInt("IUTEST_REPEAT", var) )
291292 {
292293 set_repeat_count(var);
293294 }
@@ -294,7 +295,7 @@
294295 }
295296 {
296297 char var[128];
297- if( GetEnvironmentVariable("IUTEST_COLOR", var) )
298+ if( detail::GetEnvironmentVariable("IUTEST_COLOR", var) )
298299 {
299300 ParseColorOption(var);
300301 }
@@ -301,11 +302,11 @@
301302 }
302303 {
303304 char path[260+32];
304- if( GetEnvironmentVariable("IUTEST_OUTPUT", path) )
305+ if( detail::GetEnvironmentVariable("IUTEST_OUTPUT", path) )
305306 {
306307 ParseOutputOption(path);
307308 }
308- if( GetEnvironmentVariable("IUTEST_FILTER", path) )
309+ if( detail::GetEnvironmentVariable("IUTEST_FILTER", path) )
309310 {
310311 set_test_filter(path);
311312 }
@@ -324,7 +325,7 @@
324325 #define PARSE_OPTION(c) do { \
325326 const char* eq = strchr(str, '='); \
326327 if( eq != NULL ) c = eq+1; \
327- } while(0)
328+ } while(detail::AlwaysFalse())
328329
329330 for( int i=0; i < argc; ++i )
330331 {
@@ -540,71 +541,6 @@
540541 }
541542 return true;
542543 }
543-
544-public:
545- /**
546- * @brief 環境変数の取得
547- * @param [in] name = 環境変数名
548- * @param [out] buf = 出力バッファ
549- * @return 成否
550- */
551- template<typename T, size_t SIZE>
552- static bool GetEnvironmentVariable(const char* name, T (&buf)[SIZE])
553- {
554-#if defined(_IUTEST_OS_WINDOWS)
555- DWORD ret = ::GetEnvironmentVariableA(name, buf, SIZE);
556- if( ret == 0 ) return false;
557- if( ret > SIZE ) return false;
558- return true;
559-#else
560- (void)name;
561- (void)buf;
562- return false;
563-#endif
564- }
565-
566- /**
567- * @brief 環境変数の取得
568- * @param [in] name = 環境変数名
569- * @param [out] var = 出力文字列
570- * @return 成否
571- */
572- static bool GetEnvironmentVariable(const char* name, std::string& var)
573- {
574-#if defined(_IUTEST_OS_WINDOWS)
575- char buf[128];
576- if( !GetEnvironmentVariable(name, buf) ) return false;
577- var = buf;
578- return true;
579-#else
580- (void)name;
581- (void)var;
582- return false;
583-#endif
584- }
585-
586- /**
587- * @brief 環境変数の取得
588- * @param [in] name = 環境変数名
589- * @param [out] var = 出力数値
590- * @return 成否
591- */
592- static bool GetEnvironmentInt(const char* name, int& var)
593- {
594-#if defined(_IUTEST_OS_WINDOWS)
595- char buf[128];
596- DWORD ret = ::GetEnvironmentVariableA(name, buf, sizeof(buf));
597- if( ret == 0 ) return false;
598- if( ret > sizeof(buf) ) return false;
599- char* end = NULL;
600- var = (int)strtol(buf, &end, 0);
601- return true;
602-#else
603- (void)name;
604- (void)var;
605- return false;
606-#endif
607- }
608544 };
609545
610546 template<typename DMY>
--- trunk/framework/testsuite/iutest/include/internal/iutest_stopwatch.h (revision 244)
+++ trunk/framework/testsuite/iutest/include/internal/iutest_stopwatch.h (nonexistent)
@@ -1,90 +0,0 @@
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_139950A2_3C99_475f_853F_244002FC0012_
18-#define INCG_IRIS_iutest_stopwatch_H_139950A2_3C99_475f_853F_244002FC0012_
19-
20-//======================================================================
21-// include
22-#include "iutest_util.h"
23-#include <time.h>
24-
25-//======================================================================
26-// define
27-
28-namespace iutest {
29-namespace detail
30-{
31-
32-//======================================================================
33-// class
34-/**
35- * @internal
36- * @brief ストップウォッチクラス
37-*/
38-class iuStopWatch
39-{
40-private:
41- TimeInMillisec m_begin;
42-public:
43- iuStopWatch(void) : m_begin(0) {}
44-
45-public:
46- // 現在の時間をミリ秒単位で取得
47- static TimeInMillisec get_millisec(void)
48- {
49-#if defined(_IUTEST_NOT_SUPPORT_STOPWATCH)
50- return 0;
51-#else
52-
53-#if defined(IUTEST_GetMillisec)
54- return IUTEST_GetMillisec();
55-
56-#elif defined(_IUTEST_SUPPORT_GETTIMEOFDAY)
57- timeval tv;
58- gettimeofday(&tv, NULL);
59- return static_cast<TimeInMillisec>(tv.tv_sec) * 1000 + static_cast<TimeInMillisec>(tv.tv_usec) / 1000;
60-#elif defined(_IUTEST_SUPPORT_CLOCK)
61- return clock() * 1000 / CLOCKS_PER_SEC;
62-
63-#else
64-
65-#if defined(_IUTEST_OS_WINDOWS)
66- return GetTickCount();
67-#else
68-# define _IUTEST_NOT_SUPPORT_STOPWATCH
69- return 0;
70-#endif
71-
72-#endif
73-
74-#endif
75- }
76-public:
77- void start(void)
78- {
79- m_begin = get_millisec();
80- }
81- TimeInMillisec stop(void) const
82- {
83- return get_millisec() - m_begin;
84- }
85-};
86-
87-} // end of namespace detail
88-} // end of namespace iutest
89-
90-#endif
--- trunk/framework/testsuite/iutest/include/internal/iutest_time.h (revision 244)
+++ trunk/framework/testsuite/iutest/include/internal/iutest_time.h (revision 245)
@@ -55,7 +55,61 @@
5555 #endif
5656 }
5757
58+//======================================================================
59+// class
60+/**
61+ * @internal
62+ * @brief ストップウォッチクラス
63+*/
64+class iuStopWatch
65+{
66+private:
67+ TimeInMillisec m_begin;
68+public:
69+ iuStopWatch(void) : m_begin(0) {}
5870
71+public:
72+ // 現在の時間をミリ秒単位で取得
73+ static TimeInMillisec get_millisec(void)
74+ {
75+#if defined(_IUTEST_NOT_SUPPORT_STOPWATCH)
76+ return 0;
77+#else
78+
79+#if defined(IUTEST_GetMillisec)
80+ return IUTEST_GetMillisec();
81+
82+#elif defined(_IUTEST_SUPPORT_GETTIMEOFDAY)
83+ timeval tv;
84+ gettimeofday(&tv, NULL);
85+ return static_cast<TimeInMillisec>(tv.tv_sec) * 1000 + static_cast<TimeInMillisec>(tv.tv_usec) / 1000;
86+#elif defined(_IUTEST_SUPPORT_CLOCK)
87+ return clock() * 1000 / CLOCKS_PER_SEC;
88+
89+#else
90+
91+#if defined(_IUTEST_OS_WINDOWS)
92+ return GetTickCount();
93+#else
94+# define _IUTEST_NOT_SUPPORT_STOPWATCH
95+ return 0;
96+#endif
97+
98+#endif
99+
100+#endif
101+ }
102+public:
103+ void start(void)
104+ {
105+ m_begin = get_millisec();
106+ }
107+ TimeInMillisec stop(void) const
108+ {
109+ return get_millisec() - m_begin;
110+ }
111+};
112+
59113 } // end of namespace detail
60114 } // end of namespace iutest
61115
--- trunk/framework/testsuite/iutest/include/internal/iutest_internal.h (revision 244)
+++ trunk/framework/testsuite/iutest/include/internal/iutest_internal.h (revision 245)
@@ -50,7 +50,7 @@
5050 * @internal
5151 * @brief ブレーク命令
5252 */
53-#define IUTEST_DO_BREAK() do { if( iutest::TestFlag::IsEnableFlag(iutest::TestFlag::BREAK_ON_FAILURE) ) { IUTEST_BREAK(); } } while(0)
53+#define IUTEST_DO_BREAK() do { if( iutest::TestFlag::IsEnableFlag(iutest::TestFlag::BREAK_ON_FAILURE) ) { IUTEST_BREAK(); } } while(::iutest::detail::AlwaysFalse())
5454
5555 /**
5656 * @internal
@@ -91,49 +91,55 @@
9191 * @internal
9292 * @brief throw テスト用マクロ
9393 */
94-#define IUTEST_TEST_THROW_(statement, expected_exception, on_failure) do { \
95- iutest::AssertionResult result = iutest::AssertionSuccess(); \
96- try { \
97- (void)statement; \
98- result = iutest::AssertionFailure() << "\nExpected: " #statement " throws an exception of type " \
99- #expected_exception ".\n Actual: it throws nothing."; \
100- } catch( expected_exception const& ) { \
101- } catch( ... ) { \
102- result = iutest::AssertionFailure() << "\nExpected: " #statement " throws an exception of type " \
94+#define IUTEST_TEST_THROW_(statement, expected_exception, on_failure) \
95+ IUTEST_AMBIGUOUS_ELSE_BLOCKER \
96+ if( const char* msg = "" ) { \
97+ try { \
98+ (void)statement; \
99+ msg = "\nExpected: " #statement " throws an exception of type " \
100+ #expected_exception ".\n Actual: it throws nothing."; \
101+ goto IUTEST_PP_CAT(iutest_label_throw, __LINE__); \
102+ } catch( expected_exception const& ) { \
103+ } catch( ... ) { \
104+ msg = "\nExpected: " #statement " throws an exception of type " \
103105 #expected_exception ".\n Actual: it throws a different type."; \
104- } \
105- IUTEST_TEST_ASSERT_(result, on_failure); \
106- } while(0)
106+ goto IUTEST_PP_CAT(iutest_label_throw, __LINE__); \
107+ } \
108+ } else \
109+ IUTEST_PP_CAT(iutest_label_throw, __LINE__): \
110+ on_failure(msg)
107111
108112 /**
109113 * @internal
110114 * @brief any throw テスト用マクロ
111115 */
112-#define IUTEST_TEST_ANY_THROW_(statement, on_failure) do { \
113- iutest::AssertionResult result = iutest::AssertionSuccess(); \
114- try { \
115- (void)statement; \
116- result = iutest::AssertionFailure() << "\nExpected: " #statement \
117- " throws an exception.\n Actual: it doesn's throws."; \
118- } catch( ... ) { \
119- } \
120- IUTEST_TEST_ASSERT_(result, on_failure); \
121- } while(0)
116+#define IUTEST_TEST_ANY_THROW_(statement, on_failure) \
117+ IUTEST_AMBIGUOUS_ELSE_BLOCKER \
118+ if( iutest::detail::AlwaysTrue() ) { \
119+ try { \
120+ (void)statement; \
121+ goto IUTEST_PP_CAT(iutest_label_anythrow, __LINE__); \
122+ } catch( ... ) { \
123+ } \
124+ } else \
125+ IUTEST_PP_CAT(iutest_label_anythrow, __LINE__): \
126+ on_failure("\nExpected: " #statement " throws an exception.\n Actual: it doesn's throws.")
122127
123128 /**
124129 * @internal
125130 * @brief no throw テスト用マクロ
126131 */
127-#define IUTEST_TEST_NO_THROW_(statement, on_failure) do { \
128- iutest::AssertionResult result = iutest::AssertionSuccess(); \
129- try { \
130- (void)statement; \
131- } catch( ... ) { \
132- result = iutest::AssertionFailure() << "\nExpected: " #statement \
133- " doesn't throw an exception.\n Actual: it throws."; \
134- } \
135- IUTEST_TEST_ASSERT_(result, on_failure); \
136- } while(0)
132+#define IUTEST_TEST_NO_THROW_(statement, on_failure) \
133+ IUTEST_AMBIGUOUS_ELSE_BLOCKER \
134+ if( iutest::detail::AlwaysTrue() ) { \
135+ try { \
136+ (void)statement; \
137+ } catch( ... ) { \
138+ goto IUTEST_PP_CAT(iutest_label_nothrow, __LINE__); \
139+ } \
140+ } else \
141+ IUTEST_PP_CAT(iutest_label_nothrow, __LINE__): \
142+ on_failure("\nExpected: " #statement " doesn't throw an exception.\n Actual: it throws.")
137143
138144 #endif
139145
--- trunk/framework/testsuite/iutest/include/internal/iutest_util.h (revision 244)
+++ trunk/framework/testsuite/iutest/include/internal/iutest_util.h (revision 245)
@@ -54,8 +54,6 @@
5454 # endif
5555 #endif
5656
57-#define IUTEST_UNUSED_VAR(x) (void)x
58-
5957 namespace iutest {
6058 namespace detail
6159 {
@@ -233,6 +231,23 @@
233231 template<typename From, typename To>
234232 const bool is_convertible<From, To>::value;
235233
234+
235+/**
236+ * @brief true を返す(警告対策用)
237+*/
238+static bool AlwaysTrue(void)
239+{
240+ return true;
241+}
242+/**
243+ * @brief false を返す(警告対策用)
244+*/
245+inline bool AlwaysFalse(void) { return !AlwaysTrue(); }
246+
247+/**
248+ * @brief
249+*/
250+
236251 } // end of namespace detail
237252 } // end of namespace iutest
238253
--- trunk/framework/testsuite/iutest/include/internal/iutest_os.h (nonexistent)
+++ trunk/framework/testsuite/iutest/include/internal/iutest_os.h (revision 245)
@@ -0,0 +1,139 @@
1+//======================================================================
2+//-----------------------------------------------------------------------
3+/**
4+ * @file iutest_os.h
5+ * @brief iris unit test os 依存関数 ファイル
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_os_H_7893F685_A1A9_477a_82E8_BF06237697FF_
18+#define INCG_IRIS_iutest_os_H_7893F685_A1A9_477a_82E8_BF06237697FF_
19+
20+//======================================================================
21+// include
22+#include "../iutest_defs.h"
23+#include "iutest_charcode.h"
24+
25+namespace iutest {
26+namespace detail
27+{
28+
29+/**
30+ * @brief 環境変数の取得
31+ * @param [in] name = 環境変数名
32+ * @param [out] buf = 出力バッファ
33+ * @return 成否
34+*/
35+template<typename T, size_t SIZE>
36+static bool GetEnvironmentVariable(const char* name, T (&buf)[SIZE])
37+{
38+#if defined(_IUTEST_OS_WINDOWS)
39+ DWORD ret = ::GetEnvironmentVariableA(name, buf, SIZE);
40+ if( ret == 0 ) return false;
41+ if( ret > SIZE ) return false;
42+ return true;
43+#else
44+ (void)name;
45+ (void)buf;
46+ return false;
47+#endif
48+}
49+
50+/**
51+ * @brief 環境変数の取得
52+ * @param [in] name = 環境変数名
53+ * @param [out] var = 出力文字列
54+ * @return 成否
55+*/
56+static bool GetEnvironmentVariable(const char* name, std::string& var)
57+{
58+#if defined(_IUTEST_OS_WINDOWS)
59+ char buf[128];
60+ if( !GetEnvironmentVariable(name, buf) ) return false;
61+ var = buf;
62+ return true;
63+#else
64+ (void)name;
65+ (void)var;
66+ return false;
67+#endif
68+}
69+
70+/**
71+ * @brief 環境変数の取得
72+ * @param [in] name = 環境変数名
73+ * @param [out] var = 出力数値
74+ * @return 成否
75+*/
76+static bool GetEnvironmentInt(const char* name, int& var)
77+{
78+#if defined(_IUTEST_OS_WINDOWS)
79+ char buf[128];
80+ DWORD ret = ::GetEnvironmentVariableA(name, buf, sizeof(buf));
81+ if( ret == 0 ) return false;
82+ if( ret > sizeof(buf) ) return false;
83+ char* end = NULL;
84+ var = (int)strtol(buf, &end, 0);
85+ return true;
86+#else
87+ (void)name;
88+ (void)var;
89+ return false;
90+#endif
91+}
92+
93+#if defined(_IUTEST_OS_WINDOWS)
94+namespace win
95+{
96+
97+/**
98+ * @brief HRESULT のエラー文字列を取得
99+ * @param [in] hr = エラー値
100+ * @return 文字列
101+*/
102+static std::string GetHResultString(HRESULT hr)
103+{
104+#if defined(_IUTEST_OS_WINDOWS_MOBILE)
105+ LPWSTR buf = NULL;
106+ FormatMessageW(
107+ FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
108+ NULL,
109+ hr,
110+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // デフォルト ユーザー言語
111+ (LPWSTR)&buf,
112+ 0,
113+ NULL );
114+
115+ std::string str = ShowWideCString(buf);
116+#else
117+ LPSTR buf = NULL;
118+ FormatMessageA(
119+ FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
120+ NULL,
121+ hr,
122+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // デフォルト ユーザー言語
123+ (LPSTR)&buf,
124+ 0,
125+ NULL );
126+
127+ std::string str = buf;
128+#endif
129+ LocalFree(buf);
130+ return str;
131+}
132+
133+} // end of namespace win
134+#endif
135+
136+} // end of namespace detail
137+} // end of namespace iutest
138+
139+#endif
--- trunk/framework/testsuite/iutest/include/iutest_info.h (revision 244)
+++ trunk/framework/testsuite/iutest/include/iutest_info.h (revision 245)
@@ -22,7 +22,7 @@
2222 #include "iutest_defs.h"
2323 #include "internal/iutest_factory.h"
2424 #include "internal/iutest_console.h"
25-#include "internal/iutest_stopwatch.h"
25+#include "internal/iutest_time.h"
2626 #include "internal/iutest_mediator.h"
2727 #include "internal/iutest_exception.h"
2828 #include "iutest_result.h"
--- trunk/framework/testsuite/iutest/samples/main.cpp (revision 244)
+++ trunk/framework/testsuite/iutest/samples/main.cpp (revision 245)
@@ -426,6 +426,21 @@
426426
427427 #endif
428428
429+#if defined(_IUTEST_OS_WINDOWS)
430+
431+IUTEST(TestHResult, True)
432+{
433+ IUTEST_ASSERT_HRESULT_SUCCEEDED(0);
434+}
435+
436+IUTEST(TestHResult, False)
437+{
438+ IUTEST_ASSERT_HRESULT_FAILED(-1);
439+}
440+
441+#endif
442+
443+
429444 /**
430445 * 失敗の確認
431446 */
@@ -465,6 +480,16 @@
465480 IUTEST_FAIL() << "add messages.\n";
466481 }
467482
483+#if defined(_IUTEST_OS_WINDOWS)
484+
485+IUTEST(TestFailure, HRESULT)
486+{
487+ IUTEST_ASSERT_HRESULT_SUCCEEDED(E_OUTOFMEMORY);
488+}
489+
490+#endif
491+
492+
468493 IUTEST(TestExpectFailure, Random)
469494 {
470495 IUTEST_EXPECT_EQ( genrand(), genrand() );
Show on old repository browser