}
void IntlCalendarTest::checkConsistency(const char* locale) {
// Check 2.5 years in quick mode and 8000 years in exhaustive mode.
- int32_t numOfDaysToTest = (quick ? 2.5 : 8000) * 365;
+ int32_t numOfDaysToTest = static_cast<int32_t>((quick ? 2.5 : 8000) * 365);
constexpr int32_t msInADay = 1000*60*60*24;
std::string msg("TestConsistency");
IcuTestErrorCode status(*this, (msg + locale).c_str());
{1.235, 3, RoundingMode::UNUM_ROUND_CEILING, true}};
UErrorCode status = U_ZERO_ERROR;
- for (TestCase cas : cases) {
+ for (const TestCase& cas : cases) {
DecimalQuantity fq;
fq.setToDouble(cas.d);
assertTrue("Should be using approximate double", !fq.isExplicitExactDouble());
// test the actual computed values of the plural operands
double expectedNOperand = cas.expectedDouble;
- double expectedIOperand = cas.expectedLong;
+ double expectedIOperand = static_cast<double>(cas.expectedLong);
double expectedEOperand = cas.expectedSuppressedScientificExponent;
double expectedCOperand = cas.expectedSuppressedCompactExponent;
double actualNOperand = dq.getPluralOperand(PLURAL_OPERAND_N);
const int64_t inputNum = cas.inputNum;
const double expVal = cas.expVal;
- FixedDecimal fd(inputNum);
+ FixedDecimal fd(static_cast<double>(inputNum));
UnicodeString message(u"FixedDecimal::doubleValue() for" + Int64ToUnicodeString(inputNum));
assertEquals(message, expVal, fd.doubleValue());
}
const int64_t inputNum = cas.inputNum;
const int64_t expVal = cas.expVal;
- FixedDecimal fd(inputNum);
+ FixedDecimal fd(static_cast<double>(inputNum));
UnicodeString message(u"FixedDecimal::longValue() for" + Int64ToUnicodeString(inputNum));
assertEquals(message, expVal, fd.longValue());
}
const double inputNum = cas.inputNum;
const int64_t expVal = cas.expVal;
- FixedDecimal fd(inputNum);
+ FixedDecimal fd(static_cast<double>(inputNum));
UnicodeString message(u"FixedDecimal::longValue() for" + DoubleToUnicodeString(inputNum));
assertEquals(message, expVal, fd.longValue());
}
} else if (total <= INT32_MAX) {
// Check that a string of exactly the maximum size works
UnicodeString str2;
- int32_t remain = INT32_MAX - total;
+ int32_t remain = static_cast<int32_t>(INT32_MAX - total);
char16_t *buf2 = str2.getBuffer(remain);
if (buf2 == nullptr) {
// if somehow memory allocation fail, return the test