Skip to content

Commit

Permalink
test ASan
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmcfarlane committed Dec 12, 2021
1 parent 7f4c744 commit dc6120b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ jobs:
# Build and test latest on Linux using only CMake
cmake:
strategy:
fail-fast: false
matrix:
compiler: [clang, gcc]
include:
Expand Down Expand Up @@ -105,6 +106,7 @@ jobs:
# Build and test many combinations on Linux/OS X using Conan
conan:
strategy:
fail-fast: false
matrix:
name: [
clang-head-libc++, clang-head-libstdc++,
Expand Down Expand Up @@ -242,6 +244,7 @@ jobs:
windows:
runs-on: windows-2019
strategy:
fail-fast: false
matrix:
arch: [x86_64, x86]
include:
Expand Down
9 changes: 7 additions & 2 deletions test/unit/cmath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ static_assert(identical(2, cnl::sqrt(4)));

TEST(cmake, sqrt_float) // NOLINT
{
auto const expected{3.5};
auto const expected{new double{3.5}};
auto const actual{cnl::sqrt(12.25)};
ASSERT_EQ(expected, actual);
// NOLINTNEXTLINE(clang-analyzer-cplusplus.NewDeleteLeaks)
ASSERT_EQ(*expected, actual);
if (actual > 42) {
// NOLINTNEXTLINE(cppcoreguidelines-owning-memory)
delete expected;
}
}

0 comments on commit dc6120b

Please sign in to comment.