Add MathEngineTest and Commects and clean ups
This commit is contained in:
@@ -3,4 +3,4 @@
|
||||
|
||||
void EventEngineTest();
|
||||
|
||||
#endif ///__EVENTENGINETEST__
|
||||
#endif /// __EVENTENGINETEST__
|
||||
@@ -0,0 +1,98 @@
|
||||
#include "CollisionTest.hpp"
|
||||
|
||||
#include "../UTest/UTest.hpp"
|
||||
|
||||
/*** TrooperEngine DLL Header Files ***/
|
||||
#include "TrooperEngine.hpp"
|
||||
|
||||
using MathEngine::cCollision;
|
||||
|
||||
void CollisionTest()
|
||||
{
|
||||
/// cCollision
|
||||
printf("\nTesting cCollision -----\n\n");
|
||||
|
||||
UTest u("cCollision");
|
||||
SDL_Rect a = { 50, 50, 50, 50 };
|
||||
SDL_Rect bLeftTouch = { 0, 50, 50, 50 };
|
||||
SDL_Rect bRightTouch = { 100, 50, 50, 50 };
|
||||
SDL_Rect bTopTouch = { 50, 0, 50, 50 };
|
||||
SDL_Rect bBottomTouch = { 50, 100, 50, 50 };
|
||||
|
||||
SDL_Rect bxywhTouch = { 1, 1, 49, 49 };
|
||||
SDL_Rect bxnotTouch = { 101, 101, 50, 50 };
|
||||
|
||||
cString boundingbox = "BoundingBox(SDL_Rect a, SDL_Rect b) Check two SDL_Rect ";
|
||||
|
||||
u.test(boundingbox + "that overlap, should return true.", cCollision::BoundingBox(a, a));
|
||||
|
||||
u.test(boundingbox + "that overlap on the left side only, should return true.", cCollision::BoundingBox(a, bLeftTouch));
|
||||
|
||||
u.test(boundingbox + "that overlap on the right side only, should return true.", cCollision::BoundingBox(a, bRightTouch));
|
||||
|
||||
u.test(boundingbox + "that overlap on the Top side only, should return true.", cCollision::BoundingBox(a, bTopTouch));
|
||||
|
||||
u.test(boundingbox + "that overlap on the Bottom side only, should return true.", cCollision::BoundingBox(a, bBottomTouch));
|
||||
|
||||
u.test(boundingbox + "one is inside the other, should return true.", cCollision::BoundingBox(a, bxywhTouch));
|
||||
|
||||
u.test(boundingbox + "that don't overlap, should return false.", !(cCollision::BoundingBox(a, bxnotTouch)));
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Vector4
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
MathEngine::Vector4 Va = { 50.0, 50.0, 50.0, 50.0 };
|
||||
MathEngine::Vector4 VbLeftTouch = { 0.0, 50.0, 50.0, 50.0 };
|
||||
MathEngine::Vector4 VbRightTouch = { 100.0, 50.0, 50.0, 50.0 };
|
||||
MathEngine::Vector4 VbTopTouch = { 50.0, 0.0, 50.0, 50.0 };
|
||||
MathEngine::Vector4 VbBottomTouch = { 50.0, 100.0, 50.0, 50.0 };
|
||||
|
||||
MathEngine::Vector4 VbxywhTouch = { 1.0, 1.0, 49.0, 49.0 };
|
||||
MathEngine::Vector4 VbxnotTouch = { 101.0, 101.0, 50.0, 50.0 };
|
||||
|
||||
boundingbox = "BoundingBox( const Vector4& a, const Vector4& b ) Check two Vector4 ";
|
||||
|
||||
u.test(boundingbox + "that overlap, should return true.", cCollision::BoundingBox(Va, Va));
|
||||
|
||||
u.test(boundingbox + "that overlap on the left side only, should return true.", cCollision::BoundingBox(Va, VbLeftTouch));
|
||||
|
||||
u.test(boundingbox + "that overlap on the right side only, should return true.", cCollision::BoundingBox(Va, VbRightTouch));
|
||||
|
||||
u.test(boundingbox + "that overlap on the Top side only, should return true.", cCollision::BoundingBox(Va, VbTopTouch));
|
||||
|
||||
u.test(boundingbox + "that overlap on the Bottom side only, should return true.", cCollision::BoundingBox(Va, VbBottomTouch));
|
||||
|
||||
u.test(boundingbox + "one is inside the other, should return true.", cCollision::BoundingBox(Va, VbxywhTouch));
|
||||
|
||||
u.test(boundingbox + "that don't overlap, should return false.", !(cCollision::BoundingBox(Va, VbxnotTouch)));
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// iVector4
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
MathEngine::iVector4 iVa = { 50, 50, 50, 50 };
|
||||
MathEngine::iVector4 iVbLeftTouch = { 0, 50, 50, 50 };
|
||||
MathEngine::iVector4 iVbRightTouch = { 100, 50, 50, 50 };
|
||||
MathEngine::iVector4 iVbTopTouch = { 50, 0, 50, 50 };
|
||||
MathEngine::iVector4 iVbBottomTouch = { 50, 100, 50, 50 };
|
||||
|
||||
MathEngine::iVector4 iVbxywhTouch = { 1, 1, 49, 49 };
|
||||
MathEngine::iVector4 iVbxnotTouch = { 101, 101, 50, 50 };
|
||||
|
||||
boundingbox = "BoundingBox( const iVector4& a, const iVector4& b ) Check two iVector4 ";
|
||||
|
||||
u.test(boundingbox + "that overlap, should return true.", cCollision::BoundingBox(iVa, iVa));
|
||||
|
||||
u.test(boundingbox + "that overlap on the left side only, should return true.", cCollision::BoundingBox(iVa, iVbLeftTouch));
|
||||
|
||||
u.test(boundingbox + "that overlap on the right side only, should return true.", cCollision::BoundingBox(iVa, iVbRightTouch));
|
||||
|
||||
u.test(boundingbox + "that overlap on the Top side only, should return true.", cCollision::BoundingBox(iVa, iVbTopTouch));
|
||||
|
||||
u.test(boundingbox + "that overlap on the Bottom side only, should return true.", cCollision::BoundingBox(iVa, iVbBottomTouch));
|
||||
|
||||
u.test(boundingbox + "one is inside the other, should return true.", cCollision::BoundingBox(iVa, iVbxywhTouch));
|
||||
|
||||
u.test(boundingbox + "that don't overlap, should return false.", !(cCollision::BoundingBox(iVa, iVbxnotTouch)));
|
||||
|
||||
u.report();
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef __COLLISIONTEST__
|
||||
#define __COLLISIONTEST__
|
||||
|
||||
void CollisionTest();
|
||||
|
||||
#endif /// __COLLISIONTEST__
|
||||
@@ -0,0 +1,8 @@
|
||||
#include "MathEngineTest.hpp"
|
||||
|
||||
#include "CollisionTest.hpp"
|
||||
|
||||
void MathEngineTest()
|
||||
{
|
||||
CollisionTest();
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef __MATHENGINETEST__
|
||||
#define __MATHENGINETEST__
|
||||
|
||||
void MathEngineTest();
|
||||
|
||||
#endif /// __MATHENGINETEST__
|
||||
@@ -148,6 +148,8 @@
|
||||
<ClCompile Include="EventEngineTest\EventEngineTest.cpp" />
|
||||
<ClCompile Include="GUIEngineTest\GUIXMLTest.cpp" />
|
||||
<ClCompile Include="main.cpp" />
|
||||
<ClCompile Include="MathEngineTest\CollisionTest.cpp" />
|
||||
<ClCompile Include="MathEngineTest\MathEngineTest.cpp" />
|
||||
<ClCompile Include="UTest\UTest.cpp" />
|
||||
<ClCompile Include="UtilityEngineTest\StringTest.cpp" />
|
||||
<ClCompile Include="UtilityEngineTest\UtilityEngineTest.cpp" />
|
||||
@@ -159,6 +161,8 @@
|
||||
<ItemGroup>
|
||||
<ClInclude Include="EventEngineTest\EventEngineTest.hpp" />
|
||||
<ClInclude Include="GUIEngineTest\GUIXMLTest.hpp" />
|
||||
<ClInclude Include="MathEngineTest\CollisionTest.hpp" />
|
||||
<ClInclude Include="MathEngineTest\MathEngineTest.hpp" />
|
||||
<ClInclude Include="UTest\UTest.hpp" />
|
||||
<ClInclude Include="UtilityEngineTest\StringTest.hpp" />
|
||||
<ClInclude Include="UtilityEngineTest\UtilityEngineTest.hpp" />
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
<Filter Include="EventEngineTest">
|
||||
<UniqueIdentifier>{30bb6c80-fc2a-4954-bf14-10c6dc5aceec}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="MathEngineTest">
|
||||
<UniqueIdentifier>{846ddb6a-bcb4-4e29-9be7-e3c249de1213}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="UTest\UTest.hpp">
|
||||
@@ -48,6 +51,12 @@
|
||||
<ClInclude Include="UtilityEngineTest\UtilityEngineTest.hpp">
|
||||
<Filter>UtitlityEngineTest</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="MathEngineTest\CollisionTest.hpp">
|
||||
<Filter>MathEngineTest</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="MathEngineTest\MathEngineTest.hpp">
|
||||
<Filter>MathEngineTest</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="UTest\UTest.cpp">
|
||||
@@ -78,6 +87,12 @@
|
||||
<ClCompile Include="UtilityEngineTest\UtilityEngineTest.cpp">
|
||||
<Filter>UtitlityEngineTest</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="MathEngineTest\CollisionTest.cpp">
|
||||
<Filter>MathEngineTest</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="MathEngineTest\MathEngineTest.cpp">
|
||||
<Filter>MathEngineTest</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Xml Include="xml\GUI.xml">
|
||||
|
||||
@@ -28,9 +28,14 @@ see license.txt for details
|
||||
/*** Utility Engine Test ***/
|
||||
#include "UtilityEngineTest/UtilityEngineTest.hpp"
|
||||
|
||||
/*** Math Engine Test ***/
|
||||
#include "MathEngineTest/MathEngineTest.hpp"
|
||||
|
||||
/*** GUI Engine Test ***/
|
||||
#include "GUIEngineTest/GUIXMLTest.hpp"
|
||||
|
||||
#include <string>
|
||||
|
||||
using UtilityEngine::cString;
|
||||
|
||||
void CleanUp()
|
||||
@@ -43,19 +48,16 @@ int main(int argc, char *argv[])
|
||||
argc, argv;
|
||||
|
||||
printf(cString("TrooperEngine V") + TrooperEngineCore::cTrooperEngineCore::Version() + "\n");
|
||||
|
||||
|
||||
|
||||
VideoEngineTest();
|
||||
|
||||
UtilityEngineTest();
|
||||
|
||||
UtilityEngineTest();
|
||||
|
||||
|
||||
MathEngineTest();
|
||||
|
||||
GUIXMLTest();
|
||||
//GUIXMLTest();
|
||||
|
||||
//ImageTest();
|
||||
|
||||
|
||||
UTest::OverAllReport();
|
||||
SDL_Event event;
|
||||
@@ -90,7 +92,5 @@ int main(int argc, char *argv[])
|
||||
|
||||
CleanUp();
|
||||
|
||||
//system("pause");
|
||||
|
||||
return 0;
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
@@ -4,7 +4,7 @@
|
||||
<Layout>
|
||||
<!--<Include dir ="xml/" filename="include.xml"/>-->
|
||||
<Sizer />
|
||||
<Label>Sizer</Label>
|
||||
<Label fontsize="16">Sizer</Label>
|
||||
<Sizer />
|
||||
<Sizer />
|
||||
</Layout>
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 5.1 KiB |
Reference in New Issue
Block a user