Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/nav 164 move tests into separate directory #34

Merged
merged 4 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
/.idea
/src/schedule/cmake-*/*
/src/schedule/.idea
/src/schedule/test/cmake-*/*
/test/test_schedule/cmake-*/*
/.vscode
/output
/.vs/raptorxx/FileContentIndex
Expand Down
7 changes: 4 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,14 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/rel
add_subdirectory(src/interfaces)
add_subdirectory(src/logging)
add_subdirectory(src/geometry)
add_subdirectory(src/geometry/test)
add_subdirectory(src/schedule)
add_subdirectory(src/schedule/test)
add_subdirectory(test/test_schedule)
add_subdirectory(src/schedule/benchmarks)
add_subdirectory(src/raptor)
add_subdirectory(src/raptor/test)
add_subdirectory(src/gtfsRaptorConfig)
# TESTS
add_subdirectory(test/test_raptor)
add_subdirectory(test/test_geometry)

include(CTest)
enable_testing()
50 changes: 2 additions & 48 deletions src/raptor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,54 +4,8 @@ project("raptor"

add_library(${PROJECT_NAME} SHARED)

target_sources(${PROJECT_NAME} PRIVATE
src/Leg.h
src/LegImpl.cpp
src/LegImpl.h
src/RaptorAlgorithmFactory.cpp
src/RaptorAlgorithmFactory.h
src/ConnectionImpl.cpp
src/ConnectionImpl.h
src/utils/RaptorData.cpp
src/utils/RaptorData.h
src/utils/RaptorDataBuilder.cpp
src/utils/RaptorDataBuilder.h
src/utils/RouteBuilder.cpp
src/RaptorRouter.cpp
src/RaptorRouter.h
src/Query.cpp
src/Query.h
src/utils/StopLabelsAndTimes.cpp
src/utils/StopLabelsAndTimes.h
src/FootpathRelaxer.cpp
src/FootpathRelaxer.h
src/RouteScanner.cpp
src/RouteScanner.h
src/QueryConfig.cpp
src/data/ActiveTrip.h
src/data/raptorRouteStructures.h
src/utils/RouteContainer.cpp
src/utils/RouteContainer.h
src/LabelPostprocessor.cpp
src/LabelPostprocessor.h
src/RaptorConnection.cpp
src/RaptorConnection.h
src/utils/LocalDateTime.cpp
src/utils/helperFunctions.h
PUBLIC
include/RaptorAlgorithm.h
include/config/QueryConfig.h
include/raptorTypes.h
include/IConnection.h
include/IRaptor.h
include/config/WalkingConfig.h
include/config/TransferConfig.h
include/usingTypes.h
include/config/TravelConfig.h
include/RouteBuilder.h
include/LocalDateTime.h
include/Connection.h
)
add_subdirectory(include)
add_subdirectory(src)

target_include_directories(${PROJECT_NAME}
PRIVATE
Expand Down
19 changes: 19 additions & 0 deletions src/raptor/include/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
target_sources(${PROJECT_NAME}
PUBLIC
Connection.h
IConnection.h
IRaptor.h
LocalDateTime.h
RaptorAlgorithm.h
raptorRouteStructures.h
raptorTypes.h
RouteBuilder.h
usingTypes.h
RaptorDataBuilder.h
Leg.h
RaptorRouter.h
RaptorData.h
RouteContainer.h
)

add_subdirectory(config)
4 changes: 3 additions & 1 deletion src/raptor/src/Leg.h → src/raptor/include/Leg.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@

#include <optional>
#include <string>
#include <raptor_export.h>


namespace raptor {
class Leg
class RAPTOR_API Leg
{
public:
enum Type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@

#pragma once

#include <data/raptorRouteStructures.h>
#include <raptorRouteStructures.h>
#include <raptor_export.h>

namespace raptor {


class RaptorData
{
class RAPTOR_API RaptorData {
StopRoutesIndexLookup lookup;
StopContext stopContext;
RouteTraversal routeTraversal;

public:
explicit RaptorData(StopRoutesIndexLookup lookup, StopContext stopContext, RouteTraversal routeTraversal);
explicit RaptorData(StopRoutesIndexLookup lookup, StopContext stopContext, RouteTraversal routeTraversal);

[[nodiscard]] const StopRoutesIndexLookup& getLookup() const;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#pragma once

#include <utils/RaptorData.h>
#include "RaptorData.h"
#include <RouteBuilder.h>


Expand All @@ -15,7 +15,6 @@
#include <memory>
#include <unordered_set>
#include <raptor_export.h>
// #include "RaptorAlgorithm.h" // Assuming RaptorAlgorithm is already converted to C++

namespace raptor {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include "config/QueryConfig.h"
#include "RaptorAlgorithm.h"
#include "utils/RaptorData.h"
#include "RaptorData.h"

#include <map>
#include <vector>
Expand Down
2 changes: 1 addition & 1 deletion src/raptor/include/RouteBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <unordered_map>
#include <vector>
#include <map>
#include "utils/RouteContainer.h"
#include "RouteContainer.h"

#include <raptor_export.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@

#pragma once

#include "data/raptorRouteStructures.h"
#include "raptorRouteStructures.h"


#include <string>
#include <map>
#include <vector>
#include <raptor_export.h>


namespace raptor {

class RouteContainer
class RAPTOR_API RouteContainer
{
public:
RouteContainer(std::string id, const std::map<int, std::string>& stopSequence, const std::map<std::string, std::vector<StopTime>>& trips);
Expand Down
7 changes: 7 additions & 0 deletions src/raptor/include/config/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
target_sources(${PROJECT_NAME}
PUBLIC
QueryConfig.h
TransferConfig.h
TravelConfig.h
WalkingConfig.h
)
Original file line number Diff line number Diff line change
Expand Up @@ -10,66 +10,67 @@
#include <string>
#include <unordered_map>
#include <vector>
#include <raptor_export.h>

namespace raptor {

struct RouteStop
struct RAPTOR_API RouteStop
{
types::raptorIdx stopIndex;
types::raptorIdx routeIndex;
};

//////////////////////////////////////////////////////////////////////////

struct StopTime
struct RAPTOR_API StopTime
{
types::raptorInt arrival;
types::raptorInt departure;
};

//////////////////////////////////////////////////////////////////////////

struct Route
struct RAPTOR_API Route
{
std::string id;
types::raptorIdx firstRouteStopIndex;
types::raptorInt numberOfStops;
types::raptorIdx firstStopTimeIndex;
types::raptorInt numberOfTrips;
types::raptorIdx firstRouteStopIndex{};
types::raptorInt numberOfStops{};
types::raptorIdx firstStopTimeIndex{};
types::raptorInt numberOfTrips{};
std::vector<std::string> tripIds;
};

//////////////////////////////////////////////////////////////////////////

struct Stop
struct RAPTOR_API Stop
{
std::string id;
types::raptorIdx stopRouteIndex;
types::raptorInt numberOfRoutes;
types::raptorInt sameStopTransferTime;
int transferIndex;
types::raptorInt numberOfTransfers;
types::raptorIdx stopRouteIndex{};
types::raptorInt numberOfRoutes{};
types::raptorInt sameStopTransferTime{};
int transferIndex{};
types::raptorInt numberOfTransfers{};
};

//////////////////////////////////////////////////////////////////////////

struct Transfer
struct RAPTOR_API Transfer
{
types::raptorIdx targetStopIndex;
types::raptorInt duration;
};

//////////////////////////////////////////////////////////////////////////

struct StopRoutesIndexLookup
struct RAPTOR_API StopRoutesIndexLookup
{
std::unordered_map<std::string, types::raptorIdx> stops;
std::unordered_map<std::string, types::raptorIdx> routes;
};

//////////////////////////////////////////////////////////////////////////

struct StopContext
struct RAPTOR_API StopContext
{
std::vector<Transfer> transfers;
std::vector<Stop> stops;
Expand All @@ -78,7 +79,7 @@ namespace raptor {

//////////////////////////////////////////////////////////////////////////

struct RouteTraversal
struct RAPTOR_API RouteTraversal
{
std::vector<RouteStop> routeStops;
std::vector<StopTime> stopTimes;
Expand Down
1 change: 1 addition & 0 deletions src/raptor/include/raptorTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include <vector>
#include <limits>
#include <string>

namespace raptor::utils {
static constexpr auto INFINITY_VALUE = std::numeric_limits<int>::max();
Expand Down
24 changes: 24 additions & 0 deletions src/raptor/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
target_sources(${PROJECT_NAME}
PRIVATE
ConnectionImpl.cpp
ConnectionImpl.h
FootpathRelaxer.cpp
FootpathRelaxer.h
LabelPostprocessor.cpp
LabelPostprocessor.h
LegImpl.cpp
LegImpl.h
Query.cpp
Query.h
QueryConfig.cpp
RaptorAlgorithmFactory.cpp
RaptorAlgorithmFactory.h
RaptorConnection.cpp
RaptorConnection.h
RaptorRouter.cpp
RouteScanner.cpp
RouteScanner.h
)

add_subdirectory(data)
add_subdirectory(utils)
2 changes: 1 addition & 1 deletion src/raptor/src/FootpathRelaxer.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include "utils/StopLabelsAndTimes.h"
#include "usingTypes.h"
#include "utils/RaptorData.h"
#include "include/RaptorData.h"

#include <vector>
#include <unordered_set>
Expand Down
2 changes: 1 addition & 1 deletion src/raptor/src/LabelPostprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include "LegImpl.h"
#include "RaptorConnection.h"
#include "RaptorRouter.h"
#include "include/RaptorRouter.h"
#include "RouteScanner.h"

#include <algorithm>
Expand Down
2 changes: 1 addition & 1 deletion src/raptor/src/LabelPostprocessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include "Connection.h"
#include "RaptorConnection.h"
#include "data/raptorRouteStructures.h"
#include "include/raptorRouteStructures.h"
#include "usingTypes.h"
#include "utils/StopLabelsAndTimes.h"

Expand Down
2 changes: 1 addition & 1 deletion src/raptor/src/Query.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include "config/QueryConfig.h"
#include "utils/StopLabelsAndTimes.h"
#include "utils/RaptorData.h"
#include "include/RaptorData.h"

#include <vector>
#include <set>
Expand Down
2 changes: 1 addition & 1 deletion src/raptor/src/RaptorConnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#pragma once
#include "Connection.h"
#include "Leg.h"
#include "include/Leg.h"
#include "usingTypes.h"


Expand Down
4 changes: 2 additions & 2 deletions src/raptor/src/RouteScanner.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include "data/ActiveTrip.h"
#include "utils/StopLabelsAndTimes.h"
#include "utils/RaptorData.h"
#include "include/RaptorData.h"

#include <unordered_set>
#include <utility>
Expand All @@ -23,7 +23,7 @@ namespace raptor {
public:
RouteScanner(StopLabelsAndTimes& stopLabelsAndTimes, const RaptorData& raptorData, types::raptorInt minimumTransferDuration);

std::unordered_set<types::raptorIdx> scan(types::raptorInt round, const std::unordered_set<types::raptorIdx>& markedStops) const;
[[nodiscard]] std::unordered_set<types::raptorIdx> scan(types::raptorInt round, const std::unordered_set<types::raptorIdx>& markedStops) const;

private:
[[nodiscard]] std::unordered_set<types::raptorIdx> getRoutesToScan(const std::unordered_set<types::raptorIdx>& markedStops) const;
Expand Down
Loading