Files
assimp/test/unit/utSharedPPData.cpp
aramis_acg 58eb786d62 Major API cleanup. Unified formatting & doxygen tags in the public API.
Added factory provider for default log streams.
Added default log streams to std::out and std::cerr.
Updated VC8 project config, boost workarounds is now working for the viewer.
Updated unit test suite.
Fixed some minor issues in the postprocessing-framework.

BROKEN: DebugDLL build.




git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@292 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2009-01-12 22:06:54 +00:00

67 lines
1.7 KiB
C++

#include "UnitTestPCH.h"
#include "utSharedPPData.h"
CPPUNIT_TEST_SUITE_REGISTRATION (SharedPPDataTest);
static bool destructed;
struct TestType
{
~TestType()
{
destructed = true;
}
};
// ------------------------------------------------------------------------------------------------
void SharedPPDataTest :: setUp (void)
{
shared = new SharedPostProcessInfo();
destructed = false;
}
// ------------------------------------------------------------------------------------------------
void SharedPPDataTest :: tearDown (void)
{
}
// ------------------------------------------------------------------------------------------------
void SharedPPDataTest :: testPODProperty (void)
{
int i = 5;
shared->AddProperty("test",i);
int o;
CPPUNIT_ASSERT(shared->GetProperty("test",o) && 5 == o);
CPPUNIT_ASSERT(!shared->GetProperty("test2",o) && 5 == o);
float f = 12.f, m;
shared->AddProperty("test",f);
CPPUNIT_ASSERT(shared->GetProperty("test",m) && 12.f == m);
}
// ------------------------------------------------------------------------------------------------
void SharedPPDataTest :: testPropertyPointer (void)
{
int *i = new int[35];
shared->AddProperty("test16",i);
int* o;
CPPUNIT_ASSERT(shared->GetProperty("test16",o) && o == i);
shared->RemoveProperty("test16");
CPPUNIT_ASSERT(!shared->GetProperty("test16",o));
}
// ------------------------------------------------------------------------------------------------
void SharedPPDataTest :: testPropertyDeallocation (void)
{
TestType *out, * pip = new TestType();
shared->AddProperty("quak",pip);
CPPUNIT_ASSERT(shared->GetProperty("quak",out) && out == pip);
delete shared;
CPPUNIT_ASSERT(destructed);
}