From f5166a45a48a06b940541ecffe39ef2cca68d4f5 Mon Sep 17 00:00:00 2001 From: "James D. Mitchell" Date: Fri, 20 Oct 2023 12:42:57 +0200 Subject: [PATCH 1/2] ci: starting using gh actions --- .github/workflows/runtests.yml | 40 ++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/runtests.yml diff --git a/.github/workflows/runtests.yml b/.github/workflows/runtests.yml new file mode 100644 index 00000000..f056d764 --- /dev/null +++ b/.github/workflows/runtests.yml @@ -0,0 +1,40 @@ +name: CI +on: [pull_request, push, workflow_dispatch] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + tests: + name: "ubuntu-latest | g++" + timeout-minutes: 60 + runs-on: ubuntu-latest + env: + CXX: "ccache g++" + CXXFLAGS: "-fdiagnostics-color" + CMAKE_CXX_COMPILER: "ccache g++" + steps: + - name: "Checkout HPCombi repo . . ." + uses: actions/checkout@v3 + - name: "Setup ccache . . ." + uses: Chocobo1/setup-ccache-action@v1 + with: + update_packager_index: false + override_cache_key: ${{ runner.os }}-${{ github.ref }} + override_cache_key_fallback: ${{ runner.os }} + - name: "Install dependencies . . ." + run: | + sudo apt-get --yes update + sudo apt-get install --yes ccache + sudo apt-get install --yes libbenchmark-dev + sudo apt-get install --yes libgtest-dev + sudo apt-get install --yes libboost-all-dev + - name: "Build + run HPCombi tests . . ." + run: | + mkdir build + cd build + cmake -DBUILD_TESTING=1 -DCMAKE_BUILD_TYPE=Release .. + make + make test + From db888daddbc4f6f9e0f8f0b3d46165c1d6fe450e Mon Sep 17 00:00:00 2001 From: "James D. Mitchell" Date: Fri, 20 Oct 2023 13:26:52 +0200 Subject: [PATCH 2/2] tests: remove deprecated header --- tests/test_perm_all.cpp | 98 +++++++++++++++++++---------------------- 1 file changed, 46 insertions(+), 52 deletions(-) diff --git a/tests/test_perm_all.cpp b/tests/test_perm_all.cpp index 7a54889c..553d6c91 100644 --- a/tests/test_perm_all.cpp +++ b/tests/test_perm_all.cpp @@ -20,7 +20,6 @@ #include #include -#include #include //____________________________________________________________________________// @@ -44,10 +43,9 @@ struct Fixture : public IsPermFunctions { using PermType = _PermType; Fixture() - : zero({0}), V01({0, 1}), V10({1, 0}), V11({1, 1}), - V1({}, 1), PPa({1, 2, 3, 4, 0, 5}), - PPb({1, 2, 3, 6, 0, 5}), czero(zero), cV01(V01), - RandPerm({3, 1, 0, 5, 10, 2, 6, 7, 4, 8, 9}), + : zero({0}), V01({0, 1}), V10({1, 0}), V11({1, 1}), V1({}, 1), + PPa({1, 2, 3, 4, 0, 5}), PPb({1, 2, 3, 6, 0, 5}), czero(zero), + cV01(V01), RandPerm({3, 1, 0, 5, 10, 2, 6, 7, 4, 8, 9}), Plist({PPa, PPb, RandPerm}), Vlist({zero, V01, V10, V11, V1, PPa, PPb, RandPerm}) { BOOST_TEST_MESSAGE("setup fixture"); @@ -70,12 +68,9 @@ struct Fixture : public IsPermFunctions { //____________________________________________________________________________// typedef boost::mpl::list< - Fixture, - Fixture>, - Fixture>, - Fixture>, - Fixture>, - Fixture>, + Fixture, Fixture>, + Fixture>, Fixture>, + Fixture>, Fixture>, Fixture>> Fixtures; @@ -85,7 +80,7 @@ BOOST_AUTO_TEST_SUITE(VectType_test) //____________________________________________________________________________// BOOST_FIXTURE_TEST_CASE_TEMPLATE(sizeof_test, F, Fixtures, F) { - BOOST_TEST(sizeof(F::zero) == F::VectType::Size()*sizeof(F::zero[0])); + BOOST_TEST(sizeof(F::zero) == F::VectType::Size() * sizeof(F::zero[0])); } BOOST_FIXTURE_TEST_CASE_TEMPLATE(equal_test, F, Fixtures, F) { @@ -163,47 +158,46 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(operator_less_partial_test, F, Fixtures, F) { BOOST_TEST(F::PPb.less_partial(F::PPa, 5) > 0); } - BOOST_FIXTURE_TEST_CASE_TEMPLATE(first_zero_test, F, Fixtures, F) { - BOOST_TEST(F::zero.first_zero() == 0u); - BOOST_TEST(F::V01.first_zero() == 0u); - BOOST_TEST(F::PPa.first_zero() == 4u); - BOOST_TEST(F::V10.first_zero() == 1u); - BOOST_TEST(F::V1.first_zero() == F::VectType::Size()); - BOOST_TEST(F::V10.first_zero(1) == F::VectType::Size()); - BOOST_TEST(F::PPa.first_zero(5) == 4u); - BOOST_TEST(F::PPa.first_zero(3) == F::VectType::Size()); + BOOST_TEST(F::zero.first_zero() == 0u); + BOOST_TEST(F::V01.first_zero() == 0u); + BOOST_TEST(F::PPa.first_zero() == 4u); + BOOST_TEST(F::V10.first_zero() == 1u); + BOOST_TEST(F::V1.first_zero() == F::VectType::Size()); + BOOST_TEST(F::V10.first_zero(1) == F::VectType::Size()); + BOOST_TEST(F::PPa.first_zero(5) == 4u); + BOOST_TEST(F::PPa.first_zero(3) == F::VectType::Size()); } BOOST_FIXTURE_TEST_CASE_TEMPLATE(last_zero_test, F, Fixtures, F) { - BOOST_TEST(F::zero.last_zero() == F::VectType::Size() - 1); - BOOST_TEST(F::V01.last_zero() == F::VectType::Size() - 1); - BOOST_TEST(F::PPa.last_zero() == 4u); - BOOST_TEST(F::V1.last_zero() == F::VectType::Size()); - BOOST_TEST(F::V01.last_zero(1) == 0u); - BOOST_TEST(F::V10.last_zero(1) == F::VectType::Size()); - BOOST_TEST(F::PPa.last_zero(5) == 4u); - BOOST_TEST(F::PPa.last_zero(3) == F::VectType::Size()); + BOOST_TEST(F::zero.last_zero() == F::VectType::Size() - 1); + BOOST_TEST(F::V01.last_zero() == F::VectType::Size() - 1); + BOOST_TEST(F::PPa.last_zero() == 4u); + BOOST_TEST(F::V1.last_zero() == F::VectType::Size()); + BOOST_TEST(F::V01.last_zero(1) == 0u); + BOOST_TEST(F::V10.last_zero(1) == F::VectType::Size()); + BOOST_TEST(F::PPa.last_zero(5) == 4u); + BOOST_TEST(F::PPa.last_zero(3) == F::VectType::Size()); } BOOST_FIXTURE_TEST_CASE_TEMPLATE(first_non_zero_test, F, Fixtures, F) { - BOOST_TEST(F::zero.first_non_zero() == F::VectType::Size()); - BOOST_TEST(F::V01.first_non_zero() == 1u); - BOOST_TEST(F::PPa.first_non_zero() == 0u); - BOOST_TEST(F::V01.first_non_zero() == 1u); - BOOST_TEST(F::V01.first_non_zero(1) == F::VectType::Size()); - BOOST_TEST(F::PPa.first_non_zero(5) == 0u); - BOOST_TEST(F::PPa.first_non_zero(3) == 0u); + BOOST_TEST(F::zero.first_non_zero() == F::VectType::Size()); + BOOST_TEST(F::V01.first_non_zero() == 1u); + BOOST_TEST(F::PPa.first_non_zero() == 0u); + BOOST_TEST(F::V01.first_non_zero() == 1u); + BOOST_TEST(F::V01.first_non_zero(1) == F::VectType::Size()); + BOOST_TEST(F::PPa.first_non_zero(5) == 0u); + BOOST_TEST(F::PPa.first_non_zero(3) == 0u); } BOOST_FIXTURE_TEST_CASE_TEMPLATE(last_non_zero_test, F, Fixtures, F) { - BOOST_TEST(F::zero.last_non_zero() == F::VectType::Size()); - BOOST_TEST(F::V01.last_non_zero() == 1u); - BOOST_TEST(F::PPa.last_non_zero() == F::VectType::Size() - 1); - BOOST_TEST(F::V01.last_non_zero() == 1u); - BOOST_TEST(F::V01.last_non_zero(1) == F::VectType::Size()); - BOOST_TEST(F::PPa.last_non_zero(5) == 3u); - BOOST_TEST(F::PPa.last_non_zero(3) == 2u); + BOOST_TEST(F::zero.last_non_zero() == F::VectType::Size()); + BOOST_TEST(F::V01.last_non_zero() == 1u); + BOOST_TEST(F::PPa.last_non_zero() == F::VectType::Size() - 1); + BOOST_TEST(F::V01.last_non_zero() == 1u); + BOOST_TEST(F::V01.last_non_zero(1) == F::VectType::Size()); + BOOST_TEST(F::PPa.last_non_zero(5) == 3u); + BOOST_TEST(F::PPa.last_non_zero(3) == 2u); } BOOST_FIXTURE_TEST_CASE_TEMPLATE(permuted_test, F, Fixtures, F) { @@ -266,7 +260,8 @@ template struct PermFixture : public IsPermFunctions<_Perm> { PermFixture() : id(PermType::one()), RandPerm({3, 1, 0, 5, 10, 2, 11, 6, 7, 4, 8, 9}), Plist({id, RandPerm}) { - for (uint64_t i = 0; i < std::min(PermType::size(), 30) - 1; i++) + for (uint64_t i = 0; i < std::min(PermType::size(), 30) - 1; + i++) Plist.push_back(PermType::elementary_transposition(i)); for (uint64_t i = std::max(30, PermType::size() - 20); i < PermType::size() - 1; i++) @@ -285,14 +280,13 @@ template struct PermFixture : public IsPermFunctions<_Perm> { //____________________________________________________________________________// -typedef boost::mpl::list< - PermFixture, - PermFixture>, - PermFixture>, - PermFixture>, - PermFixture>, - PermFixture>, - PermFixture>> +typedef boost::mpl::list, + PermFixture>, + PermFixture>, + PermFixture>, + PermFixture>, + PermFixture>, + PermFixture>> PermFixtures; //____________________________________________________________________________//