Increased stability Torqu3D: unit-tests running without a crash. See the console.log after ran unitTest_runTests( "", true ). @signmotion

This commit is contained in:
LuisAntonRebollo 2014-05-25 16:50:19 +02:00
parent 29d7fe310d
commit 18ba0646c0
18 changed files with 113 additions and 19 deletions

View file

@ -91,9 +91,17 @@ public:
// for this functionality later
void unit_test( UnitTest *test )
{
AssertFatal(test, "CachedInterfaceExampleComponent::unit_test - NULL UnitTest");
if( !test )
return;
test->test( mpU32 != NULL, "Pointer to dependent interface is NULL" );
test->test( *(*mpU32) & ( 1 << 24 ), "Pointer to interface data is bogus." );
test->test( *(*mpU32) != *mMyId, "Two of me have the same ID, bad!" );
if( mpU32 )
{
test->test( *(*mpU32) & ( 1 << 24 ), "Pointer to interface data is bogus." );
test->test( *(*mpU32) != *mMyId, "Two of me have the same ID, bad!" );
}
}
};
@ -130,13 +138,16 @@ CreateUnitTest(TestComponentInterfacing, "Components/Composition")
test( componentB->getOwner() == testComponent, "testComponent did not properly set the mOwner field of componentB to NULL." );
// Register the object with the simulation, kicking off the interface registration
test( testComponent->registerObject(), "Failed to register testComponent" );
const bool registered = testComponent->registerObject();
test( registered, "Failed to register testComponent" );
// Interface tests
componentA->unit_test( this );
componentB->unit_test( this );
testComponent->deleteObject();
if( registered )
{
componentA->unit_test( this );
componentB->unit_test( this );
testComponent->deleteObject();
}
test( m.check(), "Component composition test leaked memory." );
}