mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-01 03:14:29 +02:00
refactor: code refactored to comply with clang-tidy
This commit is contained in:
@@ -34,7 +34,7 @@ namespace mp_units {
|
||||
|
||||
template<Quantity T>
|
||||
struct AlmostEqualsMatcher : Catch::Matchers::MatcherGenericBase {
|
||||
AlmostEqualsMatcher(const T& target) : target_{target} {}
|
||||
explicit AlmostEqualsMatcher(const T& target) : target_{target} {}
|
||||
|
||||
template<std::convertible_to<T> U>
|
||||
requires std::same_as<typename T::rep, typename U::rep> && treat_as_floating_point<typename T::rep>
|
||||
@@ -57,7 +57,7 @@ private:
|
||||
template<Quantity T>
|
||||
AlmostEqualsMatcher<T> AlmostEquals(const T& target)
|
||||
{
|
||||
return {target};
|
||||
return AlmostEqualsMatcher<T>{target};
|
||||
}
|
||||
|
||||
} // namespace mp_units
|
||||
|
@@ -35,7 +35,7 @@ using namespace mp_units::si::unit_symbols;
|
||||
|
||||
TEST_CASE("std::atomic works with dimensioned types", "[atomic][assignment]")
|
||||
{
|
||||
std::atomic<quantity<isq::area[m2]>> a1 = 3.0 * isq::area[m2];
|
||||
std::atomic<quantity<isq::area[m2]>> a2 = 3.0 * isq::area[m2];
|
||||
const std::atomic<quantity<isq::area[m2]>> a1 = 3.0 * isq::area[m2];
|
||||
const std::atomic<quantity<isq::area[m2]>> a2 = 3.0 * isq::area[m2];
|
||||
REQUIRE(a1.load() == a2.load());
|
||||
}
|
||||
|
@@ -499,7 +499,7 @@ TEST_CASE("discrete_distribution")
|
||||
|
||||
SECTION("parametrized_initializer_list")
|
||||
{
|
||||
std::initializer_list<double> weights = {1.0, 2.0, 3.0};
|
||||
const std::initializer_list<double> weights = {1.0, 2.0, 3.0};
|
||||
|
||||
auto stl_dist = std::discrete_distribution<rep>(weights);
|
||||
auto units_dist = mp_units::discrete_distribution<q>(weights);
|
||||
@@ -560,8 +560,8 @@ TEST_CASE("piecewise_constant_distribution")
|
||||
|
||||
SECTION("parametrized_initializer_list")
|
||||
{
|
||||
std::initializer_list<rep> intervals_rep = {1.0, 2.0, 3.0};
|
||||
std::initializer_list<q> intervals_qty = {1.0 * isq::length[si::metre], 2.0 * isq::length[si::metre],
|
||||
const std::initializer_list<rep> intervals_rep = {1.0, 2.0, 3.0};
|
||||
const std::initializer_list<q> intervals_qty = {1.0 * isq::length[si::metre], 2.0 * isq::length[si::metre],
|
||||
3.0 * isq::length[si::metre]};
|
||||
|
||||
auto stl_dist = std::piecewise_constant_distribution<rep>(intervals_rep, [](rep val) { return val; });
|
||||
@@ -628,8 +628,8 @@ TEST_CASE("piecewise_linear_distribution")
|
||||
|
||||
SECTION("parametrized_initializer_list")
|
||||
{
|
||||
std::initializer_list<rep> intervals_rep = {1.0, 2.0, 3.0};
|
||||
std::initializer_list<q> intervals_qty = {1.0 * isq::length[si::metre], 2.0 * isq::length[si::metre],
|
||||
const std::initializer_list<rep> intervals_rep = {1.0, 2.0, 3.0};
|
||||
const std::initializer_list<q> intervals_qty = {1.0 * isq::length[si::metre], 2.0 * isq::length[si::metre],
|
||||
3.0 * isq::length[si::metre]};
|
||||
|
||||
auto stl_dist = std::piecewise_linear_distribution<rep>(intervals_rep, [](rep val) { return val; });
|
||||
|
@@ -999,17 +999,17 @@ TEST_CASE("different base types with the # specifier", "[text][fmt]")
|
||||
TEST_CASE("localization with the 'L' specifier", "[text][fmt][localization]")
|
||||
{
|
||||
struct group2 : std::numpunct<char> {
|
||||
char do_thousands_sep() const override { return '_'; }
|
||||
std::string do_grouping() const override { return "\2"; }
|
||||
[[nodiscard]] char do_thousands_sep() const override { return '_'; }
|
||||
[[nodiscard]] std::string do_grouping() const override { return "\2"; }
|
||||
};
|
||||
|
||||
struct group3 : std::numpunct<char> {
|
||||
char do_thousands_sep() const override { return '\''; }
|
||||
std::string do_grouping() const override { return "\3"; }
|
||||
[[nodiscard]] char do_thousands_sep() const override { return '\''; }
|
||||
[[nodiscard]] std::string do_grouping() const override { return "\3"; }
|
||||
};
|
||||
|
||||
std::locale grp2{std::locale::classic(), new group2};
|
||||
std::locale grp3{std::locale::classic(), new group3};
|
||||
const std::locale grp2{std::locale::classic(), new group2};
|
||||
const std::locale grp3{std::locale::classic(), new group3};
|
||||
|
||||
SECTION("full format on a quantity")
|
||||
{
|
||||
|
Reference in New Issue
Block a user