diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 6496a56..4daccd0 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -16,5 +16,6 @@ jobs: uses: alpine-ros/alpine-ros-ci-workflows/.github/workflows/ros1.yaml@main with: enable-bot-comment: true + enable-codecov: true secrets: bot-comment-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index 8abda1d..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -cmake_minimum_required(VERSION 3.1.3) -project(sample_ros_pkg) - -find_package(catkin REQUIRED) -catkin_package() diff --git a/CHANGELOG.rst b/sample_ros_pkg/CHANGELOG.rst similarity index 100% rename from CHANGELOG.rst rename to sample_ros_pkg/CHANGELOG.rst diff --git a/sample_ros_pkg/CMakeLists.txt b/sample_ros_pkg/CMakeLists.txt new file mode 100644 index 0000000..6c39073 --- /dev/null +++ b/sample_ros_pkg/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.1.3) +project(sample_ros_pkg) + +find_package(catkin REQUIRED) +catkin_package() + +include_directories(include) + +if(CATKIN_ENABLE_TESTING) + catkin_add_gtest(test_sample + test/src/test_sample.cpp + src/sample.cpp + ) +endif() diff --git a/README.md b/sample_ros_pkg/README.md similarity index 100% rename from README.md rename to sample_ros_pkg/README.md diff --git a/sample_ros_pkg/codecov.yml b/sample_ros_pkg/codecov.yml new file mode 100644 index 0000000..30b231e --- /dev/null +++ b/sample_ros_pkg/codecov.yml @@ -0,0 +1,9 @@ +coverage: + status: + project: + default: + threshold: 5% + patch: + default: + target: 25% + only_pulls: true diff --git a/sample_ros_pkg/include/sample.h b/sample_ros_pkg/include/sample.h new file mode 100644 index 0000000..06ae34c --- /dev/null +++ b/sample_ros_pkg/include/sample.h @@ -0,0 +1,4 @@ +#pragma once + +int sum(const int a, const int b); +int mul(const int a, const int b); diff --git a/package.xml b/sample_ros_pkg/package.xml similarity index 100% rename from package.xml rename to sample_ros_pkg/package.xml diff --git a/sample_ros_pkg/src/sample.cpp b/sample_ros_pkg/src/sample.cpp new file mode 100644 index 0000000..f3413c3 --- /dev/null +++ b/sample_ros_pkg/src/sample.cpp @@ -0,0 +1,13 @@ +int sum(const int a, const int b) +{ + // covered + const int c = a + b; + return c; +} + +int mul(const int a, const int b) +{ + // not covered + const int c = a * b; + return c; +} diff --git a/sample_ros_pkg/test/src/test_sample.cpp b/sample_ros_pkg/test/src/test_sample.cpp new file mode 100644 index 0000000..1cc588f --- /dev/null +++ b/sample_ros_pkg/test/src/test_sample.cpp @@ -0,0 +1,15 @@ +#include + +#include + +TEST(Sum, Sum) +{ + ASSERT_EQ(sum(1, 2), 3); +} + +int main(int argc, char** argv) +{ + testing::InitGoogleTest(&argc, argv); + + return RUN_ALL_TESTS(); +}