• R/O
  • SSH
  • HTTPS

iris-fmw: Commit


Commit MetaInfo

Revision259 (tree)
Time2012-01-13 23:30:49
Authorshirayanagi

Log Message

iutest v0.14.0.0
RecordProperty に対応
RGBA カラークラス修正

Change Summary

Incremental Difference

--- trunk/external/windows/setup/angelscript/resetup_env.bat (nonexistent)
+++ trunk/external/windows/setup/angelscript/resetup_env.bat (revision 259)
@@ -0,0 +1,16 @@
1+@echo off
2+rem ユーザー環境変数から NACLSDK_ROOT を削除します。
3+
4+pushd "%~dp0"
5+call _setenv.bat
6+
7+@echo ANGELSCRIPT_ROOT> reset_enviroment.dat
8+@echo ANGELSCRIPT_SDK_ROOT> reset_enviroment.dat
9+
10+call cscript.exe "%WSH_TOOLS_ROOT%\wsh_resetenv.wsf" reset_enviroment.dat
11+
12+del /f reset_enviroment.dat
13+
14+exit /b 0
15+
16+:end
--- trunk/external/windows/setup/angelscript/clean.bat (nonexistent)
+++ trunk/external/windows/setup/angelscript/clean.bat (revision 259)
@@ -0,0 +1,9 @@
1+@echo off
2+pushd %~dp0
3+call _setenv.bat
4+
5+cd %TEMPDIR%
6+
7+if exist %DOWNLOADFILE% rm -rf %DOWNLOADFILE%
8+
9+if exist "%ANGELSCRIPT_ROOT%" rmdir /S /Q "%ANGELSCRIPT_ROOT%"
--- trunk/external/windows/setup/angelscript/vcbuild2008.bat (nonexistent)
+++ trunk/external/windows/setup/angelscript/vcbuild2008.bat (revision 259)
@@ -0,0 +1,15 @@
1+@echo off
2+pushd "%~dp0"
3+call _setenv.bat
4+
5+call vcbuild.bat 2008
6+if errorlevel 1 goto error
7+
8+popd
9+
10+goto end
11+
12+:error
13+pause
14+
15+:end
--- trunk/external/windows/setup/angelscript/_setenv.bat (nonexistent)
+++ trunk/external/windows/setup/angelscript/_setenv.bat (revision 259)
@@ -0,0 +1,13 @@
1+@echo off
2+call ..\setenv.bat
3+
4+SET TARGETNAME=angelscript
5+SET MAJOR=2
6+SET MINOR=22
7+SET BUILD=1
8+
9+SET DOWNLOADFILE=%TARGETNAME%_%MAJOR%.%MINOR%.%BUILD%.zip
10+SET DOWNLOADURL=http://www.angelcode.com/angelscript/sdk/files/%DOWNLOADFILE%
11+
12+SET ANGELSCRIPT_ROOT=%SDK_INSTALLDIR%\%TARGETNAME%
13+SET ANGELSCRIPT_SDK_ROOT=%ANGELSCRIPT_ROOT%\%TARGETNAME%
--- trunk/external/windows/setup/angelscript/download.bat (nonexistent)
+++ trunk/external/windows/setup/angelscript/download.bat (revision 259)
@@ -0,0 +1,38 @@
1+@echo off
2+pushd %~dp0
3+call _setenv.bat
4+
5+cd /d %TEMPDIR%
6+
7+if not exist %DOWNLOADFILE% (
8+ wget %DOWNLOADURL%
9+ if errorlevel 1 (
10+ goto error
11+ )
12+)
13+
14+popd
15+
16+call :expand "%TEMPDIR%\%DOWNLOADFILE%"
17+if errorlevel 1 goto error
18+
19+goto end
20+
21+:error
22+pause
23+popd
24+exit /b 1
25+
26+:end
27+popd
28+exit /b 0
29+
30+:expand
31+if "%~x1" == ".zip" (
32+ unzip "%~1"
33+ if errorlevel 1 exit /b 1
34+ @echo D | xcopy /S /D /Y /Q sdk "%ANGELSCRIPT_ROOT%"
35+ if exist sdk rmdir /S /Q sdk
36+)
37+exit /b 0
38+
--- trunk/external/windows/setup/angelscript/vcbuild.bat (nonexistent)
+++ trunk/external/windows/setup/angelscript/vcbuild.bat (revision 259)
@@ -0,0 +1,78 @@
1+@echo off
2+pushd "%~dp0"
3+call _setenv.bat
4+
5+if "x%~1" == "x" goto error
6+
7+SET VSYEAR=%~1
8+SET VSVER=vs%~1
9+
10+if not exist "%ANGELSCRIPT_ROOT%" goto error
11+if not exist "%ANGELSCRIPT_SDK_ROOT%" goto error
12+
13+SET ANGELSCRIPT_LIB=%ANGELSCRIPT_SDK_ROOT%\lib
14+
15+rem ビルド
16+call "%BAT_TOOLS_ROOT%\msbuildvars.bat" %VSVER%
17+
18+cd %ANGELSCRIPT_SDK_ROOT%
19+if errorlevel 1 goto error
20+
21+cd projects
22+if errorlevel 1 goto error
23+
24+cd msvc%VSMAJOR%
25+if errorlevel 1 goto error
26+
27+SET PROJECT_NAME=angelscript
28+
29+rem build
30+
31+rem MT
32+rem x86
33+msbuild /p:Configuration=Debug /p:Platform=Win32 /t:Rebuild %PROJECT_NAME%.sln
34+if errorlevel 1 goto error
35+msbuild /p:Configuration=Release /p:Platform=Win32 /t:Rebuild %PROJECT_NAME%.sln
36+if errorlevel 1 goto error
37+
38+rem x64
39+msbuild /p:Configuration=Debug /p:Platform=x64 /t:Rebuild %PROJECT_NAME%.sln
40+if errorlevel 1 goto error
41+msbuild /p:Configuration=Release /p:Platform=x64 /t:Rebuild %PROJECT_NAME%.sln
42+if errorlevel 1 goto error
43+
44+@echo F | xcopy /Y /Q "%ANGELSCRIPT_LIB%\%PROJECT_NAME%.lib" "%ANGELSCRIPT_LIB%\%PROJECT_NAME%_static_mt%VSYEAR%.lib"
45+@echo F | xcopy /Y /Q "%ANGELSCRIPT_LIB%\%PROJECT_NAME%d.lib" "%ANGELSCRIPT_LIB%\%PROJECT_NAME%_static_mt%VSYEAR%d.lib"
46+@echo F | xcopy /Y /Q "%ANGELSCRIPT_LIB%\%PROJECT_NAME%64.lib" "%ANGELSCRIPT_LIB%\%PROJECT_NAME%_static_mt%VSYEAR%_x64.lib"
47+@echo F | xcopy /Y /Q "%ANGELSCRIPT_LIB%\%PROJECT_NAME%64d.lib" "%ANGELSCRIPT_LIB%\%PROJECT_NAME%_static_mt%VSYEAR%_x64d.lib"
48+
49+rem MD
50+@echo | sed -e "s/RuntimeLibrary=\"2\"/RuntimeLibrary=\"0\"/g" %PROJECT_NAME%.vcproj > %PROJECT_NAME%.tmp
51+@echo | sed -e "s/RuntimeLibrary=\"3\"/RuntimeLibrary=\"1\"/g" %PROJECT_NAME%.tmp > %PROJECT_NAME%-md.vcproj
52+del %PROJECT_NAME%.tmp
53+
54+rem x86
55+msbuild /p:Configuration=Debug /p:Platform=Win32 /t:Rebuild %PROJECT_NAME%-md.vcproj
56+if errorlevel 1 goto error
57+msbuild /p:Configuration=Release /p:Platform=Win32 /t:Rebuild %PROJECT_NAME%-md.vcproj
58+if errorlevel 1 goto error
59+
60+rem x64
61+msbuild /p:Configuration=Debug /p:Platform=x64 /t:Rebuild %PROJECT_NAME%-md.vcproj
62+if errorlevel 1 goto error
63+msbuild /p:Configuration=Release /p:Platform=x64 /t:Rebuild %PROJECT_NAME%-md.vcproj
64+if errorlevel 1 goto error
65+
66+@echo F | xcopy /Y /Q "%ANGELSCRIPT_LIB%\%PROJECT_NAME%.lib" "%ANGELSCRIPT_LIB%\%PROJECT_NAME%_static_md%VSYEAR%.lib"
67+@echo F | xcopy /Y /Q "%ANGELSCRIPT_LIB%\%PROJECT_NAME%d.lib" "%ANGELSCRIPT_LIB%\%PROJECT_NAME%_static_md%VSYEAR%d.lib"
68+@echo F | xcopy /Y /Q "%ANGELSCRIPT_LIB%\%PROJECT_NAME%64.lib" "%ANGELSCRIPT_LIB%\%PROJECT_NAME%_static_md%VSYEAR%_x64.lib"
69+@echo F | xcopy /Y /Q "%ANGELSCRIPT_LIB%\%PROJECT_NAME%64d.lib" "%ANGELSCRIPT_LIB%\%PROJECT_NAME%_static_md%VSYEAR%_x64d.lib"
70+
71+goto end
72+
73+:error
74+pause
75+
76+:end
77+popd
78+
--- trunk/external/windows/setup/angelscript/setup_env.bat (nonexistent)
+++ trunk/external/windows/setup/angelscript/setup_env.bat (revision 259)
@@ -0,0 +1,16 @@
1+@echo off
2+rem ユーザー環境変数に NACLSDK_ROOT を設定します。
3+
4+pushd "%~dp0"
5+call _setenv.bat
6+
7+@echo ANGELSCRIPT_ROOT=%ANGELSCRIPT_ROOT%> enviroment.dat
8+@echo ANGELSCRIPT_SDK_ROOT=%ANGELSCRIPT_SDK_ROOT%> enviroment.dat
9+
10+call cscript.exe "%WSH_TOOLS_ROOT%\wsh_setenv.wsf" enviroment.dat
11+
12+del /f enviroment.dat
13+
14+exit /b 0
15+
16+:end
--- trunk/external/windows/setup/setenv.bat (revision 258)
+++ trunk/external/windows/setup/setenv.bat (revision 259)
@@ -3,8 +3,12 @@
33 SET TEMPDIR=%~dp0\..\..\temporary
44 SET INSTALLDIR=%~dp0\..\
55 SET TOOL_INSTALLDIR=%INSTALLDIR%\tools
6+SET SDK_INSTALLDIR=%INSTALLDIR%\SDKs
67 SET BAT_TOOLS_ROOT=%~dp0\..\..\..\..\utility\bat
78 SET WSH_TOOLS_ROOT=%~dp0\..\..\..\..\utility\wsh
89
910 SET CYGWIN=nodosfilewarning
1011 if not exist "%TEMPDIR%" mkdir "%TEMPDIR%"
12+
13+if not exist "%TOOL_INSTALLDIR%" mkdir "%TOOL_INSTALLDIR%"
14+if not exist "%SDK_INSTALLDIR%" mkdir "%SDK_INSTALLDIR%"
--- trunk/framework/sample/Windows/unittest/src/iml_test/test_iml_math.cpp (revision 258)
+++ trunk/framework/sample/Windows/unittest/src/iml_test/test_iml_math.cpp (revision 259)
@@ -63,3 +63,19 @@
6363 ASSERT_EQ( 5, iml::static_log2<32>::value );
6464 ASSERT_EQ( 16, iml::static_log2<0x10000>::value );
6565 }
66+
67+TEST(iml_mathTest, signed_lshift)
68+{
69+ ASSERT_EQ( 4, iml::signed_lshift< 1>::shift(2) );
70+ ASSERT_EQ( 1, iml::signed_lshift<-1>::shift(2) );
71+ ASSERT_EQ( 16, iml::signed_lshift< 4>::shift(1) );
72+ ASSERT_EQ( 0, iml::signed_lshift<-8>::shift<u8>(1) );
73+}
74+
75+TEST(iml_mathTest, signed_rshift)
76+{
77+ ASSERT_EQ( 4, iml::signed_rshift<-1>::shift(2) );
78+ ASSERT_EQ( 1, iml::signed_rshift< 1>::shift(2) );
79+ ASSERT_EQ( 16, iml::signed_rshift<-4>::shift(1) );
80+ ASSERT_EQ( 0, iml::signed_rshift< 8>::shift<u8>(1) );
81+}
--- trunk/framework/sample/Windows/unittest/src/fnd_image_test/test_color.cpp (revision 258)
+++ trunk/framework/sample/Windows/unittest/src/fnd_image_test/test_color.cpp (revision 259)
@@ -51,7 +51,7 @@
5151 ASSERT_FLOAT_EQ( 1.0f, fclr1.r );
5252 ASSERT_FLOAT_EQ( 0.8f, fclr1.g );
5353 ASSERT_FLOAT_EQ( 0.4f, fclr1.b );
54- ASSERT_FLOAT_EQ( 0.0f, fclr1.a );
54+ ASSERT_FLOAT_EQ( 1.0f, fclr1.a );
5555
5656 ASSERT_FLOAT_EQ( 1.0f, fclr2.r );
5757 ASSERT_FLOAT_EQ( 0.8f, fclr2.g );
@@ -63,3 +63,132 @@
6363 ASSERT_FLOAT_EQ( 0.4f, fclr3.b );
6464 ASSERT_FLOAT_EQ( 1.0f, fclr3.a );
6565 }
66+
67+typedef testing::Types< CRGBA8888, CCOLORREF, CRGB565 > FormatTypeParams;
68+
69+template<typename T>
70+class FndColorTypesTest : public testing::TestWithParam<T>
71+{
72+};
73+
74+TYPED_TEST_CASE(FndColorTypesTest, FormatTypeParams);
75+
76+TYPED_TEST(FndColorTypesTest, construct)
77+{
78+ ParamType color;
79+ ASSERT_EQ(0, color.r());
80+ ASSERT_EQ(0, color.g());
81+ ASSERT_EQ(0, color.b());
82+ ASSERT_EQ(0, color.a());
83+}
84+
85+TYPED_TEST(FndColorTypesTest, size)
86+{
87+ ASSERT_EQ(sizeof(ParamType::value_type), sizeof(ParamType));
88+}
89+
90+TYPED_TEST(FndColorTypesTest, white)
91+{
92+ ParamType color(CRGBA8888(0xFFFFFFFFu));
93+ IrisFColor frgb = color;
94+ ASSERT_FLOAT_EQ(1.0f, frgb.r);
95+ ASSERT_FLOAT_EQ(1.0f, frgb.g);
96+ ASSERT_FLOAT_EQ(1.0f, frgb.b);
97+ ASSERT_FLOAT_EQ(1.0f, frgb.a);
98+}
99+
100+TYPED_TEST(FndColorTypesTest, convert)
101+{
102+ u8 r = static_cast<u8>((rand()>>4) & 0xFF);
103+ u8 g = static_cast<u8>((rand()>>4) & 0xFF);
104+ u8 b = static_cast<u8>((rand()>>4) & 0xFF);
105+ u8 a = static_cast<u8>((rand()>>4) & 0xFF);
106+ CRGBA8888 rgba( r, g, b, a );
107+ ParamType color(rgba);
108+ CRGBA8888 rgba_dst = color;
109+
110+ // 精度が違う
111+ int ar = 1<<abs(CRGBA8888::BSZ_R - ParamType::BSZ_R);
112+ int ag = 1<<abs(CRGBA8888::BSZ_G - ParamType::BSZ_G);
113+ int ab = 1<<abs(CRGBA8888::BSZ_B - ParamType::BSZ_B);
114+ int aa = 1<<abs(CRGBA8888::BSZ_A - ParamType::BSZ_A);
115+ ASSERT_NEAR(rgba.r(), rgba_dst.r(), ar);
116+ ASSERT_NEAR(rgba.g(), rgba_dst.g(), ag);
117+ ASSERT_NEAR(rgba.b(), rgba_dst.b(), ab);
118+ ASSERT_NEAR(rgba.a(), rgba_dst.a(), aa);
119+}
120+
121+TYPED_TEST(FndColorTypesTest, convert_from_float)
122+{
123+ IrisFColor rgba;
124+ rgba.r = ((rand()>>4) & 0xFF) / 255.0f;
125+ rgba.g = ((rand()>>4) & 0xFF) / 255.0f;
126+ rgba.b = ((rand()>>4) & 0xFF) / 255.0f;
127+ rgba.a = ((rand()>>4) & 0xFF) / 255.0f;
128+ ParamType color(rgba);
129+ IrisFColor rgba_dst = color;
130+
131+ // 精度が違う
132+ float ar = ParamType::BSZ_R ? ((1<<ParamType::BSZ_R)-1) : 1.0f;
133+ float ag = ParamType::BSZ_G ? ((1<<ParamType::BSZ_G)-1) : 1.0f;
134+ float ab = ParamType::BSZ_B ? ((1<<ParamType::BSZ_B)-1) : 1.0f;
135+ float aa = ParamType::BSZ_A ? ((1<<ParamType::BSZ_A)-1) : 1.0f;
136+ ASSERT_NEAR(rgba.r, rgba_dst.r, 1.0f/ar);
137+ ASSERT_NEAR(rgba.g, rgba_dst.g, 1.0f/ag);
138+ ASSERT_NEAR(rgba.b, rgba_dst.b, 1.0f/ab);
139+ ASSERT_NEAR(rgba.a, rgba_dst.a, 1.0f/aa);
140+}
141+
142+TYPED_TEST(FndColorTypesTest, buffer_read)
143+{
144+ /*
145+ * 仮想テーブルを持たないので、バッファとしてそのまま使える
146+ */
147+ const int bufsize = 100;
148+ ParamType color[bufsize];
149+ ParamType::value_type buf[bufsize];
150+
151+ for( int i=0; i < bufsize; ++i )
152+ {
153+ u8 r = static_cast<u8>((rand()>>4) & 0xFF);
154+ u8 g = static_cast<u8>((rand()>>4) & 0xFF);
155+ u8 b = static_cast<u8>((rand()>>4) & 0xFF);
156+ u8 a = static_cast<u8>((rand()>>4) & 0xFF);
157+ CRGBA8888 rgba( r, g, b, a );
158+ color[i] = rgba;
159+ buf[i] = color[i];
160+ }
161+
162+ ParamType* pc = pointer_cast<ParamType*>(buf);
163+ for( int i=0; i < bufsize; ++i, ++pc )
164+ {
165+ ASSERT_EQ( color[i], *pc );
166+ }
167+}
168+
169+TYPED_TEST(FndColorTypesTest, buffer_write)
170+{
171+ /*
172+ * 仮想テーブルを持たないので、バッファとしてそのまま使える
173+ */
174+ const int bufsize = 100;
175+ ParamType color[bufsize];
176+ ParamType::value_type buf[bufsize];
177+
178+ ParamType* pc = pointer_cast<ParamType*>(buf);
179+ for( int i=0; i < bufsize; ++i, ++pc )
180+ {
181+ u8 r = static_cast<u8>((rand()>>4) & 0xFF);
182+ u8 g = static_cast<u8>((rand()>>4) & 0xFF);
183+ u8 b = static_cast<u8>((rand()>>4) & 0xFF);
184+ u8 a = static_cast<u8>((rand()>>4) & 0xFF);
185+ CRGBA8888 rgba( r, g, b, a );
186+ color[i] = rgba;
187+ *pc = rgba;
188+ }
189+
190+ for( int i=0; i < bufsize; ++i, ++pc )
191+ {
192+ ASSERT_EQ( color[i], buf[i] );
193+ }
194+}
--- trunk/framework/src/unit/target/UnitMultiUnitTest.cpp (revision 258)
+++ trunk/framework/src/unit/target/UnitMultiUnitTest.cpp (revision 259)
@@ -26,7 +26,7 @@
2626 #include "../../iris_main.h"
2727 #include "../../iris_global.h"
2828 #include "../gt/gt_inchead.h"
29-#include <tchar.h>
29+#include "../../iris_tchar.h"
3030
3131 namespace iris {
3232 namespace unit
@@ -124,8 +124,8 @@
124124 }
125125
126126 // 優先的に処理
127- if( _tcscmp(name, IRIS_TEXT("quit")) == 0 ) return false;
128- if( _tcscmp(name, IRIS_TEXT("list")) == 0 )
127+ if( _tcsequ(name, IRIS_TEXT("quit")) ) return false;
128+ if( _tcsequ(name, IRIS_TEXT("list")) )
129129 {
130130 // リスト表示
131131 #ifdef _IRIS_DEBUG
--- trunk/framework/src/unit/UnitCore.cpp (revision 258)
+++ trunk/framework/src/unit/UnitCore.cpp (revision 259)
@@ -36,7 +36,7 @@
3636 //======================================================================
3737 // typedef
3838 #include "target/UnitMultiUnitTest.h"
39-#include <tchar.h>
39+#include "../iris_tchar.h"
4040
4141 #endif // #ifdef _IRIS_MULTI_UNITTEST
4242
@@ -72,7 +72,7 @@
7272 {
7373 for( int i=0; i < argc; ++i )
7474 {
75- if( _tcscmp( irisGetArgvN(i), IRIS_TEXT("all") ) == 0 )
75+ if( _tcsequ( irisGetArgvN(i), IRIS_TEXT("all") ) )
7676 {
7777 mut->RunAll();
7878 all = true;
--- trunk/framework/src/platform/windows/win/app/WXMDIApplication.cpp (revision 258)
+++ trunk/framework/src/platform/windows/win/app/WXMDIApplication.cpp (revision 259)
@@ -8,7 +8,7 @@
88 * @version 1.0
99 *
1010 * @par copyright
11- * Copyright (C) 2009-2011 Takazumi Shirayanagi\n
11+ * Copyright (C) 2009-2012 Takazumi Shirayanagi\n
1212 * The new BSD License is applied to this software.
1313 * see iris_LICENSE.txt
1414 */
@@ -21,7 +21,7 @@
2121 #include "WXMDIApplication.h"
2222 #include "../wx_inchead.h"
2323 #include <commctrl.h>
24-#include <tchar.h>
24+#include "iris_tchar.h"
2525 #include "iris_debug.h"
2626
2727 #include "../debug/WXDebugLeakCheckMacro.h"
@@ -514,7 +514,7 @@
514514 if( ::IsWindowVisible(hWnd) )
515515 {
516516 ::GetClassName(hWnd, cls_name, 64);
517- if( _tcscmp(cls_name, STATUSCLASSNAME) == 0 )
517+ if( _tcsequ(cls_name, STATUSCLASSNAME) )
518518 {
519519 RECT rc;
520520 int height = 0;
--- trunk/framework/src/platform/windows/win/xml/WXMSXMLNode.cpp (revision 258)
+++ trunk/framework/src/platform/windows/win/xml/WXMSXMLNode.cpp (revision 259)
@@ -8,7 +8,7 @@
88 * @version 1.0
99 *
1010 * @par copyright
11- * Copyright (C) 2011 Takazumi Shirayanagi\n
11+ * Copyright (C) 2011-2012 Takazumi Shirayanagi\n
1212 * The new BSD License is applied to this software.
1313 * see iris_LICENSE.txt
1414 */
@@ -124,7 +124,7 @@
124124 for( int i=0; i < childs->length; ++i )
125125 {
126126 INodePtr node = childs->item[i];
127- if( _tcscmp(lpszNodeName, (LPCTSTR)node->nodeName) == 0 ) return node;
127+ if( _tcsequ(lpszNodeName, (LPCTSTR)node->nodeName) ) return node;
128128 }
129129 return NULL;
130130 }
--- trunk/framework/src/iris_tchar.h (revision 258)
+++ trunk/framework/src/iris_tchar.h (revision 259)
@@ -8,7 +8,7 @@
88 * @version 1.0
99 *
1010 * @par copyright
11- * Copyright (C) 2011 Takazumi Shirayanagi\n
11+ * Copyright (C) 2011-2012 Takazumi Shirayanagi\n
1212 * The new BSD License is applied to this software.
1313 * see iris_LICENSE.txt
1414 */
@@ -35,3 +35,11 @@
3535 #endif
3636
3737 #endif
38+
39+#ifndef _tcsequ
40+# ifdef UNICODE
41+# define _tcsequ(a, b) (wcscmp(a, b) == 0)
42+# else
43+# define _tcsequ(a, b) (strcmp(a, b) == 0)
44+# endif
45+#endif
--- trunk/framework/src/fnd/image/FndBitmap.cpp (revision 258)
+++ trunk/framework/src/fnd/image/FndBitmap.cpp (revision 259)
@@ -8,7 +8,7 @@
88 * @version 1.0
99 *
1010 * @par copyright
11- * Copyright (C) 2009-2011 Takazumi Shirayanagi\n
11+ * Copyright (C) 2009-2012 Takazumi Shirayanagi\n
1212 * The new BSD License is applied to this software.
1313 * see iris_LICENSE.txt
1414 */
@@ -493,7 +493,7 @@
493493 ++i;
494494 int p2 = 0;
495495 if( w+i < tw ) p2 = (*inpx & (0x01 << i)) >> i;
496- *otpx = ((p1 << 4) & 0xF0) | (p2 & 0x0F);
496+ *otpx = static_cast<u8>( ((p1 << 4) & 0xF0) | (p2 & 0x0F) );
497497 ++otpx;
498498 }
499499 ++inpx;
--- trunk/framework/src/fnd/image/FndColor.h (revision 258)
+++ trunk/framework/src/fnd/image/FndColor.h (revision 259)
@@ -22,6 +22,7 @@
2222 #include "../../iris_object.h"
2323 #include "../../iris_debug.h"
2424 #include "../../c++0x/cpp0x_enable_if.hpp"
25+#include "../../ml/iml_math.hpp"
2526
2627 namespace iris {
2728 namespace fnd
@@ -120,9 +121,9 @@
120121 CColor(value_type_r _r, value_type_g _g, value_type_b _b, value_type_a _a=0) : m_col(0) { r(_r); g(_g); b(_b); a(_a); }
121122 CColor(const IrisFColor& fcol) : m_col(0) { copy(fcol); }
122123
123- template<typename _OTN, int _ORBITS, int _OGBITS, int _OBBITS, int _OABITS
124- , int _ORSHIFT, int _OGSHIFT, int _OBSHIFT, int _OASHIFT>
125- CColor(const CColor<_OTN, _ORBITS, _OGBITS, _OBBITS, _OABITS, _ORSHIFT, _OGSHIFT, _OBSHIFT, _OASHIFT>& rObj)
124+ template<typename OTN_, int ORBITS_, int OGBITS_, int OBBITS_, int OABITS_
125+ , int ORSHIFT_, int OGSHIFT_, int OBSHIFT_, int OASHIFT_>
126+ CColor(const CColor<OTN_, ORBITS_, OGBITS_, OBBITS_, OABITS_, ORSHIFT_, OGSHIFT_, OBSHIFT_, OASHIFT_>& rObj)
126127 : m_col(0)
127128 {
128129 r(rObj);
@@ -151,6 +152,41 @@
151152 a( static_cast<value_type_a>( a() * rate ) );
152153 return *this;
153154 }
155+
156+
157+ bool operator == (value_type rhs) const
158+ {
159+ return m_col == rhs;
160+ }
161+ bool operator == (const _Myt& rhs) const
162+ {
163+ return m_col == rhs.m_col;
164+ }
165+ template<typename OTN_, int ORBITS_, int OGBITS_, int OBBITS_, int OABITS_
166+ , int ORSHIFT_, int OGSHIFT_, int OBSHIFT_, int OASHIFT_>
167+ bool operator == (const CColor<OTN_, ORBITS_, OGBITS_, OBBITS_, OABITS_, ORSHIFT_, OGSHIFT_, OBSHIFT_, OASHIFT_>& rhs) const
168+ {
169+ // lhs の精度に合わせる
170+ _Myt tmp(rhs);
171+ return *this == tmp;
172+ }
173+
174+ bool operator != (value_type rhs) const
175+ {
176+ return m_col != rhs;
177+ }
178+ bool operator != (const _Myt& rhs) const
179+ {
180+ return m_col == rhs.m_col;
181+ }
182+ template<typename OTN_, int ORBITS_, int OGBITS_, int OBBITS_, int OABITS_
183+ , int ORSHIFT_, int OGSHIFT_, int OBSHIFT_, int OASHIFT_>
184+ bool operator != (const CColor<OTN_, ORBITS_, OGBITS_, OBBITS_, OABITS_, ORSHIFT_, OGSHIFT_, OBSHIFT_, OASHIFT_>& rhs) const
185+ {
186+ // lhs の精度に合わせる
187+ _Myt tmp(rhs);
188+ return *this != tmp;
189+ }
154190 /**
155191 * @}
156192 */
@@ -162,7 +198,7 @@
162198 */
163199 constexpr value_type_r max_r(void) const { return (((value_type_r)1<<BSZ_R)-1); }
164200 constexpr value_type_g max_g(void) const { return (((value_type_g)1<<BSZ_G)-1); }
165- constexpr value_type_g max_b(void) const { return (((value_type_b)1<<BSZ_B)-1); }
201+ constexpr value_type_b max_b(void) const { return (((value_type_b)1<<BSZ_B)-1); }
166202 constexpr value_type_a max_a(void) const { return (((value_type_a)1<<BSZ_A)-1); }
167203 /**
168204 * @}
@@ -188,67 +224,63 @@
188224 void r(value_type_r v) { value_type max = (value_type)max_r(); m_col &= ~(max << SFT_R); m_col |= ((v > max ? max : (value_type)v)) << SFT_R; }
189225 void g(value_type_g v) { value_type max = (value_type)max_g(); m_col &= ~(max << SFT_G); m_col |= ((v > max ? max : (value_type)v)) << SFT_G; }
190226 void b(value_type_b v) { value_type max = (value_type)max_b(); m_col &= ~(max << SFT_B); m_col |= ((v > max ? max : (value_type)v)) << SFT_B; }
191- void a(value_type_a v) { value_type max = (value_type)max_a(); m_col &= ~(max << SFT_A); m_col |= ((v > max ? max : (value_type)v)) << SFT_A; }
227+ void a(value_type_a v) { a_<BSZ_A>(v); }
192228
193- template<typename _OTN, int _ORBITS, int _OGBITS, int _OBBITS, int _OABITS
194- , int _ORSHIFT, int _OGSHIFT, int _OBSHIFT, int _OASHIFT>
195- void r(const CColor<_OTN, _ORBITS, _OGBITS, _OBBITS, _OABITS, _ORSHIFT, _OGSHIFT, _OBSHIFT, _OASHIFT>& rObj)
229+ template<typename OTN_, int ORBITS_, int OGBITS_, int OBBITS_, int OABITS_
230+ , int ORSHIFT_, int OGSHIFT_, int OBSHIFT_, int OASHIFT_>
231+ void r(const CColor<OTN_, ORBITS_, OGBITS_, OBBITS_, OABITS_, ORSHIFT_, OGSHIFT_, OBSHIFT_, OASHIFT_>& rObj)
196232 {
197- f32 v = static_cast<f32>(rObj.r()) / rObj.max_r();
198- r(static_cast<value_type_r>(v * max_r()));
233+ r( iml::signed_lshift<BSZ_R-ORBITS_>::shift<value_type_r>(rObj.r()) );
199234 }
200- template<typename _OTN, int _OGBITS, int _OBBITS, int _OABITS
201- , int _ORSHIFT, int _OGSHIFT, int _OBSHIFT, int _OASHIFT>
202- void r(const CColor<_OTN, BSZ_R, _OGBITS, _OBBITS, _OABITS, _ORSHIFT, _OGSHIFT, _OBSHIFT, _OASHIFT>& rObj)
235+ template<typename OTN_, int OGBITS_, int OBBITS_, int OABITS_
236+ , int ORSHIFT_, int OGSHIFT_, int OBSHIFT_, int OASHIFT_>
237+ void r(const CColor<OTN_, BSZ_R, OGBITS_, OBBITS_, OABITS_, ORSHIFT_, OGSHIFT_, OBSHIFT_, OASHIFT_>& rObj)
203238 {
204239 r(rObj.r());
205240 }
206241
207- template<typename _OTN, int _ORBITS, int _OGBITS, int _OBBITS, int _OABITS
208- , int _ORSHIFT, int _OGSHIFT, int _OBSHIFT, int _OASHIFT>
209- void g(const CColor<_OTN, _ORBITS, _OGBITS, _OBBITS, _OABITS, _ORSHIFT, _OGSHIFT, _OBSHIFT, _OASHIFT>& rObj)
242+ template<typename OTN_, int ORBITS_, int OGBITS_, int OBBITS_, int OABITS_
243+ , int ORSHIFT_, int OGSHIFT_, int OBSHIFT_, int OASHIFT_>
244+ void g(const CColor<OTN_, ORBITS_, OGBITS_, OBBITS_, OABITS_, ORSHIFT_, OGSHIFT_, OBSHIFT_, OASHIFT_>& rObj)
210245 {
211- f32 v = static_cast<f32>(rObj.g()) / rObj.max_g();
212- g(static_cast<value_type_g>(v * max_g()));
246+ g( iml::signed_lshift<BSZ_G-OGBITS_>::shift<value_type_g>(rObj.g()) );
213247 }
214- template<typename _OTN, int _ORBITS, int _OBBITS, int _OABITS
215- , int _ORSHIFT, int _OGSHIFT, int _OBSHIFT, int _OASHIFT>
216- void g(const CColor<_OTN, _ORBITS, BSZ_G, _OBBITS, _OABITS, _ORSHIFT, _OGSHIFT, _OBSHIFT, _OASHIFT>& rObj)
248+ template<typename OTN_, int ORBITS_, int OBBITS_, int OABITS_
249+ , int ORSHIFT_, int OGSHIFT_, int OBSHIFT_, int OASHIFT_>
250+ void g(const CColor<OTN_, ORBITS_, BSZ_G, OBBITS_, OABITS_, ORSHIFT_, OGSHIFT_, OBSHIFT_, OASHIFT_>& rObj)
217251 {
218252 g(rObj.g());
219253 }
220254
221- template<typename _OTN, int _ORBITS, int _OGBITS, int _OBBITS, int _OABITS
222- , int _ORSHIFT, int _OGSHIFT, int _OBSHIFT, int _OASHIFT>
223- void b(const CColor<_OTN, _ORBITS, _OGBITS, _OBBITS, _OABITS, _ORSHIFT, _OGSHIFT, _OBSHIFT, _OASHIFT>& rObj)
255+ template<typename OTN_, int ORBITS_, int OGBITS_, int OBBITS_, int OABITS_
256+ , int ORSHIFT_, int OGSHIFT_, int OBSHIFT_, int OASHIFT_>
257+ void b(const CColor<OTN_, ORBITS_, OGBITS_, OBBITS_, OABITS_, ORSHIFT_, OGSHIFT_, OBSHIFT_, OASHIFT_>& rObj)
224258 {
225- f32 v = static_cast<f32>(rObj.b()) / rObj.max_b();
226- b(static_cast<value_type_b>(v * max_b()));
259+ b( iml::signed_lshift<BSZ_B-OBBITS_>::shift<value_type_b>(rObj.b()) );
227260 }
228- template<typename _OTN, int _ORBITS, int _OGBITS, int _OABITS
229- , int _ORSHIFT, int _OGSHIFT, int _OBSHIFT, int _OASHIFT>
230- void b(const CColor<_OTN, _ORBITS, _OGBITS, BSZ_B, _OABITS, _ORSHIFT, _OGSHIFT, _OBSHIFT, _OASHIFT>& rObj)
261+ template<typename OTN_, int ORBITS_, int OGBITS_, int OABITS_
262+ , int ORSHIFT_, int OGSHIFT_, int OBSHIFT_, int OASHIFT_>
263+ void b(const CColor<OTN_, ORBITS_, OGBITS_, BSZ_B, OABITS_, ORSHIFT_, OGSHIFT_, OBSHIFT_, OASHIFT_>& rObj)
231264 {
232265 b(rObj.b());
233266 }
234267
235- template<typename _OTN, int _ORBITS, int _OGBITS, int _OBBITS, int _OABITS
236- , int _ORSHIFT, int _OGSHIFT, int _OBSHIFT, int _OASHIFT>
237- void a(const CColor<_OTN, _ORBITS, _OGBITS, _OBBITS, _OABITS, _ORSHIFT, _OGSHIFT, _OBSHIFT, _OASHIFT>& rObj, typename enable_if<(_OABITS!=0)>::type*& = cpp0x::enabler::value)
268+ template<typename OTN_, int ORBITS_, int OGBITS_, int OBBITS_, int OABITS_
269+ , int ORSHIFT_, int OGSHIFT_, int OBSHIFT_, int OASHIFT_>
270+ void a(const CColor<OTN_, ORBITS_, OGBITS_, OBBITS_, OABITS_, ORSHIFT_, OGSHIFT_, OBSHIFT_, OASHIFT_>& rObj, typename enable_if<(OABITS_!=0)>::type*& = cpp0x::enabler::value)
238271 {
239- f32 v = static_cast<f32>(rObj.a()) / rObj.max_a();
240- a(static_cast<value_type_a>(v * max_a()));
272+ a( iml::signed_lshift<BSZ_A-OABITS_>::shift<value_type_a>(rObj.a()) );
241273 }
242- template<typename _OTN, int _ORBITS, int _OGBITS, int _OBBITS, int _OABITS
243- , int _ORSHIFT, int _OGSHIFT, int _OBSHIFT, int _OASHIFT>
244- void a(const CColor<_OTN, _ORBITS, _OGBITS, _OBBITS, _OABITS, _ORSHIFT, _OGSHIFT, _OBSHIFT, _OASHIFT>& rObj, typename enable_if<(_OABITS==0)>::type*& = cpp0x::enabler::value)
274+ template<typename OTN_, int ORBITS_, int OGBITS_, int OBBITS_, int OABITS_
275+ , int ORSHIFT_, int OGSHIFT_, int OBSHIFT_, int OASHIFT_>
276+ void a(const CColor<OTN_, ORBITS_, OGBITS_, OBBITS_, OABITS_, ORSHIFT_, OGSHIFT_, OBSHIFT_, OASHIFT_>& rObj, typename enable_if<(OABITS_==0)>::type*& = cpp0x::enabler::value)
245277 {
246278 IRIS_UNUSED_VAR(rObj);
247279 a(max_a());
248280 }
249- template<typename _OTN, int _ORBITS, int _OGBITS, int _OBBITS
250- , int _ORSHIFT, int _OGSHIFT, int _OBSHIFT, int _OASHIFT>
251- void a(const CColor<_OTN, _ORBITS, _OGBITS, _OBBITS, BSZ_A, _ORSHIFT, _OGSHIFT, _OBSHIFT, _OASHIFT>& rObj)
281+ template<typename OTN_, int ORBITS_, int OGBITS_, int OBBITS_
282+ , int ORSHIFT_, int OGSHIFT_, int OBSHIFT_, int OASHIFT_>
283+ void a(const CColor<OTN_, ORBITS_, OGBITS_, OBBITS_, BSZ_A, ORSHIFT_, OGSHIFT_, OBSHIFT_, OASHIFT_>& rObj)
252284 {
253285 a(rObj.a());
254286 }
@@ -260,10 +292,11 @@
260292 /// 浮動小数カラー型に変換
261293 void cast(IrisFColor& rfcol) const
262294 {
295+ // BSZ_* は定数なので最適化に期待
263296 rfcol.r = BSZ_R ? static_cast<f32>(r()) / max_r() : 0.f;
264297 rfcol.g = BSZ_G ? static_cast<f32>(g()) / max_g() : 0.f;
265298 rfcol.b = BSZ_B ? static_cast<f32>(b()) / max_b() : 0.f;
266- rfcol.a = BSZ_A ? static_cast<f32>(a()) / max_a() : 0.f; // 1.f;
299+ rfcol.a = BSZ_A ? static_cast<f32>(a()) / max_a() : 1.f;
267300 }
268301
269302 /// 浮動小数カラー型からコピー
@@ -278,8 +311,14 @@
278311 public:
279312 IrisFColor Normalize(void) const { IrisFColor fcol; cast(fcol); return fcol; }
280313 public:
281- operator value_type (void) { return m_col; }
282- operator IrisFColor (void) { return Normalize(); }
314+ operator value_type (void) const { return m_col; }
315+ operator IrisFColor (void) const { return Normalize(); }
316+
317+private:
318+ template<int SIZE>
319+ void a_(value_type_a v) { value_type max = (value_type)max_a(); m_col &= ~(max << SFT_A); m_col |= ((v > max ? max : (value_type)v)) << SFT_A; }
320+ template<>
321+ void a_<0>(value_type_a /*v*/) {};
283322 };
284323
285324 } // end of namespace fnd
--- trunk/framework/src/fnd/format/FndFixedFloat.h (revision 258)
+++ trunk/framework/src/fnd/format/FndFixedFloat.h (revision 259)
@@ -8,7 +8,7 @@
88 * @version 1.0
99 *
1010 * @par copyright
11- * Copyright (C) 2011 Takazumi Shirayanagi\n
11+ * Copyright (C) 2011-2012 Takazumi Shirayanagi\n
1212 * The new BSD License is applied to this software.
1313 * see iris_LICENSE.txt
1414 */
@@ -167,7 +167,7 @@
167167 TYPE v = (TYPE)(fx.value() & iml::static_mask<fx.INTSIZE + fx.DECSIZE>::value);
168168
169169 m_value = (value_type)(fx.value() & iml::static_mask<fx.SIGN, fx.INTSIZE + fx.DECSIZE>::value);
170- m_value |= iml::signed_rshift<TYPE, fx.DECSIZE - DECSIZE>::shift( v ) & iml::static_mask<INTSIZE + DECSIZE>::value;
170+ m_value |= iml::signed_rshift<fx.DECSIZE - DECSIZE>::shift<TYPE>( v ) & iml::static_mask<INTSIZE + DECSIZE>::value;
171171 }
172172
173173 private:
--- trunk/framework/src/fnd/format/FndIEEE.h (revision 258)
+++ trunk/framework/src/fnd/format/FndIEEE.h (revision 259)
@@ -8,7 +8,7 @@
88 * @version 1.0
99 *
1010 * @par copyright
11- * Copyright (C) 2011 Takazumi Shirayanagi\n
11+ * Copyright (C) 2011-2012 Takazumi Shirayanagi\n
1212 * The new BSD License is applied to this software.
1313 * see iris_LICENSE.txt
1414 */
@@ -130,9 +130,9 @@
130130 return;
131131 }
132132 }
133- m_value = (value_type)(iml::signed_rshift<IrisU32, (floatType::FUNC+floatType::EXP)-(FUNC+EXP)>::shift(fi.iv) & iml::static_mask<1, EXP+FUNC>::value);
133+ m_value = (value_type)(iml::signed_rshift<(floatType::FUNC+floatType::EXP)-(FUNC+EXP)>::shift<IrisU32>(fi.iv) & iml::static_mask<1, EXP+FUNC>::value);
134134 m_value |= exp << FUNC;
135- m_value |= iml::signed_rshift<IrisU32, floatType::FUNC-FUNC>::shift( fi.iv & iml::static_mask<floatType::FUNC>::value );
135+ m_value |= iml::signed_rshift<floatType::FUNC-FUNC>::shift<IrisU32>( fi.iv & iml::static_mask<floatType::FUNC>::value );
136136 }
137137 template<typename _XTN, int _XSIGN, int _XEXP, int _XFUNC, int _XBIAS>
138138 void cast_from_ieee(const CIEEE754<_XTN, _XSIGN, _XEXP, _XFUNC, _XBIAS>& ieee)
@@ -154,9 +154,9 @@
154154 return;
155155 }
156156 }
157- m_value = (value_type)(iml::signed_rshift<value_type, (_XFUNC+_XEXP)-(FUNC+EXP)>::shift(value) & iml::static_mask<1, EXP+FUNC>::value);
157+ m_value = static_cast<value_type>(iml::signed_rshift<(_XFUNC+_XEXP)-(FUNC+EXP)>::shift<value_type>(value) & iml::static_mask<1, EXP+FUNC>::value);
158158 m_value |= exp << FUNC;
159- m_value |= iml::signed_rshift<value_type, _XFUNC-FUNC>::shift( value & iml::static_mask<_XFUNC>::value );
159+ m_value |= iml::signed_rshift<_XFUNC-FUNC>::shift<value_type>( value & iml::static_mask<_XFUNC>::value );
160160 }
161161
162162 float cast_to_float(void) const
--- trunk/framework/src/fnd/charcode/FndBaseEncoding.cpp (revision 258)
+++ trunk/framework/src/fnd/charcode/FndBaseEncoding.cpp (revision 259)
@@ -8,7 +8,7 @@
88 * @version 1.0
99 *
1010 * @par copyright
11- * Copyright (C) 2011 Takazumi Shirayanagi\n
11+ * Copyright (C) 2011-2012 Takazumi Shirayanagi\n
1212 * The new BSD License is applied to this software.
1313 * see iris_LICENSE.txt
1414 */
@@ -20,6 +20,7 @@
2020 // include
2121 #include "FndBaseEncoding.h"
2222 #include "../../iris_xchar.hpp"
23+#include "../../iris_tchar.h"
2324 #include "../../iris_debug.h"
2425
2526 namespace iris {
@@ -407,7 +408,7 @@
407408 _tprintf(out);
408409 _tprintf(IRIS_TEXT("\n"));
409410
410- IRIS_ASSERT( _tcscmp(buf, out) == 0 );
411+ IRIS_ASSERT( _tcsequ(buf, out) );
411412 }
412413 }
413414
@@ -433,7 +434,7 @@
433434 _tprintf(out);
434435 _tprintf(IRIS_TEXT("\n"));
435436
436- IRIS_ASSERT( _tcscmp(buf, out) == 0 );
437+ IRIS_ASSERT( _tcsequ(buf, out) );
437438 }
438439 }
439440
@@ -459,7 +460,7 @@
459460 _tprintf(out);
460461 _tprintf(IRIS_TEXT("\n"));
461462
462- IRIS_ASSERT( _tcscmp(buf, out) == 0 );
463+ IRIS_ASSERT( _tcsequ(buf, out) );
463464 }
464465 }
465466
@@ -485,7 +486,7 @@
485486 _tprintf(out);
486487 _tprintf(IRIS_TEXT("\n"));
487488
488- IRIS_ASSERT( _tcscmp(buf, out) == 0 );
489+ IRIS_ASSERT( _tcsequ(buf, out) );
489490 }
490491 }
491492
--- trunk/framework/src/ml/math/iml_shift.hpp (revision 258)
+++ trunk/framework/src/ml/math/iml_shift.hpp (revision 259)
@@ -8,7 +8,7 @@
88 * @version 1.0
99 *
1010 * @par copyright
11- * Copyright (C) 2011 Takazumi Shirayanagi\n
11+ * Copyright (C) 2011-2012 Takazumi Shirayanagi\n
1212 * The new BSD License is applied to this software.
1313 * see iris_LICENSE.txt
1414 */
@@ -70,41 +70,59 @@
7070 /**
7171 * @brief 符号付き左シフト
7272 */
73-template<typename TN, intmax_t SHIFT>
73+template<intmax_t SHIFT>
7474 class signed_lshift
7575 {
76- template<intmax_t TS, intmax_t SIGN>
76+ template<typename TN, intmax_t TS, intmax_t SIGN>
7777 struct shift_impl
7878 {
7979 static TN shift(TN v) { return v << TS; }
8080 };
81- template<intmax_t TS>
82- struct shift_impl<TS, -1>
81+ template<typename TN, intmax_t TS>
82+ struct shift_impl<TN, TS, -1>
8383 {
84- static TN shift(TN v) { return v >> static_abs<TS>::value; }
84+ // warning C4333: '>>' : 右シフトの回数が多すぎます。データが失われる可能性があります
85+ // への対応
86+ template<bool b, intmax_t TTS>
87+ struct impl
88+ {
89+ static TN shift(TN v) { return v >> TTS; }
90+ };
91+ template<intmax_t TTS>
92+ struct impl<true, TTS>
93+ {
94+ static TN shift(TN /*v*/) { return 0; }
95+ };
96+
97+ static TN shift(TN v)
98+ {
99+ return impl< ((sizeof(TN)*8) <= (-TS)), -TS >::shift(v);
100+ }
85101 };
86102 public:
87- static TN shift(TN v) { return shift_impl<SHIFT, static_sign<SHIFT>::value>::shift(v); }
103+ template<typename TN>
104+ static TN shift(TN v) { return shift_impl<TN, SHIFT, static_sign<SHIFT>::value>::shift(v); }
88105 };
89106
90107 /**
91108 * @brief 符号付き右シフト
92109 */
93-template<typename TN, intmax_t SHIFT>
110+template<intmax_t SHIFT>
94111 class signed_rshift
95112 {
96- template<intmax_t TS, intmax_t SIGN>
113+ template<typename TN, intmax_t TS, intmax_t SIGN>
97114 struct shift_impl
98115 {
99116 static TN shift(TN v) { return v >> TS; }
100117 };
101- template<intmax_t TS>
102- struct shift_impl<TS, -1>
118+ template<typename TN, intmax_t TS>
119+ struct shift_impl<TN, TS, -1>
103120 {
104121 static TN shift(TN v) { return v << static_abs<TS>::value; }
105122 };
106123 public:
107- static TN shift(TN v) { return shift_impl<SHIFT, static_sign<SHIFT>::value>::shift(v); }
124+ template<typename TN>
125+ static TN shift(TN v) { return shift_impl<TN, SHIFT, static_sign<SHIFT>::value>::shift(v); }
108126 };
109127
110128 } // end of namespace iml
--- trunk/framework/testsuite/iutest/include/iutest_ver.h (revision 258)
+++ trunk/framework/testsuite/iutest/include/iutest_ver.h (revision 259)
@@ -22,10 +22,10 @@
2222
2323 //======================================================================
2424 // define
25-#define IUTEST_VER 0x00130100 //!< iutest version 0.13.1.0
25+#define IUTEST_VER 0x00140000 //!< iutest version 0.14.0.0
2626 #define IUTEST_MAJORVER 0x00
27-#define IUTEST_MINORVER 0x13
28-#define IUTEST_BUILD 0x01
27+#define IUTEST_MINORVER 0x14
28+#define IUTEST_BUILD 0x00
2929 #define IUTEST_REVISION 0x00
3030
3131 /**
--- trunk/framework/testsuite/iutest/include/iutest_body.h (revision 258)
+++ trunk/framework/testsuite/iutest/include/iutest_body.h (revision 259)
@@ -20,9 +20,7 @@
2020 //======================================================================
2121 // include
2222 #include "iutest_result.h"
23-#include "internal/iutest_random.h"
2423 #include "internal/iutest_mediator.h"
25-#include <vector>
2624
2725 namespace iutest
2826 {
@@ -67,6 +65,38 @@
6765 return CurrentTestObserver::s_current->m_test_info->HasFailure();
6866 }
6967
68+ /**
69+ * @brief テスト結果の情報追加
70+ * @param [in] key = プロパティのキー
71+ * @param [in] value = 値
72+ */
73+ static void RecordProperty(const char* key, const char* value)
74+ {
75+ // 不正なキーのチェック
76+ const char* ban[] = { "name", "status", "time", "classname" };
77+ std::string key_ = key;
78+ for( int i=0, n=sizeof(ban)/sizeof(ban[0]); i < n; ++i )
79+ {
80+ if( key_ == ban[i] )
81+ {
82+ key_ += "_";
83+ break;
84+ }
85+ }
86+ CurrentTestObserver::s_current->m_test_info->RecordProperty(TestProperty(key_.c_str(), value));
87+ };
88+ /**
89+ * @brief テスト結果の情報追加
90+ * @param [in] key = プロパティのキー
91+ * @param [in] value = 値
92+ */
93+ static void RecordProperty(const char* key, int value)
94+ {
95+ detail::iuStringStream::type ss;
96+ ss << value;
97+ RecordProperty(key, ss.str().c_str());
98+ }
99+
70100 protected:
71101
72102 #if IUTEST_HAS_GENRAND
--- trunk/framework/testsuite/iutest/include/listener/iutest_default_xml_generator.h (revision 258)
+++ trunk/framework/testsuite/iutest/include/listener/iutest_default_xml_generator.h (revision 259)
@@ -138,6 +138,18 @@
138138 file->Printf("classname=\"%s\""
139139 , EscapeXmlAttribute(test_info.test_case_name()).c_str() );
140140
141+ // propertys
142+ {
143+ for( int i=0, count=test_info.result()->test_property_count(); i < count; ++i )
144+ {
145+ const TestProperty& prop = test_info.result()->GetTestProperty(i);
146+ file->Printf(" %s=\"%s\""
147+ , EscapeXmlAttribute(prop.key()).c_str()
148+ , EscapeXmlAttribute(prop.value()).c_str()
149+ );
150+ }
151+ }
152+
141153 if( test_info.HasFailure() )
142154 {
143155 file->Printf(">\n");
--- trunk/framework/testsuite/iutest/include/iutest_assertion.h (revision 258)
+++ trunk/framework/testsuite/iutest/include/iutest_assertion.h (revision 259)
@@ -181,7 +181,7 @@
181181 template<typename T1, typename T2>
182182 std::string FormatForComparisonFailureMessage(const T1& value, const T2& /*other_operand*/);
183183 template<typename T1, typename T2>
184-AssertionResult CompareHelperEQ(const char* expected_str, const char* actual_str
184+AssertionResult CmpHelperEQ(const char* expected_str, const char* actual_str
185185 , const T1& expected, const T2& actual);
186186
187187 #endif
@@ -198,7 +198,7 @@
198198 #if defined(__MWERKS__)
199199 # define COMPARE_HELPER_DECLARE(op_name) \
200200 template<typename T1, typename T2> \
201- AssertionResult CompareHelper##op_name(const char* expr1, const char* expr2, const T1& val1, const T2& val2);
201+ AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, const T1& val1, const T2& val2);
202202
203203 #else
204204 # define COMPARE_HELPER_DECLARE(op_name)
--- trunk/framework/testsuite/iutest/include/iutest_util.h (revision 258)
+++ trunk/framework/testsuite/iutest/include/iutest_util.h (revision 259)
@@ -22,4 +22,13 @@
2222 #include "util/iutest_util_assertion.h"
2323 #include "util/iutest_util_output.h"
2424
25+/**
26+ * @ingroup IUTEST_UTIL
27+ * @brief ファイルシステムの設定
28+ * @note ユーザー定義のファイルクラスを利用するようにするためのマクロです。
29+*/
30+#define IUTEST_FILESYSTEM_INSTANTIATE(file_class_name) IUTEST_FILESYSTEM_INSTANTIATE_(file_class_name)
31+
32+#define IUTEST_FILESYSTEM_INSTANTIATE_(file_class_name) static iutest::FileSystem<file_class_name> s_iutest_filesystem_
33+
2534 #endif
--- trunk/framework/testsuite/iutest/include/iutest_result.h (revision 258)
+++ trunk/framework/testsuite/iutest/include/iutest_result.h (revision 259)
@@ -19,13 +19,9 @@
1919
2020 //======================================================================
2121 // include
22-#include "iutest_defs.h"
2322 #include "iutest_env.h"
24-#include "internal/iutest_internal_defs.h"
25-#include "internal/iutest_string.h"
2623 #include "internal/iutest_message.h"
2724 #include "internal/iutest_console.h"
28-#include <vector>
2925
3026 namespace iutest
3127 {
@@ -72,11 +68,30 @@
7268 };
7369
7470 /**
71+ * @brief テストプロパティ
72+ * @note XML 属性
73+*/
74+class TestProperty
75+{
76+public:
77+ TestProperty(const char* key, const char* value)
78+ : m_key(key), m_value(value) {}
79+
80+ const char* key(void) const { return m_key.c_str(); }
81+ const char* value(void) const { return m_value.c_str(); }
82+
83+private:
84+ std::string m_key;
85+ std::string m_value;
86+};
87+
88+/**
7589 * @brief テスト結果を示すクラス
7690 */
7791 class TestResult
7892 {
7993 typedef std::vector<TestPartResult> TestPartResults;
94+ typedef std::vector<TestProperty> TestPropertys;
8095 public:
8196 TestResult(void) {}
8297
@@ -124,6 +139,12 @@
124139 int total_part_count(void) const { return static_cast<int>(m_test_part_results.size()); }
125140
126141 /**
142+ * @brief プロパティ総数の取得
143+ * @return 総数
144+ */
145+ int test_property_count(void) const { return static_cast<int>(m_test_propertys.size()); }
146+
147+ /**
127148 * @brief テスト結果の取得
128149 * @param [in] index = インデックス
129150 * @return テスト結果
@@ -130,11 +151,20 @@
130151 */
131152 const TestPartResult& GetTestPartResult(int index) const { return m_test_part_results[index]; }
132153
154+ /**
155+ * @brief プロパティの取得
156+ * @param [in] index = インデックス
157+ * @return プロパティの
158+ */
159+ const TestProperty& GetTestProperty(int index) const { return m_test_propertys[index]; }
160+
133161 private:
134162 void push_back(const TestPartResult& result) { m_test_part_results.push_back(result); }
135163 void set_elapsed_time(TimeInMillisec time) { m_elapsedmsec = time; }
136164
137165 private:
166+ void RecordProperty(const TestProperty& prop) { m_test_propertys.push_back(prop); }
167+
138168 void ClearResult(void)
139169 {
140170 m_test_part_results.clear();
@@ -152,6 +182,7 @@
152182 friend class TestInfo;
153183
154184 TestPartResults m_test_part_results;
185+ TestPropertys m_test_propertys;
155186 TimeInMillisec m_elapsedmsec;
156187 };
157188
--- trunk/framework/testsuite/iutest/include/iutest.h (revision 258)
+++ trunk/framework/testsuite/iutest/include/iutest.h (revision 259)
@@ -49,7 +49,6 @@
4949 //======================================================================
5050 // include
5151 #include "iutest_ver.h"
52-#include "iutest_core.h"
5352 #include "iutest_param_tests.h"
5453 #include "iutest_typed_tests.h"
5554 #include "listener/iutest_default_printer.h"
--- trunk/framework/testsuite/iutest/include/iutest_defs.h (revision 258)
+++ trunk/framework/testsuite/iutest/include/iutest_defs.h (revision 259)
@@ -20,6 +20,7 @@
2020 //======================================================================
2121 // include
2222 #include <stdio.h>
23+#include <vector>
2324 #include "internal/iutest_compiler.h"
2425
2526 #if defined(_IUTEST_DEBUG)
--- trunk/framework/testsuite/iutest/include/iutest_param_tests.h (revision 258)
+++ trunk/framework/testsuite/iutest/include/iutest_param_tests.h (revision 259)
@@ -19,7 +19,6 @@
1919
2020 //======================================================================
2121 // include
22-#include "internal/iutest_params_util.h"
2322 #include "iutest_core.h"
2423 #include "internal/iutest_pool.h"
2524
--- trunk/framework/testsuite/iutest/include/iutest_env.h (revision 258)
+++ trunk/framework/testsuite/iutest/include/iutest_env.h (revision 259)
@@ -25,8 +25,6 @@
2525 #include "internal/iutest_os.h"
2626 #include "iutest_listener.h"
2727 #include <stdlib.h>
28-#include <string>
29-#include <vector>
3028
3129 //======================================================================
3230 // define
--- trunk/framework/testsuite/iutest/include/internal/iutest_mediator.h (revision 258)
+++ trunk/framework/testsuite/iutest/include/internal/iutest_mediator.h (revision 259)
@@ -8,7 +8,7 @@
88 * @version 1.0
99 *
1010 * @par copyright
11- * Copyright (C) 2011 Takazumi Shirayanagi\n
11+ * Copyright (C) 2011-2012 Takazumi Shirayanagi\n
1212 * The new BSD License is applied to this software.
1313 * see LICENSE
1414 */
@@ -27,6 +27,7 @@
2727 class TestInfo;
2828 class TestCase;
2929 class TestPartResult;
30+class TestProperty;
3031
3132 namespace detail
3233 {
@@ -47,6 +48,7 @@
4748 virtual void OnFailure(const TestPartResult& tr) = 0;
4849 virtual bool HasFatalFailure(void) const = 0;
4950 virtual bool HasFailure(void) const = 0;
51+ virtual void RecordProperty(const TestProperty& prop) = 0;
5052 TestInfo* ptr(void) const { return m_test_info; }
5153 };
5254
--- trunk/framework/testsuite/iutest/include/internal/iutest_factory.h (revision 258)
+++ trunk/framework/testsuite/iutest/include/internal/iutest_factory.h (revision 259)
@@ -19,8 +19,8 @@
1919
2020 //======================================================================
2121 // include
22+#include "iutest_internal_defs.h"
2223 #include "iutest_list.h"
23-#include "iutest_internal_defs.h"
2424
2525 namespace iutest {
2626
--- trunk/framework/testsuite/iutest/include/internal/iutest_charcode.h (revision 258)
+++ trunk/framework/testsuite/iutest/include/internal/iutest_charcode.h (revision 259)
@@ -8,7 +8,7 @@
88 * @version 1.0
99 *
1010 * @par copyright
11- * Copyright (C) 2011 Takazumi Shirayanagi\n
11+ * Copyright (C) 2011-2012 Takazumi Shirayanagi\n
1212 * The new BSD License is applied to this software.
1313 * see LICENSE
1414 */
@@ -19,7 +19,6 @@
1919
2020 //======================================================================
2121 // include
22-#include "../iutest_defs.h"
2322 #include "iutest_string.h"
2423 #include "iutest_os.h"
2524
--- trunk/framework/testsuite/iutest/include/internal/iutest_internal.h (revision 258)
+++ trunk/framework/testsuite/iutest/include/internal/iutest_internal.h (revision 259)
@@ -20,7 +20,6 @@
2020 //======================================================================
2121 // include
2222 #include "iutest_internal_defs.h"
23-#include "iutest_factory.h"
2423
2524 //======================================================================
2625 // define
--- trunk/framework/testsuite/iutest/include/iutest_info.h (revision 258)
+++ trunk/framework/testsuite/iutest/include/iutest_info.h (revision 259)
@@ -19,16 +19,11 @@
1919
2020 //======================================================================
2121 // include
22-#include "iutest_defs.h"
2322 #include "internal/iutest_factory.h"
24-#include "internal/iutest_console.h"
2523 #include "internal/iutest_time.h"
2624 #include "internal/iutest_mediator.h"
2725 #include "internal/iutest_exception.h"
2826 #include "iutest_result.h"
29-#include "iutest_env.h"
30-#include <string>
31-#include <vector>
3227
3328 namespace iutest
3429 {
@@ -57,6 +52,10 @@
5752 {
5853 return ptr()->HasFailure();
5954 }
55+ virtual void RecordProperty(const TestProperty& prop)
56+ {
57+ return ptr()->RecordProperty(prop);
58+ }
6059 };
6160 public:
6261 /**
@@ -217,6 +216,10 @@
217216 m_test_result.push_back(tr);
218217 }
219218
219+ void RecordProperty(const TestProperty& prop)
220+ {
221+ m_test_result.RecordProperty(prop);
222+ }
220223 private:
221224 /**
222225 * @brief テストのクリア
--- trunk/framework/testsuite/iutest/samples/main.cpp (revision 258)
+++ trunk/framework/testsuite/iutest/samples/main.cpp (revision 259)
@@ -56,6 +56,8 @@
5656 IUTEST(Test, Test1)
5757 {
5858 IUTEST_ASSERT_STREQ("Test1", iutest::UnitTest::GetInstance()->current_test_info()->name());
59+ RecordProperty("test_name", iutest::UnitTest::GetInstance()->current_test_info()->name());
60+ RecordProperty("number", 1);
5961 }
6062
6163 IUTEST(Test, Test2)
--- trunk/framework/testsuite/iutest/doc/dev/make_html.bat (nonexistent)
+++ trunk/framework/testsuite/iutest/doc/dev/make_html.bat (revision 259)
@@ -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/dev/index.html (nonexistent)
+++ trunk/framework/testsuite/iutest/doc/dev/index.html (revision 259)
@@ -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