[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master f922b63 1/3: Remove palpably feckless casts
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master f922b63 1/3: Remove palpably feckless casts |
Date: |
Fri, 22 Jun 2018 18:30:16 -0400 (EDT) |
branch: master
commit f922b63365607b96d4240bb61d7e56a52d780224
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Remove palpably feckless casts
---
calendar_date_test.cpp | 2 +-
ledger_text_formats.cpp | 6 +++---
round_test.cpp | 6 +++---
round_to_test.cpp | 6 +++---
value_cast_test.cpp | 2 +-
5 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/calendar_date_test.cpp b/calendar_date_test.cpp
index 3fbd1d0..dda16ae 100644
--- a/calendar_date_test.cpp
+++ b/calendar_date_test.cpp
@@ -142,7 +142,7 @@ void CalendarDateTest::TestAlgorithm199Bounds()
{
calendar_date c = calendar_date(jdn_t(j));
if
- ( j != YmdToJdn(ymd_t(JdnToYmd(jdn_t(j)))).value()
+ ( j != YmdToJdn(JdnToYmd(jdn_t(j))).value()
|| !(0 < c.month() && c.month() < 13)
|| !(0 < c.day() && c.day() < 32)
)
diff --git a/ledger_text_formats.cpp b/ledger_text_formats.cpp
index 620ed1c..7122005 100644
--- a/ledger_text_formats.cpp
+++ b/ledger_text_formats.cpp
@@ -881,7 +881,7 @@ namespace
// Strings in the input class might be too wide; absent more
// graceful handling, at least no attempt is made to cure that
// problem with a negative number of spaces.
- std::string spaces(std::max(0, (g_width - z) / 2), char(' '));
+ std::string spaces(std::max(0, (g_width - z) / 2), ' ');
return spaces + s;
}
@@ -1087,8 +1087,8 @@ void FlatTextLedgerPrinter::PrintNumericalSummary() const
? "Lapses in year " + value_cast<std::string>(1 + z)
: "Matures at age " + value_cast<std::string>( z + age)
;
- s = std::string(9, char(' ')) + s;
- s.resize(12 + 12 + 12, char(' ')); // Spans three columns.
+ s = std::string(9, ' ') + s;
+ s.resize(12 + 12 + 12, ' '); // Spans three columns.
return s;
};
diff --git a/round_test.cpp b/round_test.cpp
index fad8f4d..e633193 100644
--- a/round_test.cpp
+++ b/round_test.cpp
@@ -256,9 +256,9 @@ void test_various_float_types
,long double expected
)
{
- BOOST_TEST((test_one_case(static_cast<float >(unrounded),
static_cast<float >(expected))));
- BOOST_TEST((test_one_case(static_cast<double >(unrounded),
static_cast<double >(expected))));
- BOOST_TEST((test_one_case(static_cast<long double>(unrounded),
static_cast<long double>(expected))));
+ BOOST_TEST((test_one_case(static_cast<float >(unrounded),
static_cast<float >(expected))));
+ BOOST_TEST((test_one_case(static_cast<double>(unrounded),
static_cast<double>(expected))));
+ BOOST_TEST((test_one_case(/* long double */ (unrounded), /* long double
*/ (expected))));
}
// C99 7.12.9.6: round "to the nearest integer value in floating-point
diff --git a/round_to_test.cpp b/round_to_test.cpp
index 03fb455..4b5b62a 100644
--- a/round_to_test.cpp
+++ b/round_to_test.cpp
@@ -267,9 +267,9 @@ void test_various_float_types
long double factor = detail::perform_pow(10.0L, -decimals);
long double u = unrounded * factor;
long double e = expected * factor;
- BOOST_TEST((test_one_case(static_cast<float >(u), static_cast<float
>(e), decimals, style)));
- BOOST_TEST((test_one_case(static_cast<double >(u), static_cast<double
>(e), decimals, style)));
- BOOST_TEST((test_one_case(static_cast<long double>(u), static_cast<long
double>(e), decimals, style)));
+ BOOST_TEST((test_one_case(static_cast<float >(u), static_cast<float >(e),
decimals, style)));
+ BOOST_TEST((test_one_case(static_cast<double>(u), static_cast<double>(e),
decimals, style)));
+ BOOST_TEST((test_one_case(/* long double */ (u), /* long double */ (e),
decimals, style)));
}
// Test rounding to various numbers of decimal places.
diff --git a/value_cast_test.cpp b/value_cast_test.cpp
index 57d199a..9dfb008 100644
--- a/value_cast_test.cpp
+++ b/value_cast_test.cpp
@@ -166,7 +166,7 @@ int test_main(int, char*[])
d = value_cast(i, d);
BOOST_TEST_EQUAL(d, 2.0);
- s = value_cast<std::string>(double(2.0 / 3.0));
+ s = value_cast<std::string>(2.0 / 3.0);
BOOST_TEST_EQUAL(s, "0.666666666666667");
d = value_cast<double>(s);