-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gtest as test suite CI to auto detect all tests + use ninja
- Loading branch information
Foo
committed
Feb 5, 2024
1 parent
512dfe2
commit 2e95113
Showing
234 changed files
with
8,696 additions
and
8,388 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
|
||
name: Unit Tests | ||
|
||
on: | ||
|
@@ -17,38 +16,41 @@ jobs: | |
include: | ||
- name: ubuntu-gcc | ||
os: ubuntu-latest | ||
compiler_opt: "-DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -G \"Unix Makefiles\"" | ||
compiler_opt: "-DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++" | ||
build_system: '-G Ninja' | ||
- name: ubuntu-clang | ||
os: ubuntu-latest | ||
compiler_opt: "-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -G \"Unix Makefiles\"" | ||
compiler_opt: "-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++" | ||
build_system: '-G Ninja' | ||
- name: windows-VS | ||
os: windows-latest | ||
compiler_opt: "" | ||
build_system: "" | ||
|
||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
- name: Checkout submodules | ||
run: git submodule update --init --recursive | ||
- name: show HEAD | ||
run: git rev-parse HEAD | ||
- name: Install openMp | ||
if: matrix.name == 'ubuntu-clang' | ||
run: sudo apt-get update; sudo apt-get install -y libomp5 libomp-dev | ||
- name: Install Ninja | ||
if: matrix.build_system == '-G Ninja' | ||
uses: seanmiddleditch/gha-setup-ninja@master | ||
- name: CMake configure | ||
run: cmake -B./build -DCMAKE_INSTALL_PREFIX:STRING=./artifacts/ -DBUILD_MT_RRT_SAMPLES=ON -DBUILD_MT_RRT_TESTS=ON -DENABLE_MT_RRT_TESTS_LOGGING=ON -DCMAKE_CONFIGURATION_TYPES="Release" -DCMAKE_BUILD_TYPE:STRING=Release ${{ matrix.compiler_opt }} | ||
run: cmake -B./build -DCMAKE_INSTALL_PREFIX:STRING=./artifacts/ -D BUILD_MT_RRT_SAMPLES=ON -DBUILD_MT_RRT_TESTS=ON -DCMAKE_CONFIGURATION_TYPES="Release" -DCMAKE_BUILD_TYPE:STRING=Release ${{ matrix.build_system }} ${{ matrix.compiler_opt }} | ||
- name: Build | ||
run: cmake --build ./build --config Release | ||
- name: Install | ||
run: cmake --install ./build --config Release | ||
- name: carpet tests | ||
run: ./artifacts/bin/MT-RRT-carpet-tests | ||
- name: trivial problem tests | ||
run: ./artifacts/bin/MT-RRT-sample-TrivialProblem-lib-tests | ||
- name: core tests | ||
run: ./artifacts/bin/MT-RRT-core-tests | ||
- name: multi threaded planners tests | ||
run: ./artifacts/bin/MT-RRT-multi-threaded-tests | ||
- name: planar robots problem tests | ||
run: ./artifacts/bin/MT-RRT-sample-PlanarRobotsProblem-lib-tests | ||
- name: navigation problem tests | ||
run: ./artifacts/bin/MT-RRT-sample-NavigationProblem-lib-tests | ||
- name: Tests-show | ||
run: python script/RunTests.py --folder ./artifacts/bin --list | ||
- name: Tests | ||
run: python script/RunTests.py --folder ./artifacts/bin | ||
- uses: actions/upload-artifact@v2 | ||
with: | ||
path: artifacts | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,6 @@ build | |
.vscode | ||
log-* | ||
.vs | ||
TODO | ||
__pycache__ | ||
*.pyc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
include(FetchContent) | ||
|
||
if(BUILD_MT_RRT_TESTS) | ||
FetchContent_Declare( | ||
googletest | ||
URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip | ||
) | ||
if (WIN32) | ||
# For Windows: Prevent overriding the parent project's compiler/linker settings | ||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) | ||
endif (WIN32) | ||
FetchContent_MakeAvailable(googletest) | ||
endif() | ||
|
||
if(BUILD_MT_RRT_TESTS OR BUILD_MT_RRT_SAMPLES) | ||
Fetch(https://github.com/nlohmann/json.git v3.10.5 json_lib) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
CMakeLists.txt |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/** | ||
* Author: Andrea Casalino | ||
* Created: 16.02.2021 | ||
* | ||
* report any bug to [email protected]. | ||
**/ | ||
|
||
#pragma once | ||
|
||
#include <MT-RRT/Limited.h> | ||
#include <MT-RRT/View.h> | ||
|
||
#ifdef _WIN32 | ||
#include <corecrt_math_defines.h> | ||
#endif | ||
#include <math.h> | ||
|
||
#include <array> | ||
#include <optional> | ||
#include <variant> | ||
|
||
namespace mt_rrt::geom { | ||
static constexpr float PI = static_cast<float>(M_PI); | ||
static constexpr float PI_HALF = static_cast<float>(M_PI_2); | ||
|
||
float to_rad(float angle); | ||
|
||
float to_grad(float angle); | ||
|
||
// important!!! b is assumed to have the same size of a, | ||
// but no check is done inside this function | ||
float distance(const View &a, const View &b); | ||
|
||
// important!!! b is assumed to have the same size of a, | ||
// but no check is done inside this function | ||
float dot(const View &a, const View &b); | ||
|
||
struct Point { | ||
Point() : Point{0, 0} {} | ||
Point(float x, float y); | ||
Point(const View &v); | ||
|
||
Point(const Point &o) : Point{o.data_[0], o.data_[1]} {} | ||
Point &operator=(const Point &o); | ||
|
||
Point(Point &&o); | ||
Point &operator=(Point &&o); | ||
|
||
const float *data() const { return data_; } | ||
|
||
View asView() const { return View{data_, 2}; } | ||
|
||
std::vector<float> asVec() const { | ||
return std::vector<float>{data_[0], data_[1]}; | ||
} | ||
|
||
private: | ||
std::optional<std::array<float, 2>> container_; | ||
const float *data_; | ||
}; | ||
|
||
float distance(const Point &a, const Point &b); | ||
|
||
float dot(const Point &a, const Point &b); | ||
|
||
Point sum(const Point &subject, const Point &to_add, | ||
const std::optional<float> &to_add_scale = std::nullopt); | ||
|
||
Point diff(const Point &subject, const Point &to_remove, | ||
const std::optional<float> &to_remove_scale = std::nullopt); | ||
|
||
float curve_length(const std::vector<std::vector<float>> &sequence); | ||
|
||
float curve_similarity(const std::vector<std::vector<float>> &a, | ||
const std::vector<std::vector<float>> &b); | ||
} // namespace mt_rrt::geom |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/** | ||
* Author: Andrea Casalino | ||
* Created: 16.02.2021 | ||
* | ||
* report any bug to [email protected]. | ||
**/ | ||
|
||
#pragma once | ||
|
||
#include <MT-RRT/Extender.h> | ||
#include <MT-RRT/Node.h> | ||
#include <MT-RRT/Planner.h> | ||
|
||
#include <Logger.h> | ||
#include <MiscConversions.h> | ||
|
||
namespace mt_rrt { | ||
template <typename ObstacleT> struct ObstacleTrait {}; | ||
|
||
template <> struct ObstacleTrait<geom::Box> { | ||
static std::string typeStr() { return "Box"; } | ||
}; | ||
|
||
template <> struct ObstacleTrait<geom::Segment> { | ||
static std::string typeStr() { return "Segment"; } | ||
}; | ||
|
||
template <> struct ObstacleTrait<geom::Sphere> { | ||
static std::string typeStr() { return "Sphere"; } | ||
}; | ||
|
||
class LogResult { | ||
public: | ||
LogResult(); | ||
|
||
const auto &get() const { return content; } | ||
|
||
nlohmann::json &addToScene(const std::string &key) { return scene[key]; } | ||
|
||
template <typename ObstacleT> void addObstacle(const ObstacleT &subject) { | ||
auto &added = obstacles.emplace_back(); | ||
to_json(added, subject); | ||
added["type"] = ObstacleTrait<ObstacleT>::typeStr(); | ||
} | ||
|
||
void addTree(const TreeHandler &tree); | ||
|
||
void addSolution(const std::vector<std::vector<float>> &sequence); | ||
void addSolution(const Solution &solution); | ||
|
||
void addPlannerSolution(const PlannerSolution &sol) { | ||
for (const auto &tree : sol.trees) { | ||
addTree(*tree); | ||
} | ||
auto &added = solutions.emplace_back(); | ||
added["sequence"] = sol.solution; | ||
} | ||
|
||
private: | ||
nlohmann::json content; | ||
nlohmann::json &scene = content["scene"]; | ||
nlohmann::json &obstacles = scene["obstacles"]; | ||
nlohmann::json &trees = content["trees"]; | ||
nlohmann::json &solutions = content["solutions"]; | ||
}; | ||
} // namespace mt_rrt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/** | ||
* Author: Andrea Casalino | ||
* Created: 16.02.2021 | ||
* | ||
* report any bug to [email protected]. | ||
**/ | ||
|
||
#pragma once | ||
|
||
#include <nlohmann/json.hpp> | ||
|
||
#include <filesystem> | ||
#include <unordered_map> | ||
#include <unordered_set> | ||
|
||
namespace mt_rrt { | ||
class Logger { | ||
public: | ||
static Logger &get(); | ||
|
||
void add(const std::string &tag, const std::string &title, | ||
const nlohmann::json &content); | ||
|
||
static const auto &logRoot() { return LOG_FOLDER; } | ||
|
||
private: | ||
// clean up the log folder when building a new singleton | ||
Logger(); | ||
|
||
static inline const std::filesystem::path LOG_FOLDER = | ||
std::filesystem::path{MT_RRT_LOG_FOLDER}; | ||
|
||
std::unordered_map<std::string, std::unordered_set<std::string>> results; | ||
}; | ||
} // namespace mt_rrt |
Oops, something went wrong.