reformat unittests.

This commit is contained in:
Kim Kulling
2020-03-22 12:13:09 +01:00
parent edc73552cd
commit 68a9fa2df3
77 changed files with 2555 additions and 1632 deletions

View File

@@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2020, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@@ -50,27 +48,23 @@ class utMatrix3x3Test : public ::testing::Test {
// empty
};
TEST_F( utMatrix3x3Test, FromToMatrixTest ) {
TEST_F(utMatrix3x3Test, FromToMatrixTest) {
aiVector3D res;
aiMatrix3x3 trafo;
const double PRECISION = 0.000001;
// axes test
aiVector3D axes[] =
{ aiVector3D(1, 0, 0)
, aiVector3D(0, 1, 0)
, aiVector3D(0, 0, 1)
};
aiVector3D axes[] = { aiVector3D(1, 0, 0), aiVector3D(0, 1, 0), aiVector3D(0, 0, 1) };
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 3; ++j) {
aiMatrix3x3::FromToMatrix( axes[i], axes[j], trafo );
aiMatrix3x3::FromToMatrix(axes[i], axes[j], trafo);
res = trafo * axes[i];
ASSERT_NEAR( axes[j].x, res.x, PRECISION );
ASSERT_NEAR( axes[j].y, res.y, PRECISION );
ASSERT_NEAR( axes[j].z, res.z, PRECISION );
ASSERT_NEAR(axes[j].x, res.x, PRECISION);
ASSERT_NEAR(axes[j].y, res.y, PRECISION);
ASSERT_NEAR(axes[j].z, res.z, PRECISION);
}
}
@@ -80,22 +74,14 @@ TEST_F( utMatrix3x3Test, FromToMatrixTest ) {
aiVector3D from, to;
for (int i = 0; i < NUM_SAMPLES; ++i) {
from = aiVector3D
( 1.f * rand() / RAND_MAX
, 1.f * rand() / RAND_MAX
, 1.f * rand() / RAND_MAX
).Normalize();
to = aiVector3D
( 1.f * rand() / RAND_MAX
, 1.f * rand() / RAND_MAX
, 1.f * rand() / RAND_MAX
).Normalize();
from = aiVector3D(1.f * rand() / RAND_MAX, 1.f * rand() / RAND_MAX, 1.f * rand() / RAND_MAX).Normalize();
to = aiVector3D(1.f * rand() / RAND_MAX, 1.f * rand() / RAND_MAX, 1.f * rand() / RAND_MAX).Normalize();
aiMatrix3x3::FromToMatrix( from, to, trafo );
aiMatrix3x3::FromToMatrix(from, to, trafo);
res = trafo * from;
ASSERT_NEAR( to.x, res.x, PRECISION );
ASSERT_NEAR( to.y, res.y, PRECISION );
ASSERT_NEAR( to.z, res.z, PRECISION );
ASSERT_NEAR(to.x, res.x, PRECISION);
ASSERT_NEAR(to.y, res.y, PRECISION);
ASSERT_NEAR(to.z, res.z, PRECISION);
}
}