Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alkino committed May 17, 2023
1 parent 7549893 commit e36f81d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ jobs:
restore-keys: |
cov-${{github.ref}}-
cov-
- name: Build and Test for Coverage
id: codecov
- name: Build for Coverage
shell: bash
working-directory: ${{runner.workspace}}/nmodl
run: |
Expand All @@ -71,13 +70,18 @@ jobs:
ccache -s
cmake --build .
ccache -s
env:
CCACHE_DIR: ${{runner.workspace}}/ccache
- name: Test for Coverage
id: codecov
shell: bash
working-directory: ${{runner.workspace}}/nmodl
run: |
(cd ..; lcov --capture --initial --directory . --no-external --output-file build/coverage-base.info --exclude "*/ext/*")
ctest --output-on-failure
(cd ..; lcov --capture --directory . --no-external --output-file build/coverage-run.info --exclude "*/ext/*")
lcov --add-tracefile coverage-base.info --add-tracefile coverage-run.info --output-file coverage.info
lcov --list coverage.info
env:
CCACHE_DIR: ${{runner.workspace}}/ccache
- uses: codecov/codecov-action@v3
with:
files: ./build/coverage.info
Expand Down
10 changes: 5 additions & 5 deletions test/unit/newton/newton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include "nmodl.hpp"

#include <catch2/catch_matchers_floating_point.hpp>
#include <catch2/matchers/catch_matchers_floating_point.hpp>
#include <catch2/catch_test_macros.hpp>

#include <cmath>
Expand Down Expand Up @@ -35,7 +35,7 @@ SCENARIO("Non-linear system to solve with Newton Numerical Diff Solver", "[numer
CAPTURE(iter_newton);
CAPTURE(X);
REQUIRE(iter_newton > 0);
REQUIRE_THAT(X[0], Catch::WithinRel(1.0, 0.01));
REQUIRE_THAT(X[0], Catch::Matchers::WithinRel(1.0, 0.01));
REQUIRE(F.norm() < max_error_norm);
}
}
Expand All @@ -56,7 +56,7 @@ SCENARIO("Non-linear system to solve with Newton Numerical Diff Solver", "[numer
CAPTURE(iter_newton);
CAPTURE(X);
REQUIRE(iter_newton > 0);
REQUIRE_THAT(X[0], Catch::WithinRel(2.19943987001206, 0.01));
REQUIRE_THAT(X[0], Catch::Matchers::WithinRel(2.19943987001206, 0.01));
REQUIRE(F.norm() < max_error_norm);
}
}
Expand Down Expand Up @@ -223,7 +223,7 @@ SCENARIO("Non-linear system to solve with Newton Solver", "[analytic][solver]")
CAPTURE(iter_newton);
CAPTURE(X);
REQUIRE(iter_newton > 0);
REQUIRE_THAT(X[0], Catch::WithinRel(1.0, 0.01));
REQUIRE_THAT(X[0], Catch::Matchers::WithinRel(1.0, 0.01));
REQUIRE(F.norm() < max_error_norm);
}
}
Expand All @@ -247,7 +247,7 @@ SCENARIO("Non-linear system to solve with Newton Solver", "[analytic][solver]")
CAPTURE(iter_newton);
CAPTURE(X);
REQUIRE(iter_newton > 0);
REQUIRE_THAT(X[0], Catch::WithinRel(2.19943987001206, 0.01));
REQUIRE_THAT(X[0], Catch::Matchers::WithinRel(2.19943987001206, 0.01));
REQUIRE(F.norm() < max_error_norm);
}
}
Expand Down

0 comments on commit e36f81d

Please sign in to comment.