Commit 9787af34 authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

msvcp120/tests: Test _Xtime_diff_to_millis2 overflow behavior.

parent 1d35db9f
......@@ -576,6 +576,15 @@ static void test__Xtime_diff_to_millis2(void)
{0, 0, 0, 1234000001, 1235},
{0, 0, 0, 1234000009, 1235},
{0, 0, -1, 0, 0},
{1, 0, 0, 0, 0},
{0, 1000000000, 0, 0, 0},
{0x7FFFFFFF / 1000, 0, 0, 0, 0},
{2147484, 0, 0, 0, 0}, /* ceil(0x80000000 / 1000) */
{2147485, 0, 0, 0, 0}, /* ceil(0x80000000 / 1000) + 1*/
{0, 0, 0x7FFFFFFF / 1000, 0, 2147483000},
{0, 0, 0x7FFFFFFF / 1000, 647000000, 0x7FFFFFFF}, /* max */
{0, 0, 0x7FFFFFFF / 1000, 647000001, -2147483648}, /* overflow. */
{0, 0, 2147484, 0, -2147483296}, /* ceil(0x80000000 / 1000), overflow*/
{0, 0, 0, -10000000, 0},
{0, 0, -1, -100000000, 0},
{-1, 0, 0, 0, 1000},
......@@ -583,7 +592,18 @@ static void test__Xtime_diff_to_millis2(void)
{-1, -100000000, 0, 0, 1100},
{0, 0, -1, 2000000000, 1000},
{0, 0, -2, 2000000000, 0},
{0, 0, -2, 2100000000, 100}
{0, 0, -2, 2100000000, 100},
{0, 0, _I64_MAX / 1000, 0, -808}, /* Still fits in a signed 64 bit number */
{0, 0, _I64_MAX / 1000, 1000000000, 192}, /* Overflows a signed 64 bit number */
{0, 0, (((ULONGLONG)0x80000000 << 32) | 0x1000) / 1000, 1000000000, 4192}, /* 64 bit overflow */
{_I64_MAX - 2, 0, _I64_MAX, 0, 2000}, /* Not an overflow */
{_I64_MAX, 0, _I64_MAX - 2, 0, 0}, /* Not an overflow */
/* October 11th 2017, 12:34:59 UTC */
{1507725144, 983274000, 0, 0, 0},
{0, 0, 1507725144, 983274000, 191624088},
{1507725144, 983274000, 1507725145, 983274000, 1000},
{1507725145, 983274000, 1507725145, 983274000, 0},
};
int i;
MSVCRT_long ret;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment