Merge pull request #5447 from AndrewMeadows/calcium

fix broken unit test builds
This commit is contained in:
Howard Stearns 2015-07-28 14:34:20 -07:00
commit a383f43f75
14 changed files with 25 additions and 135 deletions

View file

@ -9,13 +9,16 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "BulletUtilTests.h"
#include <iostream>
//#include "PhysicsTestUtil.h"
#include <BulletUtil.h>
#include <NumericalConstants.h>
#include "BulletUtilTests.h"
// Add additional qtest functionality (the include order is important!)
#include "GlmTestUtils.h"
#include "../QTestExtensions.h"
// Constants
const glm::vec3 origin(0.0f);

View file

@ -13,9 +13,6 @@
#define hifi_BulletUtilTests_h
#include <QtTest/QtTest>
// Add additional qtest functionality (the include order is important!)
#include "GlmTestUtils.h"
#include "../QTestExtensions.h"
class BulletUtilTests : public QObject {
Q_OBJECT

View file

@ -1,70 +0,0 @@
//
// CollisionInfoTests.cpp
// tests/physics/src
//
// Created by Andrew Meadows on 2/21/2014.
// Copyright 2014 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include <iostream>
#include <glm/glm.hpp>
#include <glm/gtx/quaternion.hpp>
#include <CollisionInfo.h>
#include <SharedUtil.h>
#include <StreamUtils.h>
#include "CollisionInfoTests.h"
QTEST_MAIN(CollisionInfoTests)
/*
static glm::vec3 xAxis(1.0f, 0.0f, 0.0f);
static glm::vec3 xZxis(0.0f, 1.0f, 0.0f);
static glm::vec3 xYxis(0.0f, 0.0f, 1.0f);
void CollisionInfoTests::rotateThenTranslate() {
CollisionInfo collision;
collision._penetration = xAxis;
collision._contactPoint = xYxis;
collision._addedVelocity = xAxis + xYxis + xZxis;
glm::quat rotation = glm::angleAxis(PI_OVER_TWO, zAxis);
float distance = 3.0f;
glm::vec3 translation = distance * xYxis;
collision.rotateThenTranslate(rotation, translation);
QCOMPARE(collision._penetration, xYxis);
glm::vec3 expectedContactPoint = -xAxis + translation;
QCOMPARE(collision._contactPoint, expectedContactPoint);
glm::vec3 expectedAddedVelocity = xYxis - xAxis + xZxis;
QCOMPARE(collision._addedVelocity, expectedAddedVelocity);
}
void CollisionInfoTests::translateThenRotate() {
CollisionInfo collision;
collision._penetration = xAxis;
collision._contactPoint = xYxis;
collision._addedVelocity = xAxis + xYxis + xZxis;
glm::quat rotation = glm::angleAxis( -PI_OVER_TWO, zAxis);
float distance = 3.0f;
glm::vec3 translation = distance * xYxis;
collision.translateThenRotate(translation, rotation);
QCOMPARE(collision._penetration, -xYxis);
glm::vec3 expectedContactPoint = (1.0f + distance) * xAxis;
QCOMPARE(collision._contactPoint, expectedContactPoint);
glm::vec3 expectedAddedVelocity = - xYxis + xAxis + xYxis;
QCOMPARE(collision._addedVelocity, expectedAddedVelocity);
}*/

View file

@ -1,29 +0,0 @@
//
// CollisionInfoTests.h
// tests/physics/src
//
// Created by Andrew Meadows on 2/21/2014.
// Copyright 2014 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#ifndef hifi_CollisionInfoTests_h
#define hifi_CollisionInfoTests_h
#include <QtTest/QtTest>
// Add additional qtest functionality (the include order is important!)
#include "GlmTestUtils.h"
#include "../QTestExtensions.h"
class CollisionInfoTests : public QObject {
Q_OBJECT
private slots:
// void rotateThenTranslate();
// void translateThenRotate();
};
#endif // hifi_CollisionInfoTests_h

View file

@ -9,11 +9,15 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "MeshMassPropertiesTests.h"
#include <iostream>
#include <string>
#include <MeshMassProperties.h>
#include "MeshMassPropertiesTests.h"
// Add additional qtest functionality (the include order is important!)
#include "BulletTestUtils.h"
#include "GlmTestUtils.h"
#include "../QTestExtensions.h"
const btScalar acceptableRelativeError(1.0e-5f);
const btScalar acceptableAbsoluteError(1.0e-4f);

View file

@ -13,12 +13,6 @@
#define hifi_MeshMassPropertiesTests_h
#include <QtTest/QtTest>
#include <QtGlobal>
// Add additional qtest functionality (the include order is important!)
#include "BulletTestUtils.h"
#include "GlmTestUtils.h"
#include "../QTestExtensions.h"
// Relative error macro (see errorTest in BulletTestUtils.h)
#define QCOMPARE_WITH_RELATIVE_ERROR(actual, expected, relativeError) \

View file

@ -9,12 +9,15 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "ShapeColliderTests.h"
//#include <stdio.h>
#include <iostream>
#include <math.h>
#include <glm/glm.hpp>
#include <glm/gtx/quaternion.hpp>
#include <QtGlobal>
#include <AACubeShape.h>
#include <CapsuleShape.h>
@ -25,7 +28,10 @@
#include <SphereShape.h>
#include <StreamUtils.h>
#include "ShapeColliderTests.h"
// Add additional qtest functionality (the include order is important!)
#include "BulletTestUtils.h"
#include "GlmTestUtils.h"
#include "../QTestExtensions.h"
const glm::vec3 origin(0.0f);
@ -1553,8 +1559,6 @@ void ShapeColliderTests::rayHitsCapsule() {
intersection._rayDirection = - xAxis;
QCOMPARE(capsule.findRayIntersection(intersection), true);
float expectedDistance = startDistance - radius * sqrtf(2.0f * delta); // using small angle approximation of cosine
// float relativeError = fabsf(intersection._hitDistance - expectedDistance) / startDistance;
// for edge cases we allow a LOT of error
QCOMPARE_WITH_ABS_ERROR(intersection._hitDistance, expectedDistance, startDistance * EDGE_CASE_SLOP_FACTOR * EPSILON);
}
@ -1564,8 +1568,6 @@ void ShapeColliderTests::rayHitsCapsule() {
intersection._rayDirection = - xAxis;
QCOMPARE(capsule.findRayIntersection(intersection), true);
float expectedDistance = startDistance - radius * sqrtf(2.0f * delta); // using small angle approximation of cosine
// float relativeError = fabsf(intersection._hitDistance - expectedDistance) / startDistance;
// for edge cases we allow a LOT of error
QCOMPARE_WITH_ABS_ERROR(intersection._hitDistance, expectedDistance, startDistance * EPSILON * EDGE_CASE_SLOP_FACTOR);
}
@ -1575,8 +1577,6 @@ void ShapeColliderTests::rayHitsCapsule() {
intersection._rayDirection = - xAxis;
QCOMPARE(capsule.findRayIntersection(intersection), true);
float expectedDistance = startDistance - radius * sqrtf(2.0f * delta); // using small angle approximation of cosine
float relativeError = fabsf(intersection._hitDistance - expectedDistance) / startDistance;
// for edge cases we allow a LOT of error
QCOMPARE_WITH_ABS_ERROR(intersection._hitDistance, expectedDistance, startDistance * EPSILON * EDGE_CASE_SLOP_FACTOR);
}
// TODO: test at steep angles near cylinder/cap junction

View file

@ -13,13 +13,6 @@
#define hifi_ShapeColliderTests_h
#include <QtTest/QtTest>
#include <QtGlobal>
// Add additional qtest functionality (the include order is important!)
#include "BulletTestUtils.h"
#include "GlmTestUtils.h"
#include "../QTestExtensions.h"
class ShapeColliderTests : public QObject {
Q_OBJECT

View file

@ -16,6 +16,7 @@
#include <StreamUtils.h>
#include "AngularConstraintTests.h"
#include "../QTestExtensions.h"
// Computes the error value between two quaternions (using glm::dot)
float getErrorDifference(const glm::quat& a, const glm::quat& b) {

View file

@ -12,6 +12,7 @@
#ifndef hifi_AngularConstraintTests_h
#define hifi_AngularConstraintTests_h
#include <glm/glm.hpp>
#include <QtTest/QtTest>
class AngularConstraintTests : public QObject {
@ -21,10 +22,6 @@ private slots:
void testConeRollerConstraint();
};
// Use QCOMPARE_WITH_ABS_ERROR and define it for glm::quat
#include <glm/glm.hpp>
float getErrorDifference (const glm::quat& a, const glm::quat& b);
QTextStream & operator << (QTextStream& stream, const glm::quat& q);
#include "../QTestExtensions.h"
float getErrorDifference(const glm::quat& a, const glm::quat& b);
#endif // hifi_AngularConstraintTests_h

View file

@ -16,6 +16,7 @@
#include <limits>
#include <qqueue.h>
#include <../QTestExtensions.h>
QTEST_MAIN(MovingPercentileTests)

View file

@ -13,7 +13,6 @@
#define hifi_MovingPercentileTests_h
#include <QtTest/QtTest>
#include <../QTestExtensions.h>
class MovingPercentileTests : public QObject {
Q_OBJECT

View file

@ -8,10 +8,12 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "TransformTests.h"
#include <Transform.h>
#include "TransformTests.h"
#include "SharedLogging.h"
#include <../QTestExtensions.h>
using namespace glm;

View file

@ -40,8 +40,6 @@ inline QTextStream& operator<< (QTextStream& stream, const glm::mat4& matrix) {
return stream;
}
#include <../QTestExtensions.h>
class TransformTests : public QObject {
Q_OBJECT
private slots: