59#ifndef GUCOORDINATESTESTS_HPP
60#define GUCOORDINATESTESTS_HPP
62#pragma clang diagnostic push
63#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"
64#pragma clang diagnostic ignored "-Wfloat-equal"
65#pragma clang diagnostic ignored "-Wsign-compare"
66#pragma clang diagnostic ignored "-Wmissing-noreturn"
67#pragma clang diagnostic ignored "-Wshift-sign-overflow"
68#pragma clang diagnostic ignored "-Wused-but-marked-unused"
69#pragma clang diagnostic ignored "-Wundef"
70#pragma clang diagnostic ignored "-Wc++98-compat"
71#pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
72#pragma clang diagnostic ignored "-Wc++11-long-long"
73#pragma clang diagnostic ignored "-Wc++11-extensions"
74#pragma clang diagnostic ignored "-Wdeprecated"
75#pragma clan diagnostic ignored "-Wsuggest-override"
76#pragma clan diagnostic ignored "-Wsuggest-destructor-override"
77#include <gtest/gtest.h>
78#pragma clang diagnostic pop
80#pragma clang diagnostic push
81#pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
83#pragma clang diagnostic pop
85#include "../gucoordinates.h"
93#define GU_NAO_V5_TOP_CAMERA gu_camera_make(6.364, 5.871, 1.2, 47.64, 60.97)
94#define GU_NAO_V5_BOTTOM_CAMERA gu_camera_make(1.774, 5.071, 39.7, 47.64, 60.97)
96#define GU_PEPPER_TOP_CAMERA gu_camera_make(115.3, 8.68, 0.0, 44.3, 55.2)
97#define GU_PEPPER_BOTTOM_CAMERA gu_camera_make(105.15, 9.36, 40.0, 44.3, 55.2)
99#define GU_NAO_V5_HEAD(p, y) (gu_camera_pivot) {.pitch = p, .yaw = y, .height = 41.7, .cameras = {GU_NAO_V5_TOP_CAMERA, GU_NAO_V5_BOTTOM_CAMERA}, .numCameras = 2}
100#define GU_NAO_V5_TOP_CAMERA_INDEX 0
101#define GU_NAO_V5_BOTTOM_CAMERA_INDEX 1
103#define GU_PEPPER_HEAD(p, y) {p, y, 0.0, {GU_PEPPER_TOP_CAMERA, GU_PEPPER_BOTTOM_CAMERA}, 2}
105#define GU_NAO_V5_ROBOT(hp, hy, x, y, t) (gu_robot) { .head = { hp, hy, 41.7, {GU_NAO_V5_TOP_CAMERA, GU_NAO_V5_BOTTOM_CAMERA}, 2 }, .position = { { x, y }, t } }
107#define GU_PEPPER_ROBOT(hp, hy, x, y, t) (gu_robot) { .head = { hp, hy, 0.0, {GU_PEPPER_TOP_CAMERA, GU_PEPPER_BOTTOM_CAMERA}, 2 }, .position = { { x, y }, t } }
109#pragma clang diagnostic push
110#pragma clang diagnostic ignored "-Wglobal-constructors"
112#define TEST2_F(testclassname, testname) \
113 TEST_F(testclassname, testname)
115#define RO3_TEST_F(className) \
116 TEST2_F(testclassname(className), RO3) { \
120#if __cplusplus >= 201103L
121#define RO5_TEST_Fs(className) \
122 RO3_TEST_F(className) \
123 TEST2_F(testclassname(className), RO5) { \
127#define RO5_TEST_Fs(className) RO3_TEST_F(className)
130#define testclassname(className) className##CPPTests
131#define equals_reset(strctName) strctName##_equals_reset();
132#define equals_func(strctName) strctName##_equals
133#define equals_fake(strctName) strctName##_equals_fake
135#pragma clang diagnostic pop
139 template <
typename Class>
140 class GUCoordinatesTests:
public ::testing::Test {
173#pragma clang diangostic push
174#pragma clang diagnostic ignored "-Wself-assign"
176#pragma clang diagnostic pop
177 SCOPED_TRACE(
"Equality operator");
179 SCOPED_TRACE(
"Copy constructor");
180 Class obj2 = Class(obj);
182 SCOPED_TRACE(
"Assignment operator");
188 SCOPED_TRACE(
"Assignment operator2");
192 Class * obj5 = &obj4;
196#if __cplusplus >= 201103L
200 SCOPED_TRACE(
"Move Constructor");
201 Class obj3 = std::move(obj);
206 SCOPED_TRACE(
"Move assignment operator");
208 obj4 = std::move(obj3);
213 SCOPED_TRACE(
"Move assignment operator2");
214 Class * obj5 = &obj4;
215 obj4 = std::move(*obj5);
224 bool near(
const double lhs,
const double rhs)
const
226 const double tolerance = 0.001;
227 return fabs(lhs - rhs) < tolerance;
230 void assert_near(
const double lhs,
const double rhs,
const double tolerance)
const
232 ASSERT_LE(fabs(lhs - rhs), tolerance);
237 ASSERT_EQ(lhs.
x(), rhs.
x());
238 ASSERT_EQ(lhs.
y(), rhs.
y());
245 ASSERT_FALSE(lhs.
x() == rhs.
x()
246 && lhs.
y() == rhs.
y()
274 ASSERT_EQ(lhs.
x(), rhs.
x());
275 ASSERT_EQ(lhs.
y(), rhs.
y());
284 && lhs.
y() == rhs.
y()
292 ASSERT_TRUE(
near(lhs.
x(), rhs.
x()));
293 ASSERT_TRUE(
near(lhs.
y(), rhs.
y()));
320 ASSERT_EQ(lhs.
x(), rhs.
x());
321 ASSERT_EQ(lhs.
y(), rhs.
y());
326 ASSERT_FALSE(lhs.
x() == rhs.
x() && lhs.
y() == rhs.
y());
#define GU_NAO_V5_BOTTOM_CAMERA
#define GU_NAO_V5_TOP_CAMERA
#define GU_NAO_V5_HEAD(p, y)
void equals(const GU::PercentCoordinate lhs, const GU::PercentCoordinate rhs)
void nequals(const GU::FieldCoordinate lhs, const GU::FieldCoordinate rhs)
void equals(const GU::OptionalCameraCoordinate lhs, const GU::OptionalCameraCoordinate rhs)
void nequals(const GU::OptionalFieldCoordinate lhs, const GU::OptionalFieldCoordinate rhs)
void equals(const GU::Camera lhs, const GU::Camera rhs)
void equals(const GU::RelativeCoordinate lhs, const GU::RelativeCoordinate rhs)
void nequals(const GU::RelativeCoordinate lhs, const GU::RelativeCoordinate rhs)
virtual Class initial()=0
void nequals(const GU::OptionalRelativeCoordinate lhs, const GU::OptionalRelativeCoordinate rhs)
void nequals(const GU::OptionalCartesianCoordinate lhs, const GU::OptionalCartesianCoordinate rhs)
void nequals(const GU::OptionalPercentCoordinate lhs, const GU::OptionalPercentCoordinate rhs)
void nequals(const GU::CameraPivot lhs, const GU::CameraPivot rhs)
void nequals(const GU::PercentCoordinate lhs, const GU::PercentCoordinate rhs)
void equals(const GU::OptionalPixelCoordinate lhs, const GU::OptionalPixelCoordinate rhs)
void equals(const GU::OptionalPercentCoordinate lhs, const GU::OptionalPercentCoordinate rhs)
void nequals(const GU::CartesianCoordinate lhs, const GU::CartesianCoordinate rhs)
void equals(const GU::OptionalRelativeCoordinate lhs, const GU::OptionalRelativeCoordinate rhs)
bool near(const double lhs, const double rhs) const
void nequals(const GU::OptionalCameraCoordinate lhs, const GU::OptionalCameraCoordinate rhs)
void equals(const GU::PixelCoordinate lhs, const GU::PixelCoordinate rhs)
void nequals(const GU::Camera lhs, const GU::Camera rhs)
void equals(const GU::CartesianCoordinate lhs, const GU::CartesianCoordinate rhs)
void assert_near(const double lhs, const double rhs, const double tolerance) const
void equals(const GU::CameraCoordinate lhs, const GU::CameraCoordinate rhs)
void equals(const GU::CameraPivot lhs, const GU::CameraPivot rhs)
void nequals(const GU::OptionalPixelCoordinate lhs, const GU::OptionalPixelCoordinate rhs)
virtual void change(Class &)
void nequals(const GU::PixelCoordinate lhs, const GU::PixelCoordinate rhs)
void equals(const GU::OptionalFieldCoordinate lhs, const GU::OptionalFieldCoordinate rhs)
void equals(const GU::OptionalCartesianCoordinate lhs, const GU::OptionalCartesianCoordinate rhs)
void equals(const GU::FieldCoordinate lhs, const GU::FieldCoordinate rhs)
void nequals(const GU::CameraCoordinate lhs, const GU::CameraCoordinate rhs)
#define FFF_RESET_HISTORY()
#define RESET_FAKE(FUNCNAME)
pixels_u y() const NOEXCEPT
pixels_u resWidth() const NOEXCEPT
pixels_u resHeight() const NOEXCEPT
pixels_u x() const NOEXCEPT
degrees_d vDirection() const NOEXCEPT
centimetres_d height() const NOEXCEPT
centimetres_d centerOffset() const NOEXCEPT
degrees_d hFov() const NOEXCEPT
degrees_d vFov() const NOEXCEPT
int numCameras() const NOEXCEPT
degrees_d yaw() const NOEXCEPT
degrees_d pitch() const NOEXCEPT
Camera camera(const int) const NOEXCEPT
centimetres_d height() const NOEXCEPT
centimetres_t x() const NOEXCEPT
centimetres_t y() const NOEXCEPT
degrees_t heading() const NOEXCEPT
CartesianCoordinate position() const NOEXCEPT
bool has_value() const NOEXCEPT
Wrapped value() const NOEXCEPT
percent_d y() const NOEXCEPT
percent_d x() const NOEXCEPT
pixels_t y() const NOEXCEPT
pixels_t x() const NOEXCEPT
pixels_u resWidth() const NOEXCEPT
pixels_u resHeight() const NOEXCEPT
millimetres_u distance() const NOEXCEPT
degrees_d direction() const NOEXCEPT