AGX Dynamics  2.37.2.0
agxUnit Namespace Reference

Classes

class  AlwaysFailingAllocator
 Never allocates anything, throws always an exception. Only for testing. More...
 
class  BodyCaptureDeterminism
 Class for capturing data for measuring determinism. More...
 

Typedefs

typedef agx::RigidBodyPtrVector(* ManyBodiesRestingScenePtr) (agxSDK::Simulation *simulation, osg::Group *root)
 
typedef agx::RigidBody *(* OneBodyRestingScenePtr) (agxSDK::Simulation *simulation, osg::Group *root)
 
typedef void(* ScenePtr) (agxSDK::Simulation *simulation, osg::Group *root)
 

Enumerations

enum  NormalType {
  NORMAL, NORMAL_AND_NEGATIVE, ORTHOGONAL_TO_NORMAL, NORMAL_NO_DEPTH,
  IGNORE_NORMAL_AND_DEPTH
}
 

Functions

bool haveUnittestingArguments (agxIO::ArgumentParser *arguments)
 
bool haveUnittestingArguments (int argc, char **argv)
 
void initUnittestFrameWork (agxIO::ArgumentParser *)
 Initializes the unit testing framework from an argument parser. More...
 
void initUnittestFrameWork (int, char **)
 Initializes the unit testing framework from command line arguments. More...
 
bool isUnittestingEnabled ()
 Is unit testing enabled? (Has to be both built and initialized). More...
 
bool shouldOnlyFastUnittestsBeRun ()
 Should only fast unit tests be run? More...
 
template<typename T >
void testAllocationOverflow (const agx::String &)
 The purpose of this test is to test for overflow in allocation size. More...
 
template<typename T >
void testBadAlloc (const agx::String &)
 The purpose of this test is to test how the container recovers from bad alloc. More...
 
AGXOSG_EXPORT osg::Group * testContainsContact (agxSDK::Simulation *simulation, agxOSG::ExampleApplication *application, ScenePtr scene, const char *groupName, const char *testName, agx::Vec3f normal, agx::Real depth, NormalType normalType=NORMAL, unsigned int minNumContacts=1)
 
AGXOSG_EXPORT osg::Group * testContainsContact (agxSDK::Simulation *simulation, agxOSG::ExampleApplication *application, ScenePtr scene, const char *groupName, const char *testName, agx::Vec3 normal, agx::Real depth, NormalType normalType=NORMAL, unsigned int minNumContacts=1)
 
AGXOSG_EXPORT osg::Group * testContainsNoContact (agxSDK::Simulation *simulation, agxOSG::ExampleApplication *application, ScenePtr scene, const char *groupName, const char *testName)
 
AGXOSG_EXPORT osg::Group * testResting (agxSDK::Simulation *simulation, agxOSG::ExampleApplication *application, OneBodyRestingScenePtr restingScene, const char *groupName, const char *testName, agx::Real preTestingTime=agx::Real(1))
 
AGXOSG_EXPORT osg::Group * testResting (agxSDK::Simulation *simulation, agxOSG::ExampleApplication *application, ManyBodiesRestingScenePtr restingScene, const char *groupName, const char *testName, agx::Real preTestingTime=agx::Real(1))
 

Typedef Documentation

◆ ManyBodiesRestingScenePtr

typedef agx::RigidBodyPtrVector(* agxUnit::ManyBodiesRestingScenePtr) (agxSDK::Simulation *simulation, osg::Group *root)

Definition at line 60 of file agxOSGUnitTestHelperFunctions.h.

◆ OneBodyRestingScenePtr

typedef agx::RigidBody*(* agxUnit::OneBodyRestingScenePtr) (agxSDK::Simulation *simulation, osg::Group *root)

Definition at line 56 of file agxOSGUnitTestHelperFunctions.h.

◆ ScenePtr

typedef void(* agxUnit::ScenePtr) (agxSDK::Simulation *simulation, osg::Group *root)

Definition at line 52 of file agxOSGUnitTestHelperFunctions.h.

Enumeration Type Documentation

◆ NormalType

Enumerator
NORMAL 
NORMAL_AND_NEGATIVE 
ORTHOGONAL_TO_NORMAL 
NORMAL_NO_DEPTH 
IGNORE_NORMAL_AND_DEPTH 

Definition at line 81 of file agxOSGUnitTestHelperFunctions.h.

Function Documentation

◆ haveUnittestingArguments() [1/2]

