Fixed up tests
This commit is contained in:
parent
dc56f143f3
commit
5cd5eb96e5
|
@ -98,7 +98,6 @@ static void initZAxisRotation(int32_t mat[][3], int32_t angle)
|
|||
static void testCW(sensor_align_e rotation, int32_t angle)
|
||||
{
|
||||
int32_t src[XYZ_AXIS_COUNT];
|
||||
int32_t dest[XYZ_AXIS_COUNT];
|
||||
int32_t test[XYZ_AXIS_COUNT];
|
||||
|
||||
// unit vector along x-axis
|
||||
|
@ -110,10 +109,10 @@ static void testCW(sensor_align_e rotation, int32_t angle)
|
|||
initZAxisRotation(matrix, angle);
|
||||
rotateVector(matrix, src, test);
|
||||
|
||||
alignSensors(src, dest, rotation);
|
||||
EXPECT_EQ(test[X], dest[X]) << "X-Unit alignment does not match in X-Axis. " << test[X] << " " << dest[X];
|
||||
EXPECT_EQ(test[Y], dest[Y]) << "X-Unit alignment does not match in Y-Axis. " << test[Y] << " " << dest[Y];
|
||||
EXPECT_EQ(test[Z], dest[Z]) << "X-Unit alignment does not match in Z-Axis. " << test[Z] << " " << dest[Z];
|
||||
alignSensors(src, rotation);
|
||||
EXPECT_EQ(test[X], src[X]) << "X-Unit alignment does not match in X-Axis. " << test[X] << " " << src[X];
|
||||
EXPECT_EQ(test[Y], src[Y]) << "X-Unit alignment does not match in Y-Axis. " << test[Y] << " " << src[Y];
|
||||
EXPECT_EQ(test[Z], src[Z]) << "X-Unit alignment does not match in Z-Axis. " << test[Z] << " " << src[Z];
|
||||
|
||||
// unit vector along y-axis
|
||||
src[X] = 0;
|
||||
|
@ -121,10 +120,10 @@ static void testCW(sensor_align_e rotation, int32_t angle)
|
|||
src[Z] = 0;
|
||||
|
||||
rotateVector(matrix, src, test);
|
||||
alignSensors(src, dest, rotation);
|
||||
EXPECT_EQ(test[X], dest[X]) << "Y-Unit alignment does not match in X-Axis. " << test[X] << " " << dest[X];
|
||||
EXPECT_EQ(test[Y], dest[Y]) << "Y-Unit alignment does not match in Y-Axis. " << test[Y] << " " << dest[Y];
|
||||
EXPECT_EQ(test[Z], dest[Z]) << "Y-Unit alignment does not match in Z-Axis. " << test[Z] << " " << dest[Z];
|
||||
alignSensors(src, rotation);
|
||||
EXPECT_EQ(test[X], src[X]) << "Y-Unit alignment does not match in X-Axis. " << test[X] << " " << src[X];
|
||||
EXPECT_EQ(test[Y], src[Y]) << "Y-Unit alignment does not match in Y-Axis. " << test[Y] << " " << src[Y];
|
||||
EXPECT_EQ(test[Z], src[Z]) << "Y-Unit alignment does not match in Z-Axis. " << test[Z] << " " << src[Z];
|
||||
|
||||
// unit vector along z-axis
|
||||
src[X] = 0;
|
||||
|
@ -132,10 +131,10 @@ static void testCW(sensor_align_e rotation, int32_t angle)
|
|||
src[Z] = 1;
|
||||
|
||||
rotateVector(matrix, src, test);
|
||||
alignSensors(src, dest, rotation);
|
||||
EXPECT_EQ(test[X], dest[X]) << "Z-Unit alignment does not match in X-Axis. " << test[X] << " " << dest[X];
|
||||
EXPECT_EQ(test[Y], dest[Y]) << "Z-Unit alignment does not match in Y-Axis. " << test[Y] << " " << dest[Y];
|
||||
EXPECT_EQ(test[Z], dest[Z]) << "Z-Unit alignment does not match in Z-Axis. " << test[Z] << " " << dest[Z];
|
||||
alignSensors(src, rotation);
|
||||
EXPECT_EQ(test[X], src[X]) << "Z-Unit alignment does not match in X-Axis. " << test[X] << " " << src[X];
|
||||
EXPECT_EQ(test[Y], src[Y]) << "Z-Unit alignment does not match in Y-Axis. " << test[Y] << " " << src[Y];
|
||||
EXPECT_EQ(test[Z], src[Z]) << "Z-Unit alignment does not match in Z-Axis. " << test[Z] << " " << src[Z];
|
||||
|
||||
// random vector to test
|
||||
src[X] = rand() % 5;
|
||||
|
@ -143,10 +142,10 @@ static void testCW(sensor_align_e rotation, int32_t angle)
|
|||
src[Z] = rand() % 5;
|
||||
|
||||
rotateVector(matrix, src, test);
|
||||
alignSensors(src, dest, rotation);
|
||||
EXPECT_EQ(test[X], dest[X]) << "Random alignment does not match in X-Axis. " << test[X] << " " << dest[X];
|
||||
EXPECT_EQ(test[Y], dest[Y]) << "Random alignment does not match in Y-Axis. " << test[Y] << " " << dest[Y];
|
||||
EXPECT_EQ(test[Z], dest[Z]) << "Random alignment does not match in Z-Axis. " << test[Z] << " " << dest[Z];
|
||||
alignSensors(src, rotation);
|
||||
EXPECT_EQ(test[X], src[X]) << "Random alignment does not match in X-Axis. " << test[X] << " " << src[X];
|
||||
EXPECT_EQ(test[Y], src[Y]) << "Random alignment does not match in Y-Axis. " << test[Y] << " " << src[Y];
|
||||
EXPECT_EQ(test[Z], src[Z]) << "Random alignment does not match in Z-Axis. " << test[Z] << " " << src[Z];
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -156,7 +155,6 @@ static void testCW(sensor_align_e rotation, int32_t angle)
|
|||
static void testCWFlip(sensor_align_e rotation, int32_t angle)
|
||||
{
|
||||
int32_t src[XYZ_AXIS_COUNT];
|
||||
int32_t dest[XYZ_AXIS_COUNT];
|
||||
int32_t test[XYZ_AXIS_COUNT];
|
||||
|
||||
// unit vector along x-axis
|
||||
|
@ -170,11 +168,11 @@ static void testCWFlip(sensor_align_e rotation, int32_t angle)
|
|||
initZAxisRotation(matrix, angle);
|
||||
rotateVector(matrix, test, test);
|
||||
|
||||
alignSensors(src, dest, rotation);
|
||||
alignSensors(src, rotation);
|
||||
|
||||
EXPECT_EQ(test[X], dest[X]) << "X-Unit alignment does not match in X-Axis. " << test[X] << " " << dest[X];
|
||||
EXPECT_EQ(test[Y], dest[Y]) << "X-Unit alignment does not match in Y-Axis. " << test[Y] << " " << dest[Y];
|
||||
EXPECT_EQ(test[Z], dest[Z]) << "X-Unit alignment does not match in Z-Axis. " << test[Z] << " " << dest[Z];
|
||||
EXPECT_EQ(test[X], src[X]) << "X-Unit alignment does not match in X-Axis. " << test[X] << " " << src[X];
|
||||
EXPECT_EQ(test[Y], src[Y]) << "X-Unit alignment does not match in Y-Axis. " << test[Y] << " " << src[Y];
|
||||
EXPECT_EQ(test[Z], src[Z]) << "X-Unit alignment does not match in Z-Axis. " << test[Z] << " " << src[Z];
|
||||
|
||||
// unit vector along y-axis
|
||||
src[X] = 0;
|
||||
|
@ -186,11 +184,11 @@ static void testCWFlip(sensor_align_e rotation, int32_t angle)
|
|||
initZAxisRotation(matrix, angle);
|
||||
rotateVector(matrix, test, test);
|
||||
|
||||
alignSensors(src, dest, rotation);
|
||||
alignSensors(src, rotation);
|
||||
|
||||
EXPECT_EQ(test[X], dest[X]) << "Y-Unit alignment does not match in X-Axis. " << test[X] << " " << dest[X];
|
||||
EXPECT_EQ(test[Y], dest[Y]) << "Y-Unit alignment does not match in Y-Axis. " << test[Y] << " " << dest[Y];
|
||||
EXPECT_EQ(test[Z], dest[Z]) << "Y-Unit alignment does not match in Z-Axis. " << test[Z] << " " << dest[Z];
|
||||
EXPECT_EQ(test[X], src[X]) << "Y-Unit alignment does not match in X-Axis. " << test[X] << " " << src[X];
|
||||
EXPECT_EQ(test[Y], src[Y]) << "Y-Unit alignment does not match in Y-Axis. " << test[Y] << " " << src[Y];
|
||||
EXPECT_EQ(test[Z], src[Z]) << "Y-Unit alignment does not match in Z-Axis. " << test[Z] << " " << src[Z];
|
||||
|
||||
// unit vector along z-axis
|
||||
src[X] = 0;
|
||||
|
@ -202,11 +200,11 @@ static void testCWFlip(sensor_align_e rotation, int32_t angle)
|
|||
initZAxisRotation(matrix, angle);
|
||||
rotateVector(matrix, test, test);
|
||||
|
||||
alignSensors(src, dest, rotation);
|
||||
alignSensors(src, rotation);
|
||||
|
||||
EXPECT_EQ(test[X], dest[X]) << "Z-Unit alignment does not match in X-Axis. " << test[X] << " " << dest[X];
|
||||
EXPECT_EQ(test[Y], dest[Y]) << "Z-Unit alignment does not match in Y-Axis. " << test[Y] << " " << dest[Y];
|
||||
EXPECT_EQ(test[Z], dest[Z]) << "Z-Unit alignment does not match in Z-Axis. " << test[Z] << " " << dest[Z];
|
||||
EXPECT_EQ(test[X], src[X]) << "Z-Unit alignment does not match in X-Axis. " << test[X] << " " << src[X];
|
||||
EXPECT_EQ(test[Y], src[Y]) << "Z-Unit alignment does not match in Y-Axis. " << test[Y] << " " << src[Y];
|
||||
EXPECT_EQ(test[Z], src[Z]) << "Z-Unit alignment does not match in Z-Axis. " << test[Z] << " " << src[Z];
|
||||
|
||||
// random vector to test
|
||||
src[X] = rand() % 5;
|
||||
|
@ -218,11 +216,11 @@ static void testCWFlip(sensor_align_e rotation, int32_t angle)
|
|||
initZAxisRotation(matrix, angle);
|
||||
rotateVector(matrix, test, test);
|
||||
|
||||
alignSensors(src, dest, rotation);
|
||||
alignSensors(src, rotation);
|
||||
|
||||
EXPECT_EQ(test[X], dest[X]) << "Random alignment does not match in X-Axis. " << test[X] << " " << dest[X];
|
||||
EXPECT_EQ(test[Y], dest[Y]) << "Random alignment does not match in Y-Axis. " << test[Y] << " " << dest[Y];
|
||||
EXPECT_EQ(test[Z], dest[Z]) << "Random alignment does not match in Z-Axis. " << test[Z] << " " << dest[Z];
|
||||
EXPECT_EQ(test[X], src[X]) << "Random alignment does not match in X-Axis. " << test[X] << " " << src[X];
|
||||
EXPECT_EQ(test[Y], src[Y]) << "Random alignment does not match in Y-Axis. " << test[Y] << " " << src[Y];
|
||||
EXPECT_EQ(test[Z], src[Z]) << "Random alignment does not match in Z-Axis. " << test[Z] << " " << src[Z];
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue