diff options
author | Sebastien Pouliot <sebastien@xamarin.com> | 2015-03-24 01:08:47 +0300 |
---|---|---|
committer | Sebastien Pouliot <sebastien@xamarin.com> | 2015-03-24 01:09:14 +0300 |
commit | e3dc17469e14d7e1078d74635298c52e34bc4900 (patch) | |
tree | 80d941480df0e6a4e9631ae3a78e76ca4367ccca /mcs/class/corlib | |
parent | 26d10e657221ff695c04d7917105ee3e9d0b9cc8 (diff) |
[tests] Tweak DateTime.AddMillisecondsOutOfRangeException* tests to work on ARM [#28311]
Diffstat (limited to 'mcs/class/corlib')
-rw-r--r-- | mcs/class/corlib/Test/System/DateTimeTest.cs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/mcs/class/corlib/Test/System/DateTimeTest.cs b/mcs/class/corlib/Test/System/DateTimeTest.cs index ebcf1df35a4..0e3076b1184 100644 --- a/mcs/class/corlib/Test/System/DateTimeTest.cs +++ b/mcs/class/corlib/Test/System/DateTimeTest.cs @@ -269,12 +269,18 @@ namespace MonoTests.System Assert.AreEqual (13, t1.Second, "#C4"); } + const long MaxMillis = 315537897600000; + [Test] [ExpectedException (typeof (ArgumentOutOfRangeException))] public void AddMillisecondsOutOfRangeException1 () { DateTime t1 = new DateTime (myTicks [1]); - t1.AddMilliseconds (9E100); + // double to long conversion with overflow lead to "unspecified value", + // ref: https://msdn.microsoft.com/en-us/library/yht2cx7b.aspx + // so we adapt the test to avoid this condition based on the real limit + // see https://github.com/Microsoft/referencesource/blob/master/mscorlib/system/datetime.cs#L90 + t1.AddMilliseconds (MaxMillis + 1); } [Test] @@ -282,7 +288,7 @@ namespace MonoTests.System public void AddMillisecondsOutOfRangeException2 () { DateTime t1 = new DateTime (myTicks [1]); - t1.AddMilliseconds (-9E100); + t1.AddMilliseconds (-MaxMillis-1); } [Test] |