30#pragma warning(disable:4996)
34#define numPointsInterpolation 100
78 const std::string& subMenuAValue,
const std::string& subMenuBValue) :
110 const std::string& left,
const std::string& right) :
147 const auto sumoHome = std::string(getenv(
"SUMO_HOME"));
154 std::ifstream strm(testFile);
157 std::cout <<
"Could not open test file '" + testFile +
"'." << std::endl;
160 std::cout <<
"Error loading test data files" << std::endl;
164 std::vector<std::pair<bool, std::string> > linesRaw;
166 while (std::getline(strm, line)) {
168 if (!line.empty() && (line[0] !=
'#')) {
169 linesRaw.push_back(std::make_pair(
startWith(line,
"netedit."), line));
176 for (
const auto& clearLine : lines) {
192 return static_cast<FXuint
>(
193 std::chrono::duration_cast<std::chrono::milliseconds>(
194 std::chrono::steady_clock::now().time_since_epoch()
225const std::map<std::string, int>&
231const std::map<std::string, InternalTest::ContextualMenu>&
237const std::map<std::string, InternalTest::ViewPosition>&
243const std::map<std::string, InternalTest::Movement>&
261std::vector<InternalTest::ViewPosition>
263 const int offsetStartX,
const int offsetStartY,
265 const int offsetEndX,
const int offsetEndY)
const {
267 std::vector<InternalTest::ViewPosition> trajectory;
276 const int interpolatedX = int(from.getX() + t * (to.getX() - from.getX()));
277 const int interpolatedY = int(from.getY() + t * (to.getY() - from.getY()));
279 trajectory.push_back(
ViewPosition(interpolatedX, interpolatedY));
285std::map<std::string, int>
287 std::map<std::string, int> solution;
289 std::ifstream strm(filePath);
292 WRITE_ERRORF(
TL(
"Could not open attributes enum file '%'."), filePath);
296 while (std::getline(strm, line)) {
298 std::stringstream ss(line);
302 std::getline(ss, key,
' ');
303 std::getline(ss, value,
'\n');
306 WRITE_ERRORF(
TL(
"In internal test file, value '%' cannot be parsed to int."), value);
316std::map<std::string, InternalTest::ContextualMenu>
318 std::map<std::string, InternalTest::ContextualMenu> solution;
320 std::ifstream strm(filePath);
323 WRITE_ERRORF(
TL(
"Could not open view positions file '%'."), filePath);
327 while (std::getline(strm, line)) {
329 std::string mainMenuKey;
330 std::string mainMenuValue;
331 std::string subMenuAKey;
332 std::string subMenuAValue;
333 std::string subMenuBKey;
334 std::string subMenuBValue;
336 std::stringstream mainMenuSS(line);
337 std::getline(mainMenuSS, mainMenuKey,
' ');
338 std::getline(mainMenuSS, mainMenuValue,
'\n');
340 std::getline(strm, line);
341 std::stringstream subMenuASS(line);
342 std::getline(subMenuASS, subMenuAKey,
' ');
343 std::getline(subMenuASS, subMenuAValue,
'\n');
345 std::getline(strm, line);
346 std::stringstream subMenuBSS(line);
347 std::getline(subMenuBSS, subMenuBKey,
' ');
348 std::getline(subMenuBSS, subMenuBValue,
'\n');
351 WRITE_ERRORF(
TL(
"In internal test file, mainMenu value '%' cannot be parsed to int."), mainMenuValue);
353 WRITE_ERRORF(
TL(
"In internal test file, subMenuA value '%' cannot be parsed to int."), subMenuAValue);
355 WRITE_ERRORF(
TL(
"In internal test file, subMenuB value '%' cannot be parsed to int."), subMenuBValue);
366std::map<std::string, InternalTest::ViewPosition>
368 std::map<std::string, InternalTest::ViewPosition> solution;
370 std::ifstream strm(filePath);
373 WRITE_ERRORF(
TL(
"Could not open view positions file '%'."), filePath);
377 while (std::getline(strm, line)) {
379 std::stringstream ss(line);
384 std::getline(ss, key,
' ');
385 std::getline(ss, xValue,
' ');
386 std::getline(ss, yValue,
'\n');
389 WRITE_ERRORF(
TL(
"In internal test file, x value '%' cannot be parsed to int."), xValue);
391 WRITE_ERRORF(
TL(
"In internal test file, y value '%' cannot be parsed to int."), yValue);
401std::map<std::string, InternalTest::Movement>
403 std::map<std::string, InternalTest::Movement> solution;
405 std::ifstream strm(filePath);
408 WRITE_ERRORF(
TL(
"Could not open view positions file '%'."), filePath);
412 while (std::getline(strm, line)) {
414 std::stringstream ss(line);
418 std::string downValue;
419 std::string leftValue;
420 std::string rightValue;
421 std::getline(ss, key,
' ');
422 std::getline(ss, upValue,
' ');
423 std::getline(ss, downValue,
' ');
424 std::getline(ss, leftValue,
' ');
425 std::getline(ss, rightValue,
'\n');
428 WRITE_ERRORF(
TL(
"In internal test file, x value '%' cannot be parsed to int."), upValue);
430 WRITE_ERRORF(
TL(
"In internal test file, y value '%' cannot be parsed to int."), downValue);
432 WRITE_ERRORF(
TL(
"In internal test file, y value '%' cannot be parsed to int."), leftValue);
434 WRITE_ERRORF(
TL(
"In internal test file, y value '%' cannot be parsed to int."), rightValue);
444std::vector<std::string>
446 std::vector<std::string> results;
447 for (
const auto& lineRaw : linesRaw) {
449 results.push_back(lineRaw.second);
450 }
else if (results.size() > 0) {
451 results.back().append(lineRaw.second);
460 if (prefix.size() > str.size()) {
463 for (
int i = 0; i < (int)prefix.size(); i++) {
464 if (str[i] != prefix[i]) {
#define numPointsInterpolation
#define WRITE_ERRORF(...)
int getUp() const
get up value
int getLeft() const
get left value
int getDown() const
get down value
Movement()
default constructor
int getRight() const
get right value
int getY() const
get y value
int getX() const
get x value
ViewPosition()
default constructor
std::vector< InternalTest::ViewPosition > interpolateViewPositions(const InternalTest::ViewPosition &viewStartPosition, const int offsetStartX, const int offsetStartY, const InternalTest::ViewPosition &viewEndPosition, const int offsetEndX, const int offsetEndY) const
interpolate view positions
void addTestSteps(InternalTestStep *internalTestStep)
add test steps
InternalTestStep * getCurrentStep() const
get current step
const std::map< std::string, InternalTest::ContextualMenu > & getContextualMenuOperations() const
get map with contextual menu operation jump steps
bool startWith(const std::string &str, const std::string &prefix) const
check if the given string start with
std::vector< std::string > cleanLines(const std::vector< std::pair< bool, std::string > > &linesRaw) const
clear lines
const std::map< std::string, int > & getAttributesEnum() const
get map with attributesEnum jump steps
InternalTest::ViewPosition myLastMovedPosition
last moved position
std::map< std::string, int > parseAttributesEnumFile(const std::string filePath) const
parse attributesEnum file
std::vector< InternalTestStep * > myTestSteps
test steps
std::map< std::string, InternalTest::ViewPosition > parseViewPositionsFile(const std::string filePath) const
parse viewPositions file
~InternalTest()
destructor
std::map< std::string, InternalTest::Movement > myMovements
vector with movements
size_t myCurrentStep
current step index
std::map< std::string, InternalTest::ContextualMenu > myContextualMenuOperations
vector with contextual menu operation jump steps
std::map< std::string, InternalTest::ContextualMenu > parseContextualMenuOperationsFile(const std::string filePath) const
parse attributesEnum file
std::map< std::string, InternalTest::ViewPosition > myViewPositions
vector with view positions
std::map< std::string, int > myAttributesEnum
vector with attributesEnum jump steps
std::map< std::string, InternalTest::Movement > parseMovementsFile(const std::string filePath) const
parse movements file
const std::map< std::string, InternalTest::ViewPosition > & getViewPositions() const
get map with view position pairs
InternalTest()=delete
invalidate default constructor
FXint getTime() const
get currentTime
void updateLastMovedPosition(const int x, const int y)
update last moved position
const InternalTest::ViewPosition & getLastMovedPosition() const
get last moved position
InternalTestStep * getLastTestStep() const
get last test step
const std::map< std::string, InternalTest::Movement > & getMovements() const
get map with movement pairs
Some static methods for string processing.
static int toInt(const std::string &sData)
converts a string into the integer value described by it by calling the char-type converter,...
static bool isInt(const std::string &sData)
check if the given sData can be converted to int