bool agxUnit::haveUnittestingArguments ( agxIO::ArgumentParser *  arguments)
inline
Returns
true if any of the unit test command line arguments have been passed.

Definition at line 30 of file UnitMacros.h.

References agxIO::ArgumentParser::find().

◆ haveUnittestingArguments() [2/2]

bool agxUnit::haveUnittestingArguments ( int  argc,
char **  argv 
)
inline
Returns
true if any of the unit test command line arguments have been passed.

Definition at line 41 of file UnitMacros.h.

References agx::begin(), agx::end(), initUnittestFrameWork(), isUnittestingEnabled(), and shouldOnlyFastUnittestsBeRun().

◆ initUnittestFrameWork() [1/2]

void agxUnit::initUnittestFrameWork ( agxIO::ArgumentParser *  )
inline

Initializes the unit testing framework from an argument parser.

Definition at line 319 of file UnitMacros.h.

Referenced by haveUnittestingArguments().

◆ initUnittestFrameWork() [2/2]

void agxUnit::initUnittestFrameWork ( int  ,
char **   
)
inline

Initializes the unit testing framework from command line arguments.

Definition at line 325 of file UnitMacros.h.

◆ isUnittestingEnabled()

bool agxUnit::isUnittestingEnabled ( )
inline

Is unit testing enabled? (Has to be both built and initialized).

Definition at line 331 of file UnitMacros.h.

Referenced by haveUnittestingArguments().

◆ shouldOnlyFastUnittestsBeRun()

bool agxUnit::shouldOnlyFastUnittestsBeRun ( )
inline

Should only fast unit tests be run?

Definition at line 338 of file UnitMacros.h.

Referenced by haveUnittestingArguments().

◆ testAllocationOverflow()

template<typename T >
void agxUnit::testAllocationOverflow ( const agx::String &  )

The purpose of this test is to test for overflow in allocation size.

Either it should Throw an exception, or have the right size in allocation. Only call with containers that have AlwaysFailingAllocator!

Definition at line 101 of file ContainerTests.h.

References AGXUNIT_ASSERT_MESSAGE, AGXUNIT_BEGIN_TEST, AGXUNIT_END_TEST, agx::AgXString< T >::format(), and agx::max().

◆ testBadAlloc()

template<typename T >
void agxUnit::testBadAlloc ( const agx::String &  )

The purpose of this test is to test how the container recovers from bad alloc.

  1. It should through an exception.
  2. Otherwise, its state should be intact. Only call with containers that have AlwaysFailingAllocator!

Definition at line 56 of file ContainerTests.h.

References AGXUNIT_ASSERT_MESSAGE, AGXUNIT_BEGIN_TEST, and AGXUNIT_END_TEST.

◆ testContainsContact() [1/2]

AGXOSG_EXPORT osg::Group* agxUnit::testContainsContact ( agxSDK::Simulation *  simulation,
agxOSG::ExampleApplication *  application,
ScenePtr  scene,
const char *  groupName,
const char *  testName,
agx::Vec3f  normal,
agx::Real  depth,
NormalType  normalType = NORMAL,
unsigned int  minNumContacts = 1 
)

◆ testContainsContact() [2/2]

AGXOSG_EXPORT osg::Group* agxUnit::testContainsContact ( agxSDK::Simulation *  simulation,
agxOSG::ExampleApplication *  application,
ScenePtr  scene,
const char *  groupName,
const char *  testName,
agx::Vec3  normal,
agx::Real  depth,
NormalType  normalType = NORMAL,
unsigned int  minNumContacts = 1 
)

◆ testContainsNoContact()

AGXOSG_EXPORT osg::Group* agxUnit::testContainsNoContact ( agxSDK::Simulation *  simulation,
agxOSG::ExampleApplication *  application,
ScenePtr  scene,
const char *  groupName,
const char *  testName 
)

◆ testResting() [1/2]

AGXOSG_EXPORT osg::Group* agxUnit::testResting ( agxSDK::Simulation *  simulation,
agxOSG::ExampleApplication *  application,
OneBodyRestingScenePtr  restingScene,
const char *  groupName,
const char *  testName,
agx::Real  preTestingTime = agx::Real(1) 
)

◆ testResting() [2/2]

AGXOSG_EXPORT osg::Group* agxUnit::testResting ( agxSDK::Simulation *  simulation,
agxOSG::ExampleApplication *  application,
ManyBodiesRestingScenePtr  restingScene,
const char *  groupName,
const char *  testName,
agx::Real  preTestingTime = agx::Real(1) 
)