All unit tests that run now pass.

This commit is contained in:
Daniel Buckmaster 2014-09-29 11:00:43 +10:00
parent b173e5571c
commit fae1bad96c
4 changed files with 19 additions and 22 deletions

View file

@ -47,10 +47,10 @@ public:
public:
//////////////////////////////////////////////////////////////////////////
virtual void registerInterfaces( const SimComponent *owner )
virtual void registerInterfaces( SimComponent *owner )
{
// Register a cached interface for this
registerCachedInterface( NULL, "aU32", this, &mMyId );
owner->registerCachedInterface( NULL, "aU32", this, &mMyId );
}
//////////////////////////////////////////////////////////////////////////
@ -66,7 +66,7 @@ public:
ComponentInterfaceList list;
// Enumerate the interfaces on the owner, only ignore interfaces that this object owns
if( !_getOwner()->getInterfaces( &list, NULL, "aU32", this, true ) )
if( !owner->getInterfaces( &list, NULL, "aU32", this, true ) )
return false;
// Sanity check before just assigning all willy-nilly
@ -131,23 +131,19 @@ TEST(SimComponent, Composition)
<< "testComponent did not properly set the mOwner field of componentB to NULL.";
// Register the object with the simulation, kicking off the interface registration
const bool registered = testComponent->registerObject();
EXPECT_TRUE( registered )
ASSERT_TRUE( testComponent->registerObject() )
<< "Failed to register testComponent";
// Interface tests
if( registered )
{
{
SCOPED_TRACE("componentA");
componentA->unit_test();
}
{
SCOPED_TRACE("componentB");
componentB->unit_test();
}
testComponent->deleteObject();
SCOPED_TRACE("componentA");
componentA->unit_test();
}
{
SCOPED_TRACE("componentB");
componentB->unit_test();
}
testComponent->deleteObject();
};
#endif

View file

@ -40,7 +40,7 @@ TEST(Platform, Sleep)
U32 start = Platform::getRealMilliseconds();
Platform::sleep(500);
U32 end = Platform::getRealMilliseconds();
EXPECT_GE(end - start, 500)
EXPECT_GE(end - start, 500-10) // account for clock resolution
<< "We didn't sleep at least as long as we requested!";
};

View file

@ -105,7 +105,7 @@ TEST(ThreadSafeRefCount, Concurrent)
};
mRef = new TestObject;
EXPECT_EQ(mRef->getRefCount(), 2); // increments of 2
EXPECT_EQ(2, mRef->getRefCount()); // increments of 2
Vector<TestThread*> threads;
threads.setSize(NUM_THREADS);
@ -122,8 +122,8 @@ TEST(ThreadSafeRefCount, Concurrent)
for (U32 i = 0; i < NUM_THREADS; i++)
threads[i]->join();
Con::printf("REF: %i", mRef->getRefCount());
EXPECT_EQ(mRef->getRefCount(), 2 + ((NUM_ADD_REFS_PER_THREAD + NUM_EXTRA_REFS_PER_THREAD) * NUM_THREADS * 2));
EXPECT_EQ(2 + ((1 + NUM_ADD_REFS_PER_THREAD + NUM_EXTRA_REFS_PER_THREAD) * NUM_THREADS * 2),
mRef->getRefCount());
// Run phase 2: release references.
for (U32 i = 0; i < NUM_THREADS; i++)
@ -136,7 +136,7 @@ TEST(ThreadSafeRefCount, Concurrent)
delete threads[i];
}
EXPECT_EQ(mRef->getRefCount(), 2); // increments of two
EXPECT_EQ(2, mRef->getRefCount()); // increments of two
mRef = NULL;
}
@ -148,7 +148,7 @@ TEST(ThreadSafeRefCount, Tagging)
TestObjectRef ref;
EXPECT_FALSE(ref.isTagged());
EXPECT_TRUE(bool(ref));
EXPECT_FALSE(bool(ref));
EXPECT_FALSE(bool(ref.ptr()));
EXPECT_TRUE(ref.trySetFromTo(ref, NULL));

View file

@ -86,6 +86,7 @@ DefineConsoleFunction( runAllUnitTests, int, (const char* testSpecs), (""),
"@param testSpecs A space-sepatated list of filters for test cases. "
"See https://code.google.com/p/googletest/wiki/AdvancedGuide#Running_a_Subset_of_the_Tests "
"and http://stackoverflow.com/a/14021997/945863 "
"for a description of the flag format.")
{
S32 testArgc = 0;