Skip to content
Snippets Groups Projects
Commit a66bfc72 authored by d.kilic's avatar d.kilic Committed by d.kilic
Browse files

Add test cases with empty lines in the middle

parent d563a82d
No related branches found
No related tags found
1 merge request!208Resolve "Empty lines in the height file"
Pipeline #73777 passed
...@@ -234,6 +234,23 @@ TEST_CASE("src/IO", "[tracking][io]") ...@@ -234,6 +234,23 @@ TEST_CASE("src/IO", "[tracking][io]")
CHECK_THAT(markerHeightsVec, Catch::UnorderedEquals(referenceValuesVec)); CHECK_THAT(markerHeightsVec, Catch::UnorderedEquals(referenceValuesVec));
} }
SECTION("empty lines throughout the file")
{
std::for_each(
std::begin(referenceValuesMap),
std::end(referenceValuesMap),
[&heightFile](const std::pair<int, float> &element)
{ heightFile << element.first << " " << element.second << "\n\n"; });
heightFile.close();
auto ret = IO::readHeightFile(QString::fromStdString(heigtFileName));
REQUIRE(std::holds_alternative<std::unordered_map<int, float>>(ret));
std::unordered_map<int, float> markerHeights = std::get<std::unordered_map<int, float>>(ret);
std::vector<std::pair<int, float>> markerHeightsVec;
markerHeightsVec.assign(std::begin(markerHeights), std::end(markerHeights));
CHECK_THAT(markerHeightsVec, Catch::UnorderedEquals(referenceValuesVec));
}
SECTION("z-coordinate in cm") SECTION("z-coordinate in cm")
{ {
...@@ -498,6 +515,22 @@ TEST_CASE("src/IO", "[tracking][io]") ...@@ -498,6 +515,22 @@ TEST_CASE("src/IO", "[tracking][io]")
CHECK_THAT(markerHeightsVec, Catch::UnorderedEquals(referenceValuesVec)); CHECK_THAT(markerHeightsVec, Catch::UnorderedEquals(referenceValuesVec));
} }
SECTION("empty lines throughout the file")
{
for(const auto &[personID, markerID] : referenceValuesMap)
{
markerFile << personID << " " << markerID << "\n\n";
}
markerFile.close();
auto ret = IO::readMarkerIDFile(QString::fromStdString(markerFileName));
REQUIRE(std::holds_alternative<std::unordered_map<int, int>>(ret));
auto markerIDs = std::get<std::unordered_map<int, int>>(ret);
std::vector<std::pair<int, int>> markerHeightsVec;
markerHeightsVec.assign(std::begin(markerIDs), std::end(markerIDs));
CHECK_THAT(markerHeightsVec, Catch::UnorderedEquals(referenceValuesVec));
}
SECTION("with comments") SECTION("with comments")
{ {
markerFile << "# this is a comment at the beginning" << std::endl; markerFile << "# this is a comment at the beginning" << std::endl;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment