diff --git a/test/attitude.cpp b/test/attitude.cpp index 49b47b3807..406a56f373 100644 --- a/test/attitude.cpp +++ b/test/attitude.cpp @@ -1,20 +1,7 @@ #include "test_macros.hpp" #include -using matrix::AxisAnglef; -using matrix::Dcm; -using matrix::Dcmf; -using matrix::Euler; -using matrix::Eulerf; -using matrix::eye; -using matrix::isEqualF; -using matrix::Matrix; -using matrix::Quaternion; -using matrix::Quatf; -using matrix::SquareMatrix; -using matrix::Vector3f; -using matrix::Vector; -using matrix::zeros; +using namespace matrix; int main() { @@ -50,10 +37,10 @@ int main() // quaternion ctor Quatf q0(1, 2, 3, 4); Quatf q(q0); - TEST(fabsf(q(0) - 1) < eps); - TEST(fabsf(q(1) - 2) < eps); - TEST(fabsf(q(2) - 3) < eps); - TEST(fabsf(q(3) - 4) < eps); + TEST(fabs(q(0) - 1) < eps); + TEST(fabs(q(1) - 2) < eps); + TEST(fabs(q(2) - 3) < eps); + TEST(fabs(q(3) - 4) < eps); // quat normalization q.normalize(); @@ -107,7 +94,7 @@ int main() for (auto & row : A._data) { Vector3f rvec(row); - err += fabsf(1.0f - rvec.length()); + err += fabs(1.0f - rvec.length()); } TEST(err < eps); @@ -215,17 +202,17 @@ int main() // quaternion inverse q = q_check.inversed(); - TEST(fabsf(q_check(0) - q(0)) < eps); - TEST(fabsf(q_check(1) + q(1)) < eps); - TEST(fabsf(q_check(2) + q(2)) < eps); - TEST(fabsf(q_check(3) + q(3)) < eps); + TEST(fabs(q_check(0) - q(0)) < eps); + TEST(fabs(q_check(1) + q(1)) < eps); + TEST(fabs(q_check(2) + q(2)) < eps); + TEST(fabs(q_check(3) + q(3)) < eps); q = q_check; q.invert(); - TEST(fabsf(q_check(0) - q(0)) < eps); - TEST(fabsf(q_check(1) + q(1)) < eps); - TEST(fabsf(q_check(2) + q(2)) < eps); - TEST(fabsf(q_check(3) + q(3)) < eps); + TEST(fabs(q_check(0) - q(0)) < eps); + TEST(fabs(q_check(1) + q(1)) < eps); + TEST(fabs(q_check(2) + q(2)) < eps); + TEST(fabs(q_check(3) + q(3)) < eps); // non-unit quaternion invese Quatf qI(1.0f, 0.0f, 0.0f, 0.0f); @@ -237,52 +224,52 @@ int main() rot(0) = 1.0f; rot(1) = rot(2) = 0.0f; qI.rotate(rot); - Quatf q_true(cosf(1.0f / 2), sinf(1.0f / 2), 0.0f, 0.0f); - TEST(fabsf(qI(0) - q_true(0)) < eps); - TEST(fabsf(qI(1) - q_true(1)) < eps); - TEST(fabsf(qI(2) - q_true(2)) < eps); - TEST(fabsf(qI(3) - q_true(3)) < eps); + Quatf q_true(cos(1.0f / 2), sin(1.0f / 2), 0.0f, 0.0f); + TEST(fabs(qI(0) - q_true(0)) < eps); + TEST(fabs(qI(1) - q_true(1)) < eps); + TEST(fabs(qI(2) - q_true(2)) < eps); + TEST(fabs(qI(3) - q_true(3)) < eps); // rotate quaternion (zero rotation) qI = Quatf(1.0f, 0.0f, 0.0f, 0.0f); rot(0) = 0.0f; rot(1) = rot(2) = 0.0f; qI.rotate(rot); - q_true = Quatf(cosf(0.0f), sinf(0.0f), 0.0f, 0.0f); - TEST(fabsf(qI(0) - q_true(0)) < eps); - TEST(fabsf(qI(1) - q_true(1)) < eps); - TEST(fabsf(qI(2) - q_true(2)) < eps); - TEST(fabsf(qI(3) - q_true(3)) < eps); + q_true = Quatf(cos(0.0f), sin(0.0f), 0.0f, 0.0f); + TEST(fabs(qI(0) - q_true(0)) < eps); + TEST(fabs(qI(1) - q_true(1)) < eps); + TEST(fabs(qI(2) - q_true(2)) < eps); + TEST(fabs(qI(3) - q_true(3)) < eps); // get rotation axis from quaternion (nonzero rotation) - q = Quatf(cosf(1.0f / 2), 0.0f, sinf(1.0f / 2), 0.0f); + q = Quatf(cos(1.0f / 2), 0.0f, sin(1.0f / 2), 0.0f); rot = q.to_axis_angle(); - TEST(fabsf(rot(0)) < eps); - TEST(fabsf(rot(1) - 1.0f) < eps); - TEST(fabsf(rot(2)) < eps); + TEST(fabs(rot(0)) < eps); + TEST(fabs(rot(1) - 1.0f) < eps); + TEST(fabs(rot(2)) < eps); // get rotation axis from quaternion (zero rotation) q = Quatf(1.0f, 0.0f, 0.0f, 0.0f); rot = q.to_axis_angle(); - TEST(fabsf(rot(0)) < eps); - TEST(fabsf(rot(1)) < eps); - TEST(fabsf(rot(2)) < eps); + TEST(fabs(rot(0)) < eps); + TEST(fabs(rot(1)) < eps); + TEST(fabs(rot(2)) < eps); // from axis angle (zero rotation) rot(0) = rot(1) = rot(2) = 0.0f; q.from_axis_angle(rot, 0.0f); q_true = Quatf(1.0f, 0.0f, 0.0f, 0.0f); - TEST(fabsf(q(0) - q_true(0)) < eps); - TEST(fabsf(q(1) - q_true(1)) < eps); - TEST(fabsf(q(2) - q_true(2)) < eps); - TEST(fabsf(q(3) - q_true(3)) < eps); + TEST(fabs(q(0) - q_true(0)) < eps); + TEST(fabs(q(1) - q_true(1)) < eps); + TEST(fabs(q(2) - q_true(2)) < eps); + TEST(fabs(q(3) - q_true(3)) < eps); // Quaternion initialisation per array float q_array[] = {0.9833f, -0.0343f, -0.1060f, -0.1436f}; Quaternionq_from_array(q_array); for (size_t i = 0; i < 4; i++) { - TEST(fabsf(q_from_array(i) - q_array[i]) < eps); + TEST(fabs(q_from_array(i) - q_array[i]) < eps); } // axis angle @@ -350,10 +337,10 @@ int main() q = Quatf(1, 2, 3, 4); float dst[4] = {}; q.copyTo(dst); - TEST(fabsf(q(0) - dst[0]) < eps); - TEST(fabsf(q(1) - dst[1]) < eps); - TEST(fabsf(q(2) - dst[2]) < eps); - TEST(fabsf(q(3) - dst[3]) < eps); + TEST(fabs(q(0) - dst[0]) < eps); + TEST(fabs(q(1) - dst[1]) < eps); + TEST(fabs(q(2) - dst[2]) < eps); + TEST(fabs(q(3) - dst[3]) < eps); } diff --git a/test/filter.cpp b/test/filter.cpp index c5e6d2ca77..342da22824 100644 --- a/test/filter.cpp +++ b/test/filter.cpp @@ -1,11 +1,7 @@ #include "test_macros.hpp" #include -using matrix::Matrix; -using matrix::kalman_correct; -using matrix::eye; -using matrix::SquareMatrix; -using matrix::Vector; +using namespace matrix; int main() { diff --git a/test/hatvee.cpp b/test/hatvee.cpp index 6250621a24..aa2c2cf90e 100644 --- a/test/hatvee.cpp +++ b/test/hatvee.cpp @@ -1,10 +1,7 @@ #include "test_macros.hpp" #include -using matrix::Dcm; -using matrix::Euler; -using matrix::isEqual; -using matrix::Vector3; +using namespace matrix; int main() { diff --git a/test/helper.cpp b/test/helper.cpp index e280f5238f..cfc1aeb3ef 100644 --- a/test/helper.cpp +++ b/test/helper.cpp @@ -1,10 +1,7 @@ #include "test_macros.hpp" #include -using matrix::isEqual; -using matrix::isEqualF; -using matrix::Vector3f; -using matrix::wrap_pi; +using namespace matrix; int main() { diff --git a/test/integration.cpp b/test/integration.cpp index ec4cf80230..6dbd807205 100644 --- a/test/integration.cpp +++ b/test/integration.cpp @@ -1,14 +1,12 @@ #include "test_macros.hpp" #include -using matrix::Matrix; -using matrix::ones; -using matrix::Vector; +using namespace matrix; Vector f(float t, const Matrix & /*y*/, const Matrix & /*u*/); Vector f(float t, const Matrix & /*y*/, const Matrix & /*u*/) { - float v = -sinf(t); + float v = -sin(t); return v*ones(); } @@ -20,7 +18,7 @@ int main() float tf = 2; float h = 0.001f; integrate_rk4(f, y, u, t0, tf, h, y); - float v = 1 + cosf(tf) - cosf(t0); + float v = 1 + cos(tf) - cos(t0); TEST(isEqual(y, (ones()*v))); return 0; } diff --git a/test/inverse.cpp b/test/inverse.cpp index 92aaa70a03..20d69c4282 100644 --- a/test/inverse.cpp +++ b/test/inverse.cpp @@ -1,8 +1,7 @@ #include "test_macros.hpp" #include -using matrix::SquareMatrix; -using matrix::zeros; +using namespace matrix; static const size_t n_large = 50; diff --git a/test/matrixAssignment.cpp b/test/matrixAssignment.cpp index 6f18d36ee7..91b4cc02b0 100644 --- a/test/matrixAssignment.cpp +++ b/test/matrixAssignment.cpp @@ -1,11 +1,7 @@ #include "test_macros.hpp" #include -using matrix::Matrix; -using matrix::Matrix3f; -using matrix::Scalar; -using matrix::Vector; -using matrix::Vector2f; +using namespace matrix; int main() { @@ -26,7 +22,7 @@ int main() Matrix3f m2(data); for(int i=0; i<9; i++) { - TEST(fabsf(data[i] - m2.data()[i]) < 1e-6f); + TEST(fabs(data[i] - m2.data()[i]) < 1e-6f); } float data2d[3][3] = { @@ -36,7 +32,7 @@ int main() }; m2 = Matrix3f(data2d); for(int i=0; i<9; i++) { - TEST(fabsf(data[i] - m2.data()[i]) < 1e-6f); + TEST(fabs(data[i] - m2.data()[i]) < 1e-6f); } float data_times_2[9] = {2, 4, 6, 8, 10, 12, 14, 16, 18}; @@ -98,17 +94,17 @@ int main() m4.swapCols(2, 2); TEST(isEqual(m4, Matrix3f(data))); - TEST(fabsf(m4.min() - 1) < 1e-5); - TEST(fabsf((-m4).min() + 9) < 1e-5); + TEST(fabs(m4.min() - 1) < 1e-5); + TEST(fabs((-m4).min() + 9) < 1e-5); Scalar s; s = 1; const Vector & s_vect = s; - TEST(fabsf(s - 1) < 1e-5); - TEST(fabsf(s_vect(0) - 1.0f) < 1e-5); + TEST(fabs(s - 1) < 1e-5); + TEST(fabs(s_vect(0) - 1.0f) < 1e-5); Matrix m5 = s; - TEST(fabsf(m5(0,0) - s) < 1e-5); + TEST(fabs(m5(0,0) - s) < 1e-5); Matrix m6; m6.setRow(0, Vector2f(1, 2)); diff --git a/test/matrixMult.cpp b/test/matrixMult.cpp index 97caa1532d..65623260dc 100644 --- a/test/matrixMult.cpp +++ b/test/matrixMult.cpp @@ -1,8 +1,7 @@ #include "test_macros.hpp" #include -using matrix::Matrix3f; -using matrix::eye; +using namespace matrix; int main() { diff --git a/test/matrixScalarMult.cpp b/test/matrixScalarMult.cpp index 925dbd95a6..320f0c8b58 100644 --- a/test/matrixScalarMult.cpp +++ b/test/matrixScalarMult.cpp @@ -2,7 +2,7 @@ #include -using matrix::Matrix3f; +using namespace matrix; int main() { diff --git a/test/setIdentity.cpp b/test/setIdentity.cpp index fc48ed41a2..9e1009548b 100644 --- a/test/setIdentity.cpp +++ b/test/setIdentity.cpp @@ -1,7 +1,7 @@ #include "test_macros.hpp" #include -using matrix::Matrix3f; +using namespace matrix; int main() { @@ -11,10 +11,10 @@ int main() for (size_t i = 0; i < 3; i++) { for (size_t j = 0; j < 3; j++) { if (i == j) { - TEST(fabsf(A(i, j) - 1) < 1e-7); + TEST(fabs(A(i, j) - 1) < 1e-7); } else { - TEST(fabsf(A(i, j) - 0) < 1e-7); + TEST(fabs(A(i, j) - 0) < 1e-7); } } } @@ -25,10 +25,10 @@ int main() for (size_t i = 0; i < 3; i++) { for (size_t j = 0; j < 3; j++) { if (i == j) { - TEST(fabsf(B(i, j) - 1) < 1e-7); + TEST(fabs(B(i, j) - 1) < 1e-7); } else { - TEST(fabsf(B(i, j) - 0) < 1e-7); + TEST(fabs(B(i, j) - 0) < 1e-7); } } } diff --git a/test/slice.cpp b/test/slice.cpp index ba44980f1c..4c43e93c0a 100644 --- a/test/slice.cpp +++ b/test/slice.cpp @@ -1,8 +1,7 @@ #include "test_macros.hpp" #include -using matrix::Matrix; -using matrix::SquareMatrix; +using namespace matrix; int main() { diff --git a/test/squareMatrix.cpp b/test/squareMatrix.cpp index 0ecb26874b..2c668e4abf 100644 --- a/test/squareMatrix.cpp +++ b/test/squareMatrix.cpp @@ -2,8 +2,7 @@ #include -using matrix::SquareMatrix; -using matrix::Vector3; +using namespace matrix; int main() { diff --git a/test/transpose.cpp b/test/transpose.cpp index 350c626070..41627a6b0c 100644 --- a/test/transpose.cpp +++ b/test/transpose.cpp @@ -2,7 +2,7 @@ #include -using matrix::Matrix; +using namespace matrix; int main() { diff --git a/test/vector.cpp b/test/vector.cpp index 7a1aa863f1..21c41e8bff 100644 --- a/test/vector.cpp +++ b/test/vector.cpp @@ -2,8 +2,7 @@ #include -using matrix::isEqualF; -using matrix::Vector; +using namespace matrix; int main() { diff --git a/test/vector2.cpp b/test/vector2.cpp index 4e93282217..a8838d9b4e 100644 --- a/test/vector2.cpp +++ b/test/vector2.cpp @@ -4,31 +4,30 @@ #include "test_macros.hpp" -using matrix::Matrix; -using matrix::Vector2f; +using namespace matrix; int main() { Vector2f a(1, 0); Vector2f b(0, 1); - TEST(fabsf(a % b - 1.0f) < 1e-5); + TEST(fabs(a % b - 1.0f) < 1e-5); Vector2f c; - TEST(fabsf(c(0) - 0) < 1e-5); - TEST(fabsf(c(1) - 0) < 1e-5); + TEST(fabs(c(0) - 0) < 1e-5); + TEST(fabs(c(1) - 0) < 1e-5); Matrix d(a); - TEST(fabsf(d(0,0) - 1) < 1e-5); - TEST(fabsf(d(1,0) - 0) < 1e-5); + TEST(fabs(d(0,0) - 1) < 1e-5); + TEST(fabs(d(1,0) - 0) < 1e-5); Vector2f e(d); - TEST(fabsf(e(0) - 1) < 1e-5); - TEST(fabsf(e(1) - 0) < 1e-5); + TEST(fabs(e(0) - 1) < 1e-5); + TEST(fabs(e(1) - 0) < 1e-5); float data[] = {4,5}; Vector2f f(data); - TEST(fabsf(f(0) - 4) < 1e-5); - TEST(fabsf(f(1) - 5) < 1e-5); + TEST(fabs(f(0) - 4) < 1e-5); + TEST(fabs(f(1) - 5) < 1e-5); return 0; } diff --git a/test/vector3.cpp b/test/vector3.cpp index f603eced66..ebe8a2ca6f 100644 --- a/test/vector3.cpp +++ b/test/vector3.cpp @@ -2,10 +2,7 @@ #include -using matrix::isEqual; -using matrix::isEqualF; -using matrix::Matrix; -using matrix::Vector3f; +using namespace matrix; int main() { diff --git a/test/vectorAssignment.cpp b/test/vectorAssignment.cpp index 1f78211965..e8e63462a2 100644 --- a/test/vectorAssignment.cpp +++ b/test/vectorAssignment.cpp @@ -2,8 +2,7 @@ #include "test_macros.hpp" -using matrix::SquareMatrix; -using matrix::Vector3f; +using namespace matrix; int main() { @@ -14,20 +13,20 @@ int main() static const float eps = 1e-7f; - TEST(fabsf(v(0) - 1) < eps); - TEST(fabsf(v(1) - 2) < eps); - TEST(fabsf(v(2) - 3) < eps); + TEST(fabs(v(0) - 1) < eps); + TEST(fabs(v(1) - 2) < eps); + TEST(fabs(v(2) - 3) < eps); Vector3f v2(4, 5, 6); - TEST(fabsf(v2(0) - 4) < eps); - TEST(fabsf(v2(1) - 5) < eps); - TEST(fabsf(v2(2) - 6) < eps); + TEST(fabs(v2(0) - 4) < eps); + TEST(fabs(v2(1) - 5) < eps); + TEST(fabs(v2(2) - 6) < eps); SquareMatrix m = diag(Vector3f(1,2,3)); - TEST(fabsf(m(0, 0) - 1) < eps); - TEST(fabsf(m(1, 1) - 2) < eps); - TEST(fabsf(m(2, 2) - 3) < eps); + TEST(fabs(m(0, 0) - 1) < eps); + TEST(fabs(m(1, 1) - 2) < eps); + TEST(fabs(m(2, 2) - 3) < eps); return 0; }