Replace boost::filesystem with std (#6432)

This commit is contained in:
Dennis Luxen
2024-06-20 21:44:28 +02:00
committed by GitHub
parent c3f2a6cdb9
commit f1eabc3ecc
64 changed files with 417 additions and 311 deletions
@@ -1,11 +1,14 @@
#include "extractor/location_dependent_data.hpp"
#include "../common/range_tools.hpp"
#include "../common/temporary_file.hpp"
#include <boost/filesystem.hpp>
#include <boost/test/unit_test.hpp>
#include <cstdlib>
#include <filesystem>
#include <fstream>
#include <random>
#include <vector>
BOOST_AUTO_TEST_SUITE(location_dependent_data_tests)
@@ -16,14 +19,13 @@ using point_t = LocationDependentData::point_t;
struct LocationDataFixture
{
LocationDataFixture(const std::string &json) : temporary_file(boost::filesystem::unique_path())
LocationDataFixture(const std::string &json)
{
std::ofstream file(temporary_file.string());
std::ofstream file(temporary_file.path.string());
file << json;
}
~LocationDataFixture() { remove(temporary_file); }
boost::filesystem::path temporary_file;
TemporaryFile temporary_file;
};
BOOST_AUTO_TEST_CASE(polygon_tests)
@@ -50,7 +52,7 @@ BOOST_AUTO_TEST_CASE(polygon_tests)
}
]})json");
LocationDependentData data({fixture.temporary_file});
LocationDependentData data({fixture.temporary_file.path});
BOOST_CHECK(data.GetPropertyIndexes(point_t(0, 0)).empty());
CHECK_EQUAL_RANGE(data.GetPropertyIndexes(point_t(1, 1)), 0);
@@ -86,7 +88,7 @@ BOOST_AUTO_TEST_CASE(multy_polygon_tests)
}
]})json");
LocationDependentData data({fixture.temporary_file});
LocationDependentData data({fixture.temporary_file.path});
BOOST_CHECK(data.GetPropertyIndexes(point_t(0, 2)).empty());
BOOST_CHECK(data.GetPropertyIndexes(point_t(0, -3)).empty());
@@ -117,7 +119,7 @@ BOOST_AUTO_TEST_CASE(polygon_merging_tests)
}
]})json");
LocationDependentData data({fixture.temporary_file});
LocationDependentData data({fixture.temporary_file.path});
CHECK_EQUAL_RANGE(data.GetPropertyIndexes(point_t(-3, 3)), 0);
CHECK_EQUAL_RANGE(data.GetPropertyIndexes(point_t(-3, 1)), 0);
@@ -153,7 +155,7 @@ BOOST_AUTO_TEST_CASE(staircase_polygon)
}
]})json");
LocationDependentData data({fixture.temporary_file});
LocationDependentData data({fixture.temporary_file.path});
// all corners
BOOST_CHECK(!data.GetPropertyIndexes(point_t(0, 0)).empty());
+1 -1
View File
@@ -3,9 +3,9 @@
#include "../common/temporary_file.hpp"
#include <boost/filesystem.hpp>
#include <boost/test/unit_test.hpp>
#include <filesystem>
#include <iomanip>
#include <iostream>
#include <sstream>
+2 -1
View File
@@ -4,9 +4,10 @@
#include <osrm/coordinate.hpp>
#include <boost/filesystem.hpp>
#include <boost/test/unit_test.hpp>
#include <filesystem>
BOOST_AUTO_TEST_SUITE(raster_source)
using namespace osrm;