Commit 9af18d89 authored by hybrid's avatar hybrid

Fix tests.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2850 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 7a2881da
...@@ -4,7 +4,7 @@ Sources = $(wildcard *.cpp) ...@@ -4,7 +4,7 @@ Sources = $(wildcard *.cpp)
CPPFLAGS = -I../include -I/usr/X11R6/include -pipe CPPFLAGS = -I../include -I/usr/X11R6/include -pipe
# CXXFLAGS += -O3 # CXXFLAGS += -O3
CXXFLAGS += -Wall -O1 -g -D_DEBUG CXXFLAGS += -Wall -O0 -g -D_DEBUG
ifeq ($(HOSTTYPE), x86_64) ifeq ($(HOSTTYPE), x86_64)
LIBSELECT=64 LIBSELECT=64
......
...@@ -55,10 +55,10 @@ bool lightMaps(void) ...@@ -55,10 +55,10 @@ bool lightMaps(void)
{ {
bool passed = true; bool passed = true;
passed &= runTestWithDriver(EDT_OPENGL);
passed &= runTestWithDriver(EDT_BURNINGSVIDEO); passed &= runTestWithDriver(EDT_BURNINGSVIDEO);
passed &= runTestWithDriver(EDT_DIRECT3D9); passed &= runTestWithDriver(EDT_DIRECT3D9);
passed &= runTestWithDriver(EDT_DIRECT3D8); passed &= runTestWithDriver(EDT_DIRECT3D8);
passed &= runTestWithDriver(EDT_OPENGL);
return passed; return passed;
} }
......
...@@ -120,6 +120,8 @@ int main(int argumentCount, char * arguments[]) ...@@ -120,6 +120,8 @@ int main(int argumentCount, char * arguments[])
int tmp = atoi(arguments[1]); int tmp = atoi(arguments[1]);
firstRun = (tmp>=0); firstRun = (tmp>=0);
testToRun=abs(tmp); testToRun=abs(tmp);
if (!firstRun)
testToRun -= 1;
if(argumentCount > 2) if(argumentCount > 2)
{ {
...@@ -208,7 +210,7 @@ int main(int argumentCount, char * arguments[]) ...@@ -208,7 +210,7 @@ int main(int argumentCount, char * arguments[])
} }
else else
{ {
const bool res = tests[testToRun-1].testSignature(); const bool res = tests[testToRun].testSignature();
closeTestLog(); closeTestLog();
return res?0:1; return res?0:1;
} }
......
...@@ -10,7 +10,7 @@ template<class T> ...@@ -10,7 +10,7 @@ template<class T>
static bool compareVectors(const core::vector2d<T> & compare, static bool compareVectors(const core::vector2d<T> & compare,
const core::vector2d<T> & with) const core::vector2d<T> & with)
{ {
if(compare != with) if (!compare.equals(with))
{ {
logTestString("\nERROR: vector2d %.16f, %.16f != vector2d %.16f, %.16f\n", logTestString("\nERROR: vector2d %.16f, %.16f != vector2d %.16f, %.16f\n",
(f64)compare.X, (f64)compare.Y, (f64)with.X, (f64)with.Y); (f64)compare.X, (f64)compare.Y, (f64)with.X, (f64)with.Y);
...@@ -41,7 +41,7 @@ static bool doTests() ...@@ -41,7 +41,7 @@ static bool doTests()
COMPARE_VECTORS(vec, vector2d<T>(0, (T)7.0710678118654755)); COMPARE_VECTORS(vec, vector2d<T>(0, (T)7.0710678118654755));
vec.normalize(); vec.normalize();
COMPARE_VECTORS(vec, vector2d<T>(0, (T)1.0000000461060017)); COMPARE_VECTORS(vec, vector2d<T>(0, (T)1.0));
vec.set(10, 10); vec.set(10, 10);
vector2d<T> center(5, 5); vector2d<T> center(5, 5);
...@@ -52,7 +52,7 @@ static bool doTests() ...@@ -52,7 +52,7 @@ static bool doTests()
vec.set(5, 5); vec.set(5, 5);
vec.normalize(); vec.normalize();
COMPARE_VECTORS(vec, vector2d<T>((T)0.70710681378841400, (T)0.70710681378841400)); COMPARE_VECTORS(vec, vector2d<T>((T)0.7071067811865476, (T)0.7071067811865476));
vec.set(5, 5); vec.set(5, 5);
otherVec.set(10, 20); otherVec.set(10, 20);
......
...@@ -35,7 +35,7 @@ struct cmp_equal ...@@ -35,7 +35,7 @@ struct cmp_equal
cmp_equal(const T& a) : val(a) {} cmp_equal(const T& a) : val(a) {}
bool operator()(const T& other) const bool operator()(const T& other) const
{ {
return val==other; return val.equals(other);
} }
const char* getName() const {return "==";} const char* getName() const {return "==";}
const T val; const T val;
......
Test suite pass at GMT Wed Nov 11 00:02:11 2009 Test suite pass at GMT Thu Nov 12 17:56:52 2009
...@@ -24,33 +24,43 @@ static bool doTest(void) ...@@ -24,33 +24,43 @@ static bool doTest(void)
result &= (vector == dimension); // The conversion should be explicit. result &= (vector == dimension); // The conversion should be explicit.
result &= (dimension2 == position); result &= (dimension2 == position);
result &= (position == POSITION((T)99.9, (T)99.9)); result &= (position == POSITION((T)99.9, (T)99.9));
assert(result);
dimension = (T)2 * position; dimension = (T)2 * position;
result &= (dimension == VECTOR(2 * (T)99.9, 2 * (T)99.9)); result &= (dimension == VECTOR(2 * (T)99.9, 2 * (T)99.9));
assert(result);
dimension /= (T)2; dimension /= (T)2;
result &= (dimension == POSITION((T)99.9, (T)99.9)); result &= (dimension == POSITION((T)99.9, (T)99.9));
assert(result);
dimension += vector; dimension += vector;
result &= (dimension == VECTOR(2 * (T)99.9, 2 * (T)99.9)); result &= (dimension == VECTOR(2 * (T)99.9, 2 * (T)99.9));
assert(result);
dimension -= position; dimension -= position;
result &= (dimension == POSITION((T)99.9, (T)99.9)); result &= (dimension == POSITION((T)99.9, (T)99.9));
assert(result);
position = dimension; position = dimension;
result &= (position == VECTOR((T)99.9, (T)99.9)); result &= (position == VECTOR((T)99.9, (T)99.9));
assert(result);
vector += position; vector += position;
result &= (vector == POSITION(2 * (T)99.9, 2 * (T)99.9)); result &= (vector == POSITION(2 * (T)99.9, 2 * (T)99.9));
assert(result);
vector -= position; vector -= position;
result &= (vector == dimension); result &= (vector == dimension);
assert(result);
position *= (T)3.5; position *= (T)3.5;
result &= (position == VECTOR((T)3.5 * (T)99.9, (T)3.5 * (T)99.9)); result &= (position == VECTOR((T)3.5 * (T)99.9, (T)3.5 * (T)99.9));
assert(result);
vector += dimension; vector += dimension;
result &= (vector == VECTOR(2 * (T)99.9, 2 * (T)99.9)); result &= (vector == VECTOR(2 * (T)99.9, 2 * (T)99.9));
assert(result);
return result; return result;
} }
...@@ -59,19 +69,19 @@ bool vectorPositionDimension2d(void) ...@@ -59,19 +69,19 @@ bool vectorPositionDimension2d(void)
{ {
bool result = true; bool result = true;
logTestString("vector,position,dimesion test with s32\n\n"); logTestString("vector,position,dimension test with s32\n\n");
result &= doTest<dimension2di, vector2di, position2di, s32>(); result &= doTest<dimension2di, vector2di, position2di, s32>();
if (result) if (result)
logTestString("tests passed\n\n"); logTestString("tests passed\n\n");
else else
logTestString("\ntests failed\n\n"); logTestString("\ntests failed\n\n");
logTestString("vector,position,dimesion test with f32\n\n"); logTestString("vector,position,dimension test with f32\n\n");
result &= doTest<dimension2df, vector2df, position2df, f32>(); result &= doTest<dimension2df, vector2df, position2df, f32>();
if (result) if (result)
logTestString("tests passed\n\n"); logTestString("tests passed\n\n");
else else
logTestString("\ntests failed\n\n"); logTestString("\ntests failed\n\n");
logTestString("vector,position,dimesion test with f64\n\n"); logTestString("vector,position,dimension test with f64\n\n");
result &= doTest<dimension2d<f64>, vector2d<f64>, position2d<f64>, f64>(); result &= doTest<dimension2d<f64>, vector2d<f64>, position2d<f64>, f64>();
if (result) if (result)
logTestString("tests passed\n\n"); logTestString("tests passed\n\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment