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

Add testrunner to CI #11

Merged
merged 3 commits into from
Dec 13, 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
8 changes: 6 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
type: string

jobs:
build:
ubuntu-latest:
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -53,7 +53,7 @@ jobs:
-DCMAKE_CXX_COMPILER=g++ \
-DCMAKE_C_COMPILER=gcc \
-DUSE_FADBAD=ON \
-DENABLE_TESTS=OFF \
-DENABLE_TESTS=ON \
..

- name: Build
Expand All @@ -67,3 +67,7 @@ jobs:
- name: Verify installation
run: |
./build/install/bin/casema-cli --version

- name: Run the tests
run: |
./build/test/testRunner [CI]
2 changes: 1 addition & 1 deletion ThirdParty/Catch/catch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10824,7 +10824,7 @@ namespace Catch {

// 32kb for the alternate stack seems to be sufficient. However, this value
// is experimentally determined, so that's not guaranteed.
static constexpr std::size_t sigStackSize = 32768 >= MINSIGSTKSZ ? 32768 : MINSIGSTKSZ;
static constexpr std::size_t sigStackSize = 32768;

static SignalDefs signalDefs[] = {
{ SIGINT, "SIGINT - Terminal interrupt signal" },
Expand Down
2 changes: 1 addition & 1 deletion test/BesselZeros.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace
}
}

TEST_CASE("Bessel zeros", "[Bessel]")
TEST_CASE("Bessel zeros", "[Bessel],[CI]")
{
mpfr::mpreal::set_default_prec(mpfr::digits2bits(100));

Expand Down
17 changes: 9 additions & 8 deletions test/DinisExpansion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@

namespace
{
inline bool equal(const mpfr::mpreal& ref, const mpfr::mpreal v)
inline bool equal(const mpfr::mpreal& ref, const mpfr::mpreal v, const mpfr::mpreal tolerance=0.0)
{
return (abs(ref - v) <= std::numeric_limits<mpfr::mpreal>::epsilon()) || (abs(ref - v) / ref <= std::numeric_limits<mpfr::mpreal>::epsilon());
const mpfr::mpreal tol = std::max(std::numeric_limits<mpfr::mpreal>::epsilon(), tolerance);
return (abs(ref - v) <= tol) || (abs(ref - v) / ref <= tol);
}

template <typename hankel_t>
Expand All @@ -43,7 +44,7 @@ namespace
}
}

TEST_CASE("Dini's expansion (r^2)", "[Bessel]")
TEST_CASE("Dini's expansion (r^2)", "[Bessel],[CI]")
{
mpfr::mpreal::set_default_prec(mpfr::digits2bits(64));

Expand All @@ -53,7 +54,7 @@ TEST_CASE("Dini's expansion (r^2)", "[Bessel]")
std::vector<mpfr::mpreal> coeffs(zeros.size());
dinisExpansionCoeffs(zeros, coeffs, [](int i, const mpfr::mpreal& z) -> mpfr::mpreal { return (i == 0) ? 0.25 : ( 2 * mpfr::besseljn(2, z) - z * mpfr::besseljn(3, z) ) / sqr(z); });

std::vector<mpfr::mpreal> pts { 0.0, 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875, 1.0 };
std::vector<mpfr::mpreal> pts { 0.025, 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875, 0.95 };

for (const auto& p : pts)
{
Expand All @@ -64,15 +65,15 @@ TEST_CASE("Dini's expansion (r^2)", "[Bessel]")
CAPTURE(ref);
CAPTURE(res-ref);

CHECK(equal(res, ref));
CHECK(equal(res, ref, 1e-8));
}
}

TEST_CASE("Dini's expansion (1-r^2)^-1", "[Bessel]")
TEST_CASE("Dini's expansion (1-r^2)^-1", "[Bessel],[CI]")
{
mpfr::mpreal::set_default_prec(mpfr::digits2bits(64));

std::vector<mpfr::mpreal> zeros(10001);
std::vector<mpfr::mpreal> zeros(20001);
casema::besselZerosJ1(zeros.size(), zeros.data());

std::vector<mpfr::mpreal> coeffs(zeros.size());
Expand All @@ -89,6 +90,6 @@ TEST_CASE("Dini's expansion (1-r^2)^-1", "[Bessel]")
CAPTURE(ref);
CAPTURE(res-ref);

CHECK(equal(res, ref));
CHECK(equal(res, ref, 0.01));
}
}
4 changes: 2 additions & 2 deletions test/DurbinsMethod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#include <vector>

TEST_CASE("Inverse Laplace exp(-2 * sqrt(s)) single", "[Durbin]")
TEST_CASE("Inverse Laplace exp(-2 * sqrt(s)) single", "[Durbin],[CI]")
{
const std::size_t precision = 50;
mpfr::mpreal::set_default_prec(mpfr::digits2bits(precision));
Expand Down Expand Up @@ -76,7 +76,7 @@ TEST_CASE("Inverse Laplace exp(-2 * sqrt(s)) single", "[Durbin]")
}
}

TEST_CASE("Inverse Laplace exp(-2 * sqrt(s)) two outlets", "[Durbin]")
TEST_CASE("Inverse Laplace exp(-2 * sqrt(s)) two outlets", "[Durbin],[CI]")
{
const std::size_t precision = 50;
mpfr::mpreal::set_default_prec(mpfr::digits2bits(precision));
Expand Down
28 changes: 14 additions & 14 deletions test/EstimateTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ namespace
}
}

TEST_CASE("Time domain upper bound linear chain GRM", "[Estimate]")
TEST_CASE("Time domain upper bound linear chain GRM", "[Estimate],[GRM],[CI]")
{
mpfr::mpreal::set_default_prec(mpfr::digits2bits(20));

Expand All @@ -239,7 +239,7 @@ TEST_CASE("Time domain upper bound linear chain GRM", "[Estimate]")
CHECK(sys->timeDomainUpperBound() == cIn);
}

TEST_CASE("Time domain upper bound linear chain 2xGRM", "[Estimate]")
TEST_CASE("Time domain upper bound linear chain 2xGRM", "[Estimate],[GRM],[CI]")
{
mpfr::mpreal::set_default_prec(mpfr::digits2bits(20));

Expand All @@ -266,7 +266,7 @@ TEST_CASE("Time domain upper bound linear chain 2xGRM", "[Estimate]")
CHECK(sys->timeDomainUpperBound() == cIn);
}

TEST_CASE("Time domain upper bound DAG GRM", "[Estimate]")
TEST_CASE("Time domain upper bound DAG GRM", "[Estimate],[GRM],[CI]")
{
mpfr::mpreal::set_default_prec(mpfr::digits2bits(20));

Expand Down Expand Up @@ -301,7 +301,7 @@ TEST_CASE("Time domain upper bound DAG GRM", "[Estimate]")
CHECK(abs(sys->timeDomainUpperBound() - std::max(cIn, cIn2)) <= mpfr::mpreal("1e-10"));
}

TEST_CASE("Time domain upper bound DAG CSTR", "[Estimate]")
TEST_CASE("Time domain upper bound DAG CSTR", "[Estimate],[GRM],[CSTR],[CI]")
{
mpfr::mpreal::set_default_prec(mpfr::digits2bits(20));

Expand Down Expand Up @@ -336,7 +336,7 @@ TEST_CASE("Time domain upper bound DAG CSTR", "[Estimate]")
CHECK(abs(sys->timeDomainUpperBound() - std::max(cIn, cIn2)) <= mpfr::mpreal("1e-10"));
}

TEST_CASE("Estimate vs inverse GRM", "[Estimate][Unit]")
TEST_CASE("Estimate vs inverse GRM", "[Estimate],[Unit],[GRM],[CI]")
{
mpfr::mpreal::set_default_prec(mpfr::digits2bits(40));

Expand Down Expand Up @@ -376,7 +376,7 @@ TEST_CASE("Estimate vs inverse GRM", "[Estimate][Unit]")
}
}

TEST_CASE("Estimate vs inverse CSTR", "[Estimate][Unit]")
TEST_CASE("Estimate vs inverse CSTR", "[Estimate],[Unit],[CSTR],[CI]")
{
mpfr::mpreal::set_default_prec(mpfr::digits2bits(40));

Expand Down Expand Up @@ -416,7 +416,7 @@ TEST_CASE("Estimate vs inverse CSTR", "[Estimate][Unit]")
}
}

TEST_CASE("Truncation error DAG GRM", "[Estimate]")
TEST_CASE("Truncation error DAG GRM", "[Estimate],[GRM],[CI]")
{
mpfr::mpreal::set_default_prec(mpfr::digits2bits(20));

Expand Down Expand Up @@ -471,7 +471,7 @@ TEST_CASE("Truncation error DAG GRM", "[Estimate]")
CHECK(abs((truncErr - ref) / ref) <= mpfr::mpreal("1e-16"));
}

TEST_CASE("Truncation error DAG CSTR", "[Estimate]")
TEST_CASE("Truncation error DAG CSTR", "[Estimate],[CSTR],[CI]")
{
mpfr::mpreal::set_default_prec(mpfr::digits2bits(20));

Expand Down Expand Up @@ -526,7 +526,7 @@ TEST_CASE("Truncation error DAG CSTR", "[Estimate]")
CHECK(abs((truncErr - ref) / ref) <= mpfr::mpreal("1e-16"));
}

TEST_CASE("Truncation error DAG GRM-CSTR", "[Estimate]")
TEST_CASE("Truncation error DAG GRM-CSTR", "[Estimate],[GRM],[CSTR],[CI]")
{
mpfr::mpreal::set_default_prec(mpfr::digits2bits(20));

Expand Down Expand Up @@ -581,7 +581,7 @@ TEST_CASE("Truncation error DAG GRM-CSTR", "[Estimate]")
CHECK(abs((truncErr - ref) / ref) <= mpfr::mpreal("1e-16"));
}

