Skip to content
Closed
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
25 changes: 18 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,10 @@ jobs:
container:
image: ${{matrix.container}}
volumes:
- /node20217:/node20217:rw,rshared
- ${{ startsWith(matrix.container, 'ubuntu:1') && '/node20217:/__e/node20:ro,rshared' || ' ' }}
- /node20_217:/node20_217:rw,rshared
- /node24_217:/node24_217:rw,rshared
- ${{ startsWith(matrix.container, 'ubuntu:1') && '/node20_217:/__e/node20:ro,rshared' || ' ' }}
- ${{ startsWith(matrix.container, 'ubuntu:1') && '/node24_217:/__e/node24:ro,rshared' || ' ' }}

steps:
- name: Setup environment
Expand All @@ -284,12 +286,21 @@ jobs:
apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y sudo software-properties-common tzdata wget curl apt-transport-https ca-certificates make build-essential g++ $PYTHON_PACKAGE python3 perl git cmake
fi
if [[ "${{matrix.container}}" == "ubuntu:1"* ]]; then
# Node 20 doesn't work with Ubuntu 16/18 glibc: https://github.com/actions/checkout/issues/1590
curl -sL https://archives.boost.io/misc/node/node-v20.9.0-linux-x64-glibc-217.tar.xz | tar -xJ --strip-components 1 -C /node20217
echo "::group::Update node"
# Install a node version that works with the glibc 2.17 of Ubuntu 16/18: https://github.com/actions/checkout/issues/1590
curl -sL https://archives.boost.io/misc/node/node-v20.9.0-linux-x64-glibc-217.tar.xz | tar -xJ --strip-components 1 -C /node20_217
# Node 24 triggers a bug in GLIBC 2.17 inside libnss_files.so.2 (around _nss_files_gethostbyname3_r) leading to a SIGSEGV
# Observed in actions/cache
# Use Node 20 instead as long as that works
mkdir -p /node24_217
cp -r /node20_217/* /node24_217/
echo -n "Node 20: " && /node20_217/bin/node --version
echo -n "Node 24: " && /node24_217/bin/node --version
echo "::endgroup::"
fi
fi
git config --global pack.threads 0
- uses: actions/checkout@v4
- uses: actions/checkout@v7

- name: Install packages
if: matrix.install
Expand Down Expand Up @@ -481,7 +492,7 @@ jobs:
runs-on: ${{matrix.os}}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v7

- name: Setup Boost
shell: cmd
Expand Down Expand Up @@ -523,7 +534,7 @@ jobs:
runs-on: ${{matrix.os}}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v7

- name: Install packages
if: matrix.install
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,21 +78,21 @@ jobs:
fi
git config --global pack.threads 0

- uses: actions/checkout@v3
- uses: actions/checkout@v7
with:
# For coverage builds fetch the whole history, else only 1 commit using a 'fake ternary'
fetch-depth: ${{ matrix.coverage && '0' || '1' }}

- name: Cache ccache
uses: actions/cache@v3
uses: actions/cache@v6
if: env.B2_USE_CCACHE
with:
path: ~/.ccache
key: ${{matrix.os}}-${{matrix.container}}-${{matrix.compiler}}-${{github.sha}}
restore-keys: ${{matrix.os}}-${{matrix.container}}-${{matrix.compiler}}-

- name: Fetch Boost.CI
uses: actions/checkout@v3
uses: actions/checkout@v7
with:
repository: boostorg/boost-ci
ref: master
Expand Down Expand Up @@ -190,10 +190,11 @@ jobs:

- name: Upload coverage
if: matrix.coverage
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v7
with:
fail_ci_if_error: true
disable_search: true
file: coverage.info
files: coverage.info
name: Github Actions
token: ${{secrets.CODECOV_TOKEN}}
verbose: true
72 changes: 36 additions & 36 deletions test/multiprecision_float_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,43 @@ typedef boost::mpl::list <
boost::random::weibull_distribution<big_float>
> distributions;

template<class T>
void check_result(const T& result, const T& min_val, const T& max_val)
{

BOOST_CHECK(boost::math::isfinite(result));
BOOST_TEST(result >= min_val);
BOOST_TEST(result <= max_val);
}

template<class T>
void check_result(const std::vector<T>& result, const std::vector<T>& min_val, const std::vector<T>& max_val)
{
for(size_t i = 0; i < result.size(); i++)
{
BOOST_CHECK(boost::math::isfinite(result[i]));
}
BOOST_TEST(result >= min_val);
BOOST_TEST(result <= max_val);
}

template<class TDist, class TGen>
void do_check_distribution(TDist& d, TGen& gen)
{
typedef typename TDist::result_type result_type;
const result_type min_val = (d.min)();
const result_type max_val = (d.max)();
for(unsigned i = 0; i < 200; ++i)
{
result_type r = d(gen);
check_result(r, min_val, max_val);
}
}

BOOST_AUTO_TEST_CASE_TEMPLATE(distributions_test, dist_type, distributions)
{
typedef typename dist_type::result_type result_type;
dist_type d;
result_type a = (d.min)();
result_type b = (d.max)();
typename dist_type::param_type p = d.param();
boost::ignore_unused(p);
d.reset();
Expand All @@ -106,46 +136,16 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(distributions_test, dist_type, distributions)
BOOST_CHECK(d == d2);

boost::random::mt19937 int_gen;
do_check_distribution(d, int_gen);

for(unsigned i = 0; i < 200; ++i)
{
result_type r = d(int_gen);
BOOST_CHECK((boost::math::isfinite)(r));
BOOST_CHECK(r >= a);
BOOST_CHECK(r <= b);
}

#ifndef BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
large_int_generator big_int_gen;

for(unsigned i = 0; i < 200; ++i)
{
result_type r = d(big_int_gen);
BOOST_CHECK((boost::math::isfinite)(r));
BOOST_CHECK(r >= a);
BOOST_CHECK(r <= b);
}
do_check_distribution(d, big_int_gen);

boost::random::discard_block_engine< ranlux_big_base_01, 389, 24 > big_float_gen;

for(unsigned i = 0; i < 200; ++i)
{
result_type r = d(big_float_gen);
BOOST_CHECK((boost::math::isfinite)(r));
BOOST_CHECK(r >= a);
BOOST_CHECK(r <= b);
}
#endif
do_check_distribution(d, big_float_gen);

boost::random::ranlux64_4_01 float_gen;

for(unsigned i = 0; i < 200; ++i)
{
result_type r = d(float_gen);
BOOST_CHECK((boost::math::isfinite)(r));
BOOST_CHECK(r >= a);
BOOST_CHECK(r <= b);
}
do_check_distribution(d, float_gen);
}


Expand Down