Added test for btKinematicCharacterController.
For now just a simple instantiation unit test.
This commit is contained in:
24
test/BulletDynamics/CMakeLists.txt
Normal file
24
test/BulletDynamics/CMakeLists.txt
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
SUBDIRS(pendulum )
|
||||||
|
|
||||||
|
INCLUDE_DIRECTORIES(
|
||||||
|
"${PROJECT_SOURCE_DIR}/src"
|
||||||
|
"${PROJECT_SOURCE_DIR}/test/gtest-1.7.0/include")
|
||||||
|
|
||||||
|
ADD_DEFINITIONS(-DUSE_GTEST)
|
||||||
|
ADD_DEFINITIONS(-D_VARIADIC_MAX=10)
|
||||||
|
|
||||||
|
LINK_LIBRARIES(BulletDynamics BulletCollision LinearMath gtest)
|
||||||
|
|
||||||
|
IF (NOT WIN32)
|
||||||
|
LINK_LIBRARIES(pthread)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
ADD_EXECUTABLE(Test_btKinematicCharacterController test_btKinematicCharacterController.cpp)
|
||||||
|
|
||||||
|
ADD_TEST(Test_btKinematicCharacterController_PASS Test_btKinematicCharacterController)
|
||||||
|
|
||||||
|
IF (INTERNAL_ADD_POSTFIX_EXECUTABLE_NAMES)
|
||||||
|
SET_TARGET_PROPERTIES(Test_btKinematicCharacterController PROPERTIES DEBUG_POSTFIX "_Debug")
|
||||||
|
SET_TARGET_PROPERTIES(Test_btKinematicCharacterController PROPERTIES MINSIZEREL_POSTFIX "_MinsizeRel")
|
||||||
|
SET_TARGET_PROPERTIES(Test_btKinematicCharacterController PROPERTIES RELWITHDEBINFO_POSTFIX "_RelWithDebugInfo")
|
||||||
|
ENDIF(INTERNAL_ADD_POSTFIX_EXECUTABLE_NAMES)
|
||||||
27
test/BulletDynamics/test_btKinematicCharacterController.cpp
Normal file
27
test/BulletDynamics/test_btKinematicCharacterController.cpp
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
|
||||||
|
|
||||||
|
#include <btBulletDynamicsCommon.h>
|
||||||
|
#include <BulletDynamics/Character/btKinematicCharacterController.h>
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
#include <BulletCollision/CollisionDispatch/btGhostObject.h>
|
||||||
|
|
||||||
|
|
||||||
|
GTEST_TEST(BulletDynamics, KinematicCharacterController) {
|
||||||
|
|
||||||
|
btPairCachingGhostObject* ghostObject = new btPairCachingGhostObject();
|
||||||
|
btBoxShape* convexShape = new btBoxShape(btVector3(1, 1, 1));
|
||||||
|
|
||||||
|
//For now only a simple test that it initializes correctly.
|
||||||
|
btKinematicCharacterController* tested = new btKinematicCharacterController(ghostObject, convexShape, 1);
|
||||||
|
EXPECT_TRUE(tested);
|
||||||
|
|
||||||
|
EXPECT_FLOAT_EQ(-9.8 * 3.0, tested->getGravity().x());
|
||||||
|
EXPECT_FLOAT_EQ(0, tested->getGravity().y());
|
||||||
|
EXPECT_FLOAT_EQ(0, tested->getGravity().z());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
::testing::InitGoogleTest(&argc, argv);
|
||||||
|
return RUN_ALL_TESTS();
|
||||||
|
}
|
||||||
@@ -3,5 +3,5 @@ IF(BUILD_BULLET3)
|
|||||||
SUBDIRS( InverseDynamics SharedMemory )
|
SUBDIRS( InverseDynamics SharedMemory )
|
||||||
ENDIF(BUILD_BULLET3)
|
ENDIF(BUILD_BULLET3)
|
||||||
|
|
||||||
SUBDIRS( gtest-1.7.0 collision RobotLogging BulletDynamics/pendulum )
|
SUBDIRS( gtest-1.7.0 collision RobotLogging BulletDynamics )
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user