1
0
forked from 0ad/0ad

Fix warnings in tests

This was SVN commit r7535.
This commit is contained in:
Ykkrosh 2010-05-10 09:52:35 +00:00
parent ecccf4c0d7
commit 434248167b
3 changed files with 19 additions and 5 deletions

View File

@ -3,6 +3,7 @@ function TestScript1_DestroyEntity() {}
TestScript1_DestroyEntity.prototype.GetX = function()
{
Engine.DestroyEntity(10);
return 0;
};
Engine.RegisterComponentType(IID_Test1, "TestScript1_DestroyEntity", TestScript1_DestroyEntity);

View File

@ -21,6 +21,7 @@
#include "maths/Fixed.h"
#include "maths/MathUtil.h"
#include "ps/CLogger.h"
#include "js/jsapi.h"
@ -82,16 +83,20 @@ public:
roundtrip<i32>(-123, "-123");
roundtrip<i32>(1073741822, "1073741822"); // JSVAL_INT_MAX-1
roundtrip<i32>(1073741823, "1073741823"); // JSVAL_INT_MAX
roundtrip<i32>(1073741824, "1073741824"); // JSVAL_INT_MAX+1
roundtrip<i32>(-1073741823, "-1073741823"); // JSVAL_INT_MIN+1
roundtrip<i32>(-1073741824, "-1073741824"); // JSVAL_INT_MIN
roundtrip<i32>(-1073741825, "-1073741825"); // JSVAL_INT_MIN-1
roundtrip<u32>(0, "0");
roundtrip<u32>(123, "123");
roundtrip<u32>(1073741822, "1073741822"); // JSVAL_INT_MAX-1
roundtrip<u32>(1073741823, "1073741823"); // JSVAL_INT_MAX
roundtrip<u32>(1073741824, "1073741824"); // JSVAL_INT_MAX+1
{
TestLogger log; // swallow warnings about values not being stored as INT jsvals
roundtrip<i32>(1073741824, "1073741824"); // JSVAL_INT_MAX+1
roundtrip<i32>(-1073741825, "-1073741825"); // JSVAL_INT_MIN-1
roundtrip<u32>(1073741824, "1073741824"); // JSVAL_INT_MAX+1
}
std::string s1 = "test";
s1[1] = '\0';

View File

@ -334,8 +334,10 @@ public:
man.AddComponent(ent1, man.LookupCID("TestScript1A"), noParam);
man.AddComponent(ent2, man.LookupCID("TestScript1A"), noParam);
TestLogger log;
TS_ASSERT_EQUALS(static_cast<ICmpTest1*> (man.QueryInterface(ent1, IID_Test1))->GetX(), (int)ent1);
TS_ASSERT_EQUALS(static_cast<ICmpTest1*> (man.QueryInterface(ent2, IID_Test1))->GetX(), (int)ent2);
TS_ASSERT_WSTR_CONTAINS(log.GetOutput(), L"this.entity is read-only");
}
void test_script_QueryInterface()
@ -641,7 +643,10 @@ public:
man.AddComponent(ent3, man.LookupCID("TestScript1_nontree"), testParam);
TS_ASSERT_EQUALS(static_cast<ICmpTest1*> (man.QueryInterface(ent1, IID_Test1))->GetX(), 1234);
TS_ASSERT_EQUALS(static_cast<ICmpTest1*> (man.QueryInterface(ent2, IID_Test1))->GetX(), (int)ent2);
{
TestLogger log; // swallow warnings about this.entity being read-only
TS_ASSERT_EQUALS(static_cast<ICmpTest1*> (man.QueryInterface(ent2, IID_Test1))->GetX(), (int)ent2);
}
TS_ASSERT_EQUALS(static_cast<ICmpTest1*> (man.QueryInterface(ent3, IID_Test1))->GetX(), 8);
std::stringstream debugStream;
@ -672,7 +677,10 @@ public:
TS_ASSERT(man2.QueryInterface(ent1, IID_Test1) == NULL);
TS_ASSERT(man2.DeserializeState(stateStream));
TS_ASSERT_EQUALS(static_cast<ICmpTest1*> (man2.QueryInterface(ent1, IID_Test1))->GetX(), 1234);
TS_ASSERT_EQUALS(static_cast<ICmpTest1*> (man2.QueryInterface(ent2, IID_Test1))->GetX(), (int)ent2);
{
TestLogger log; // swallow warnings about this.entity being read-only
TS_ASSERT_EQUALS(static_cast<ICmpTest1*> (man2.QueryInterface(ent2, IID_Test1))->GetX(), (int)ent2);
}
TS_ASSERT_EQUALS(static_cast<ICmpTest1*> (man2.QueryInterface(ent3, IID_Test1))->GetX(), 12);
}