mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-14 20:23:47 +00:00
Increased stability Torqu3D: unit-tests running without a crash. See the console.log after ran unitTest_runTests( "", true ). @signmotion
This commit is contained in:
parent
29d7fe310d
commit
18ba0646c0
18 changed files with 113 additions and 19 deletions
|
|
@ -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." );
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue