new test cases
worked on all walkers new helper methods new distributions some bugfixes
This commit is contained in:
@@ -4,6 +4,16 @@
|
||||
|
||||
#include "../../geo/Angle.h"
|
||||
|
||||
TEST(Angle, dir) {
|
||||
|
||||
// angle -> pointer -> angle
|
||||
ASSERT_NEAR(0, Angle::getRAD_2PI(Angle::getPointer(0)), 0.0001);
|
||||
ASSERT_NEAR(1, Angle::getRAD_2PI(Angle::getPointer(1)), 0.0001);
|
||||
ASSERT_NEAR(2, Angle::getRAD_2PI(Angle::getPointer(2)), 0.0001);
|
||||
ASSERT_NEAR(3, Angle::getRAD_2PI(Angle::getPointer(3)), 0.0001);
|
||||
|
||||
}
|
||||
|
||||
TEST(Angle, calc) {
|
||||
|
||||
ASSERT_EQ(0, Angle::getDEG_360(0,0, +1,0)); // to the right
|
||||
|
||||
@@ -26,4 +26,39 @@ TEST(Heading, diff) {
|
||||
|
||||
}
|
||||
|
||||
TEST(Heading, ctor) {
|
||||
|
||||
// OK
|
||||
Heading(0);
|
||||
Heading(1);
|
||||
Heading(2);
|
||||
Heading(3);
|
||||
Heading(4);
|
||||
Heading(5);
|
||||
Heading(6);
|
||||
Heading(2*M_PI-0.0001);
|
||||
|
||||
// out of range
|
||||
ASSERT_THROW(Heading(-0.0001), std::exception);
|
||||
ASSERT_THROW(Heading(2*M_PI+0.0001), std::exception);
|
||||
|
||||
}
|
||||
|
||||
TEST(Heading, eq) {
|
||||
|
||||
ASSERT_EQ(Heading(0), Heading(0));
|
||||
ASSERT_EQ(Heading(1), Heading(1));
|
||||
ASSERT_EQ(Heading(2), Heading(2));
|
||||
|
||||
}
|
||||
|
||||
TEST(Heading, random) {
|
||||
|
||||
// two random values must not be equal
|
||||
ASSERT_NE(Heading::rnd(), Heading::rnd());
|
||||
ASSERT_NE(Heading::rnd(), Heading::rnd());
|
||||
ASSERT_NE(Heading::rnd(), Heading::rnd());
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -97,7 +97,8 @@ TEST(Walk, DISABLED_plot) {
|
||||
GridWalkLightAtTheEndOfTheTunnel<GP> walk(g, tmp, *end);
|
||||
|
||||
std::minstd_rand gen;
|
||||
std::normal_distribution<float> dist(0.3, 0.3);
|
||||
std::normal_distribution<float> dWalk(0.3, 0.3);
|
||||
std::normal_distribution<float> dTurn(0.3, 0.3);
|
||||
|
||||
K::GnuplotSplotElementPoints pStates; pStates.setColorHex("#880000");
|
||||
|
||||
@@ -129,7 +130,7 @@ TEST(Walk, DISABLED_plot) {
|
||||
for (int i = 0; i < 5000; ++i) {
|
||||
pStates.clear();
|
||||
for (GridWalkState<GP>& state : states) {
|
||||
state = walk.getDestination(g, state, std::abs(dist(gen)));
|
||||
state = walk.getDestination(g, state, std::abs(dWalk(gen)), dTurn(gen));
|
||||
pStates.add(K::GnuplotPoint3(state.node->x_cm, state.node->y_cm, state.node->z_cm+10));
|
||||
}
|
||||
p.gp.draw(p.splot);
|
||||
|
||||
Reference in New Issue
Block a user