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)
CPPFLAGS = -I../include -I/usr/X11R6/include -pipe
# CXXFLAGS += -O3
CXXFLAGS += -Wall -O1 -g -D_DEBUG
CXXFLAGS += -Wall -O0 -g -D_DEBUG
ifeq ($(HOSTTYPE), x86_64)
LIBSELECT=64
......
......@@ -55,10 +55,10 @@ bool lightMaps(void)
{
bool passed = true;
passed &= runTestWithDriver(EDT_OPENGL);
passed &= runTestWithDriver(EDT_BURNINGSVIDEO);
passed &= runTestWithDriver(EDT_DIRECT3D9);
passed &= runTestWithDriver(EDT_DIRECT3D8);
passed &= runTestWithDriver(EDT_OPENGL);
return passed;
}
......
......@@ -120,6 +120,8 @@ int main(int argumentCount, char * arguments[])
int tmp = atoi(arguments[1]);
firstRun = (tmp>=0);
testToRun=abs(tmp);
if (!firstRun)
testToRun -= 1;
if(argumentCount > 2)
{
......@@ -208,7 +210,7 @@ int main(int argumentCount, char * arguments[])
}
else
{
const bool res = tests[testToRun-1].testSignature();
const bool res = tests[testToRun].testSignature();
closeTestLog();
return res?0:1;
}
......
......@@ -10,7 +10,7 @@ template<class T>
static bool compareVectors(const core::vector2d<T> & compare,
const core::vector2d<T> & with)
{
if(compare != with)
if (!compare.equals(with))
{
logTestString("\nERROR: vector2d %.16f, %.16f != vector2d %.16f, %.16f\n",
(f64)compare.X, (f64)compare.Y, (f64)with.X, (f64)with.Y);
......@@ -41,7 +41,7 @@ static bool doTests()
COMPARE_VECTORS(vec, vector2d<T>(0, (T)7.0710678118654755));
vec.normalize();
COMPARE_VECTORS(vec, vector2d<T>(0, (T)1.0000000461060017));
COMPARE_VECTORS(vec, vector2d<T>(0, (T)1.0));
vec.set(10, 10);
vector2d<T> center(5, 5);
......@@ -52,7 +52,7 @@ static bool doTests()
vec.set(5, 5);
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);
otherVec.set(10, 20);
......
......@@ -35,7 +35,7 @@ struct cmp_equal
cmp_equal(const T& a) : val(a) {}
bool operator()(const T& other) const
{
return val==other;
return val.equals(other);
}
const char* getName() const {return "==";}
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)
result &= (vector == dimension); // The conversion should be explicit.
result &= (dimension2 == position);
result &= (position == POSITION((T)99.9, (T)99.9));
assert(result);
dimension = (T)2 * position;
result &= (dimension == VECTOR(2 * (T)99.9, 2 * (T)99.9));
assert(result);
dimension /= (T)2;
result &= (dimension == POSITION((T)99.9, (T)99.9));
assert(result);
dimension += vector;
result &= (dimension == VECTOR(2 * (T)99.9, 2 * (T)99.9));
assert(result);
dimension -= position;
result &= (dimension == POSITION((T)99.9, (T)99.9));
assert(result);
position = dimension;
result &= (position == VECTOR((T)99.9, (T)99.9));
assert(result);
vector += position;
result &= (vector == POSITION(2 * (T)99.9, 2 * (T)99.9));
assert(result);
vector -= position;
result &= (vector == dimension);
assert(result);
position *= (T)3.5;
result &= (position == VECTOR((T)3.5 * (T)99.9, (T)3.5 * (T)99.9));
assert(result);
vector += dimension;
result &= (vector == VECTOR(2 * (T)99.9, 2 * (T)99.9));
assert(result);
return result;
}
......@@ -59,19 +69,19 @@ bool vectorPositionDimension2d(void)
{
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>();
if (result)
logTestString("tests passed\n\n");
else
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>();
if (result)
logTestString("tests passed\n\n");
else
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>();
if (result)
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