TEST_CASE("Truncation error two chains", "[Estimate]")
TEST_CASE("Truncation error two chains", "[Estimate],[GRM],[CSTR],[CI]")
{
mpfr::mpreal::set_default_prec(mpfr::digits2bits(20));

Expand Down Expand Up @@ -635,7 +635,7 @@ TEST_CASE("Truncation error two chains", "[Estimate]")
CHECK(abs((truncErr - ref) / ref) <= mpfr::mpreal("1e-16"));
}

TEST_CASE("Error estimate DAG GRM", "[Estimate]")
TEST_CASE("Error estimate DAG GRM", "[Estimate],[GRM],[CI]")
{
mpfr::mpreal::set_default_prec(mpfr::digits2bits(30));

Expand Down Expand Up @@ -680,7 +680,7 @@ TEST_CASE("Error estimate DAG GRM", "[Estimate]")
CHECK(consError + exp(2 * abscissa * T) / T * truncErr <= error);
}

TEST_CASE("Error estimate DAG CSTR", "[Estimate]")
TEST_CASE("Error estimate DAG CSTR", "[Estimate],[CSTR],[CI]")
{
mpfr::mpreal::set_default_prec(mpfr::digits2bits(30));

Expand Down Expand Up @@ -725,7 +725,7 @@ TEST_CASE("Error estimate DAG CSTR", "[Estimate]")
CHECK(consError + exp(2 * abscissa * T) / T * truncErr <= error);
}

TEST_CASE("Error estimate DAG GRM-CSTR", "[Estimate]")
TEST_CASE("Error estimate DAG GRM-CSTR", "[Estimate],[GRM],[CSTR],[CI]")
{
mpfr::mpreal::set_default_prec(mpfr::digits2bits(30));

Expand Down Expand Up @@ -770,7 +770,7 @@ TEST_CASE("Error estimate DAG GRM-CSTR", "[Estimate]")
CHECK(consError + exp(2 * abscissa * T) / T * truncErr <= error);
}

TEST_CASE("Error estimate two chains", "[Estimate]")
TEST_CASE("Error estimate two chains", "[Estimate],[GRM],[CSTR],[CI]")
{
mpfr::mpreal::set_default_prec(mpfr::digits2bits(30));

Expand Down
2 changes: 1 addition & 1 deletion test/ExpInt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace
}
}

TEST_CASE("ExpInt and inverseExpInt", "[ExpInt]")
TEST_CASE("ExpInt and inverseExpInt", "[ExpInt],[CI]")
{
// Test with 16, 32, 64 digits precision
int prec = 16;
Expand Down
4 changes: 2 additions & 2 deletions test/GRM2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ namespace
}
}

TEST_CASE("GRM vs GRM2D single zone", "[Bessel][GRM]")
TEST_CASE("GRM vs GRM2D single zone", "[Bessel],[GRM],[2DGRM],[CI]")
{
mpfr::mpreal::set_default_prec(mpfr::digits2bits(30));

Expand Down Expand Up @@ -180,7 +180,7 @@ TEST_CASE("GRM vs GRM2D single zone", "[Bessel][GRM]")
CHECK((g1-g2).array().abs().maxCoeff() <= 500 * std::numeric_limits<mpfr::mpreal>::epsilon());
}

TEST_CASE("GRM vs GRM2D two zones", "[Bessel][GRM]")
TEST_CASE("GRM vs GRM2D two zones", "[Bessel],[GRM],[2DGRM],[CI]")
{
mpfr::mpreal::set_default_prec(mpfr::digits2bits(30));

Expand Down
8 changes: 4 additions & 4 deletions test/SystemTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ namespace
}
}

TEST_CASE("Joint system solution single port units", "[System]")
TEST_CASE("Joint system solution single port units", "[System],[CI]")
{
mpfr::mpreal::set_default_prec(mpfr::digits2bits(30));

Expand Down Expand Up @@ -240,7 +240,7 @@ TEST_CASE("Joint system solution single port units", "[System]")
CHECK(abs(solL[i] - solJ[i]) <= 10 * std::numeric_limits<mpfr::mpreal>::epsilon());
}

TEST_CASE("Joint system solution two chains single port", "[System]")
TEST_CASE("Joint system solution two chains single port", "[System],[CI]")
{
mpfr::mpreal::set_default_prec(mpfr::digits2bits(30));

Expand Down Expand Up @@ -287,7 +287,7 @@ TEST_CASE("Joint system solution two chains single port", "[System]")
CHECK(abs(solL[i] - solJ[i]) <= 10 * std::numeric_limits<mpfr::mpreal>::epsilon());
}

TEST_CASE("Joint system solution multiple ports", "[System]")
TEST_CASE("Joint system solution multiple ports", "[System],[CI]")
{
mpfr::mpreal::set_default_prec(mpfr::digits2bits(30));

Expand Down Expand Up @@ -351,7 +351,7 @@ TEST_CASE("Joint system solution multiple ports", "[System]")
CHECK(abs(solL[i] - solJ[i]) <= 10 * std::numeric_limits<mpfr::mpreal>::epsilon());
}

TEST_CASE("Joint system solution multiple ports single out", "[System]")
TEST_CASE("Joint system solution multiple ports single out", "[System],[CI]")
{
mpfr::mpreal::set_default_prec(mpfr::digits2bits(30));

Expand Down
Loading