ICU-13725 Assorted minor changes to number formatting code for MSVC compatibility

X-SVN-Rev: 41271
This commit is contained in:
Shane Carr 2018-04-24 22:24:11 +00:00
parent 4c538a7d49
commit a7bcbfc07c
5 changed files with 7 additions and 5 deletions

View File

@ -61,7 +61,8 @@ enum Key {
COUNT
};
const UnicodeSet* get(Key key);
// Exported as U_COMMON_API for ucurr.h
const U_COMMON_API UnicodeSet* get(Key key);
Key chooseFrom(UnicodeString str, Key key1);

View File

@ -1305,7 +1305,7 @@ bool DecimalFormat::fastFormatInt64(int64_t input, UnicodeString& output) const
if (i32 != input || i32 == INT32_MIN) {
return false;
}
doFastFormatInt32(i32, std::signbit(input), output);
doFastFormatInt32(i32, input < 0, output);
return true;
}

View File

@ -30,9 +30,10 @@ void addUNumberFormatterTest(TestNode** root) {
}
#define CAPACITY 30
static void TestSkeletonFormatToString() {
UErrorCode ec = U_ZERO_ERROR;
static const int32_t CAPACITY = 30;
UChar buffer[CAPACITY];
// setup:

View File

@ -366,7 +366,7 @@ void DecimalQuantityTest::testMaxDigits() {
dq.setFractionLength(0, 2);
assertEquals("Should trim, toPlainString", "76.54", dq.toPlainString());
assertEquals("Should trim, toScientificString", "7.654E+1", dq.toScientificString());
assertEquals("Should trim, toLong", 76L, dq.toLong(true));
assertEquals("Should trim, toLong", 76LL, dq.toLong(true));
assertEquals("Should trim, toFractionLong", 54L, dq.toFractionLong(false));
assertEquals("Should trim, toDouble", 76.54, dq.toDouble());
// To test DecNum output, check the round-trip.

View File

@ -2770,7 +2770,7 @@ void NumberFormatRegressionTest::Test8199(void) {
nf->parse(numStr, val, status);
TEST_CHECK_STATUS(status);
TEST_ASSERT_EQUALS(Formattable::kDouble, val.getType());
TEST_ASSERT_EQUALS(1000000000L, val.getInt64(status));
TEST_ASSERT_EQUALS(1000000000LL, val.getInt64(status));
TEST_CHECK_STATUS(status);
TEST_ASSERT_EQUALS(1000000000.6, val.getDouble(status));
TEST_CHECK_STATUS(status);