Commit ca7866d2 authored by karthik's avatar karthik

subroom small walls check

parent b0bef5ec
......@@ -30,7 +30,7 @@
#define BOOST_TEST_DYN_LINK
#include <boost/test/unit_test.hpp>
#include "../../geometry/Room.h"
#include "../../general/Macros.h"
#include <string>
BOOST_AUTO_TEST_SUITE(RoomTest)
......@@ -45,11 +45,13 @@ BOOST_AUTO_TEST_CASE(ROOM_CONST_SET_GET_TEST)
R1.SetCaption("Room" + std::to_string(i));
R1.SetZPos(10.0/i);
R1.SetEgressTime(i * 10.0 / 3);
R1.SetState(RoomState(i%2));
Room R2(R1);
BOOST_CHECK(R2.GetID() == i);
BOOST_CHECK(R2.GetCaption() == "Room" + std::to_string(i));
BOOST_CHECK(R2.GetZPos() == 10.0 / i);
BOOST_CHECK(R2.GetEgressTime() == i * 10.0 / 3);
BOOST_CHECK(R2.GetState() == i % 2);
}
BOOST_MESSAGE("Leaving const_set_get test");
}
......
......@@ -132,7 +132,7 @@ BOOST_AUTO_TEST_CASE(LINE_OPERATOR_TEST)
BOOST_AUTO_TEST_CASE(LINE_LENGTH_TEST)
{
BOOST_MESSAGE("starting line length test");
BOOST_MESSAGE("starting line length and length square test");
Point P1;
const double PI = 3.14159265358979323846;
for (int i = -5; i < 5; ++i)
......@@ -146,6 +146,7 @@ BOOST_AUTO_TEST_CASE(LINE_LENGTH_TEST)
double normSq = P2.NormSquare();
BOOST_CHECK(L1.LengthSquare() == normSq);
}
BOOST_MESSAGE("Leaving line length and length square test");
}
BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file
BOOST_AUTO_TEST_SUITE_END()
......@@ -153,7 +153,8 @@ BOOST_AUTO_TEST_CASE(Obstacle_ConvertLineToPoly_Test)
Point P2 (i, i*i);
Point P3 (2*i, i);
Point P4 (-i, -i*i);
Point P5 (100, 100);
Point P5 (-i, -2*i*i);
Point P6 (-2*i, -2*i*i);
std::vector<Point> added_pts;
added_pts.emplace_back(P1);
......@@ -161,6 +162,7 @@ BOOST_AUTO_TEST_CASE(Obstacle_ConvertLineToPoly_Test)
added_pts.emplace_back(P3);
added_pts.emplace_back(P4);
added_pts.emplace_back(P5);
added_pts.emplace_back(P6);
const unsigned temp = added_pts.size();
Obstacle obs1;
......@@ -169,20 +171,25 @@ BOOST_AUTO_TEST_CASE(Obstacle_ConvertLineToPoly_Test)
Wall w2(P2, P3);
Wall w3(P3, P4);
Wall w4(P4, P1);
Wall w5(P2, P5);
Wall w5(P4, P5);
Wall w6(P5, P6);
Wall w7(P6, P4);
obs1.SetId(i-1);
obs1.AddWall(w1);
obs1.AddWall(w2);
obs1.AddWall(w3);
obs1.AddWall(w4);
obs1.SetClosed(1);
//BOOST_CHECK_MESSAGE(obs1.ConvertLineToPoly() == false, obs1.ConvertLineToPoly());
obs1.AddWall(w4);
BOOST_CHECK_MESSAGE(obs1.ConvertLineToPoly() == true, obs1.ConvertLineToPoly());
// BOOST_CHECK_MESSAGE(obs1.ConvertLineToPoly() == true, obs1.ConvertLineToPoly());
obs1.AddWall(w5);
obs1.AddWall(w6);
obs1.AddWall(w7);
BOOST_CHECK_MESSAGE(obs1.ConvertLineToPoly() == true, obs1.ConvertLineToPoly());
// GetPolygon test
......@@ -233,4 +240,4 @@ BOOST_AUTO_TEST_CASE(Obstacle_GetCentroid_Test)
BOOST_MESSAGE("Leaving obstacle GetCentroid & IntersectWithLine test");
}
BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file
BOOST_AUTO_TEST_SUITE_END()
/**
* \file testClassLine.cpp
* \date April 27, 2015
* \version v0.7
* \copyright <2009-2015> Forschungszentrum Jülich GmbH. All rights reserved.
*
* \section License
* This file is part of JuPedSim.
*
* JuPedSim is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* JuPedSim is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with JuPedSim. If not, see <http://www.gnu.org/licenses/>.
*
* \section Description
*
*
**/
#define BOOST_TEST_MODULE SubRoomTest
#define BOOST_TEST_DYN_LINK
#include <boost/test/unit_test.hpp>
#include "../../geometry/SubRoom.h"
BOOST_AUTO_TEST_SUITE(SubRoomTest)
BOOST_AUTO_TEST_CASE(Line_test)
{
BOOST_MESSAGE("starting small wall test");
SubRoom sub1;
sub1.SetSubRoomID(1);
sub1.AddWall(Wall(Point(0, 0), Point(0, 10)));
sub1.AddWall(Wall(Point(0, 10), Point(5, 10)));
sub1.AddWall(Wall(Point(5, 10), Point(5.25, 10)));
sub1.AddWall(Wall(Point(5.28, 10), Point(5.30, 10)));
sub1.AddWall(Wall(Point(5.33, 10), Point(5.36, 10)));
sub1.AddWall(Wall(Point(5.38, 10), Point(5.40, 10)));
sub1.AddWall(Wall(Point(5.43, 10), Point(10, 10)));
sub1.AddWall(Wall(Point(10, 10), Point(10, 5)));
sub1.AddWall(Wall(Point(10, 0), Point(0, 0)));
vector<Line> goal (Point(10, 5), Point(10, 0));
bool temp = sub1.ConvertLineToPoly(&goal);
vector<Point> poly (sub1.GetPolygon());
for (auto it:poly)
BOOST_WARN("x = " << it->GetX() << ", y = " << it->GetY());
BOOST_MESSAGE("Leaving small wall test");
}
BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment