Une MAJ de sécurité est nécessaire sur notre version actuelle. Elle sera effectuée lundi 02/08 entre 12h30 et 13h. L'interruption de service devrait durer quelques minutes (probablement moins de 5 minutes).

Commit 4953bdef authored by Javad AMIRIAN's avatar Javad AMIRIAN
Browse files

#24 moved test_xmlparser to test folder

parent d6f48e51
......@@ -25,7 +25,7 @@
cmake_minimum_required( VERSION 2.8 )
project( CrowdSimulator )
set(EXECUTABLE_OUTPUT_PATH bin/${CMAKE_BUILD_TYPE})
#set(EXECUTABLE_OUTPUT_PATH bin/${CMAKE_BUILD_TYPE})
include_directories( ./include )
......@@ -35,6 +35,7 @@ if (WIN32)
include_directories( C:/local )
endif (WIN32)
file( GLOB_RECURSE source_files src/* include/* )
file( GLOB_RECURSE source_files src/* include/*)
add_executable( my_app ${source_files} )
add_executable( my_app main.cpp ${source_files} )
add_executable(test_xmlparser ./test/test_xmlparser.cpp ${source_files})
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.5.0, 2018-07-27T11:49:46. -->
<!-- Written by QtCreator 4.5.0, 2018-08-24T10:55:09. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
......@@ -64,7 +64,7 @@
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt5.5100.gcc_64_kit</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">1</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<valuelist type="QVariantList" key="CMake.Configuration"/>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/jamirian/workspace/crowd_sim/build-OCSR-Desktop_Qt_5_10_0_GCC_64bit-Default</value>
......@@ -341,7 +341,7 @@
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguation.Title">my_app</value>
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.Arguments"></value>
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory"></value>
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory.default">bin/Debug</value>
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory.default">/home/jamirian/workspace/crowd_sim/build-OCSR-Desktop_Qt_5_10_0_GCC_64bit-Debug</value>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">my_app</value>
......@@ -354,7 +354,63 @@
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.1">
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
<value type="int">0</value>
<value type="int">1</value>
<value type="int">2</value>
<value type="int">3</value>
<value type="int">4</value>
<value type="int">5</value>
<value type="int">6</value>
<value type="int">7</value>
<value type="int">8</value>
<value type="int">9</value>
<value type="int">10</value>
<value type="int">11</value>
<value type="int">12</value>
<value type="int">13</value>
<value type="int">14</value>
</valuelist>
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguation.Title">test_xmlparser</value>
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.Arguments"></value>
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory"></value>
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory.default">/home/jamirian/workspace/crowd_sim/build-OCSR-Desktop_Qt_5_10_0_GCC_64bit-Debug</value>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">test_xmlparser</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeRunConfiguration.test_xmlparser</value>
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">2</value>
</valuemap>
</data>
<data>
......
/* Crowd Simulator Engine
** Copyright (C) 2018 - Inria Rennes - Rainbow - Julien Pettre
**
** This program is free software; you can redistribute it and/or
** modify it under the terms of the GNU General Public License
** as published by the Free Software Foundation; either version 2
** of the License, or (at your option) any later version.
**
** This program 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 General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**
**
**
** Authors: Axel Lopez Gandia, Javad Amirian, Florian Berton,
** Julien Legros, Lucas Pelerin, Beatriz Cabrero Daniel, Fabien Grzeskowiak
**
** Contact: crowd_group@inria.fr
*/
//========================================================================
/*!
@file xmlparsertest.cpp
@class XMLParserTest
@date 29/6/2018
@brief
@author Javad Amirian, (C) 2018
*/
//========================================================================
#ifndef _XMLPARSER_TEST_H
#define _XMLPARSER_TEST_H
#include <math.h>
#include <assert.h>
#include <boost/timer.hpp>
#include "../include/tools/xmlparser.h"
#include "../include/core/agent.h"
#include "../include/core/obstacle.h"
int main(int argc, char * argv[])
{
std::string filename;
XMLParser xml_parser_write;
XMLParser xml_parser_read;
float eps = 10E-8;
size_t Nped = 1000;
for(size_t i=0; i<Nped; i++)
{
Agent *agent_i = new Agent;
agent_i->setID(i);
agent_i->setRadius(0.25);
agent_i->setPosition((rand()%100)/10., (rand()%100)/10.);
agent_i->setGoal(-(rand()%100)/10., -(rand()%100)/10.);
//agent_i->setGoalType((rand()%2)? Agent::eGoalLoc : Agent::eGoalDir);
xml_parser_write.agents.push_back(agent_i);
}
size_t Nobs = 5;
for(size_t i=0; i<Nobs; i++)
{
Obstacle *obs_i = new Obstacle;
Vector2D p1(rand()%100,rand()%100);
Vector2D p2(rand()%100,rand()%100);
obs_i->appendVertex(p1);
obs_i->appendVertex(p2);
xml_parser_write.obstacles.push_back(obs_i);
}
xml_parser_write.save(filename);
xml_parser_read.load(filename);
assert(xml_parser_read.agents.size() == Nped);
assert(xml_parser_read.obstacles.size() == Nobs);
for(size_t i=0; i<Nped; i++)
{
assert(fabs(xml_parser_read.agents[i]->getPosition().x() - xml_parser_write.agents[i]->getPosition().x()) < eps);
assert(fabs(xml_parser_read.agents[i]->getPosition().y() - xml_parser_write.agents[i]->getPosition().y()) < eps);
assert(fabs(xml_parser_read.agents[i]->getGoal().x() - xml_parser_write.agents[i]->getGoal().x()) < eps);
assert(fabs(xml_parser_read.agents[i]->getGoal().y() - xml_parser_write.agents[i]->getGoal().y()) < eps);
//assert(xml_parser_read.agents[i]->getGoalType() == xml_parser_write.agents[i]->getGoalType());
}
for(size_t i=0; i<Nobs; i++)
{
assert(fabs(xml_parser_read.obstacles[i]->vertex(0).x() - xml_parser_write.obstacles[i]->vertex(0).x()) < eps);
assert(fabs(xml_parser_read.obstacles[i]->vertex(0).y() - xml_parser_write.obstacles[i]->vertex(0).y()) < eps);
assert(fabs(xml_parser_read.obstacles[i]->vertex(1).x() - xml_parser_write.obstacles[i]->vertex(1).x()) < eps);
assert(fabs(xml_parser_read.obstacles[i]->vertex(1).y() - xml_parser_write.obstacles[i]->vertex(1).y()) < eps);
}
std::cout << "Testing XML Parser finished successfully" << std::endl;
for(int i=0; i<xml_parser_read.agents.size(); i++)
delete xml_parser_read.agents[i];
for(int i=0; i<xml_parser_read.obstacles.size(); i++)
delete xml_parser_read.obstacles[i];
for(int i=0; i<xml_parser_write.agents.size(); i++)
delete xml_parser_write.agents[i];
for(int i=0; i<xml_parser_write.obstacles.size(); i++)
delete xml_parser_write.obstacles[i];
}
#endif // XMLPARSERTEST_H
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