mirror of
https://github.com/boostorg/histogram.git
synced 2025-05-09 14:57:57 +00:00
increase coverage and fix noexcept (#375)
This commit is contained in:
parent
3804826411
commit
72064c642a
@ -61,7 +61,7 @@ class confidence_level;
|
||||
class deviation {
|
||||
public:
|
||||
/// constructor from units of standard deviations
|
||||
explicit deviation(double d) noexcept : d_{d} {
|
||||
explicit deviation(double d) : d_{d} {
|
||||
if (d <= 0)
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument("scaling factor must be positive"));
|
||||
}
|
||||
@ -93,7 +93,7 @@ private:
|
||||
class confidence_level {
|
||||
public:
|
||||
/// constructor from confidence level (a probability)
|
||||
explicit confidence_level(double cl) noexcept : cl_{cl} {
|
||||
explicit confidence_level(double cl) : cl_{cl} {
|
||||
if (cl <= 0 || cl >= 1)
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument("0 < cl < 1 is required"));
|
||||
}
|
||||
|
@ -45,6 +45,7 @@ void run_tests() {
|
||||
BOOST_TEST_EQ(f.successes(), 1);
|
||||
BOOST_TEST_EQ(f.failures(), 1);
|
||||
BOOST_TEST_EQ(str(f), "fraction(1, 1)"s);
|
||||
BOOST_TEST_EQ(str(f, 20), "fraction(1, 1) "s);
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -26,5 +26,13 @@ int main() {
|
||||
BOOST_TEST_IS_CLOSE(static_cast<double>(deviation(cl3)), 3, 1e-8);
|
||||
}
|
||||
|
||||
// invalid values
|
||||
{
|
||||
BOOST_TEST_THROWS((void)deviation{-0.5}, std::invalid_argument);
|
||||
BOOST_TEST_THROWS((void)confidence_level{-0.1}, std::invalid_argument);
|
||||
BOOST_TEST_THROWS((void)confidence_level{0}, std::invalid_argument);
|
||||
BOOST_TEST_THROWS((void)confidence_level{1.1}, std::invalid_argument);
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ from pathlib import Path
|
||||
import os
|
||||
import sys
|
||||
|
||||
LCOV_VERSION = "1.15"
|
||||
LCOV_VERSION = "1.16"
|
||||
|
||||
gcov = os.environ.get("GCOV", "gcov")
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user