Imported Upstream version 4.0.0~alpha1

Former-commit-id: 806294f5ded97629b74c85c09952f2a74fe182d9
This commit is contained in:
Jo Shields
2015-04-07 09:35:12 +01:00
parent 283343f570
commit 3c1f479b9d
22469 changed files with 2931443 additions and 869343 deletions

View File

@@ -1 +1 @@
0836640057e3cfabdb47c8cc3ab4990f87869cad
a9eb1d3c5c0f2e553f7dec495c3836af1f09d565

View File

@@ -26,7 +26,6 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
using NUnit.Framework;
using System;
@@ -162,4 +161,3 @@ namespace MonoTests.System {
}
}
#endif

View File

@@ -26,7 +26,6 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
using NUnit.Framework;
using System;
@@ -63,4 +62,3 @@ namespace MonoTests.System {
}
}
#endif

View File

@@ -29,9 +29,7 @@
using NUnit.Framework;
using System;
using System.Collections;
#if NET_2_0
using System.Collections.Generic;
#endif
namespace MonoTests.System {
@@ -87,7 +85,6 @@ namespace MonoTests.System {
Assert.Fail ("#8");
} catch (ArgumentNullException) {}
#if NET_2_0
try {
Array.Sort<object> (null);
Assert.Fail ("#9");
@@ -132,7 +129,6 @@ namespace MonoTests.System {
Array.Sort<object> (null, new Comparison<object>(ObjComparison));
Assert.Fail ("#17");
} catch (ArgumentNullException) {}
#endif
}
public static int ObjComparison (object o1, object o2) {
@@ -164,7 +160,6 @@ namespace MonoTests.System {
Assert.Fail ("#4");
} catch (ArgumentException) {}
#if NET_2_0
try {
Array.Sort<object> (arr, 1, 5);
Assert.Fail ("#5");
@@ -184,7 +179,6 @@ namespace MonoTests.System {
Array.Sort<object, object> (arr, null, 1, 5, null);
Assert.Fail ("#8");
} catch (ArgumentException) {}
#endif
}
[Test]
@@ -230,7 +224,6 @@ namespace MonoTests.System {
Assert.Fail ("#4");
} catch (ArgumentOutOfRangeException) {}
#if NET_2_0
try {
Array.Sort<object> (arr, -1, 1);
Assert.Fail ("#5");
@@ -270,7 +263,6 @@ namespace MonoTests.System {
Array.Sort<object, object> (arr, null, 0, -1, null);
Assert.Fail ("#8");
} catch (ArgumentOutOfRangeException) {}
#endif
}
[Test]
@@ -362,7 +354,6 @@ namespace MonoTests.System {
Assert.Fail ("#8");
} catch (InvalidOperationException) {}
#if NET_2_0
try {
Array.Sort<object> (arr);
Assert.Fail ("#9");
@@ -402,7 +393,6 @@ namespace MonoTests.System {
Array.Sort<object, object> (arr, null, 0, 3, null);
Assert.Fail ("#16");
} catch (InvalidOperationException) {}
#endif
}
}
}

View File

@@ -3618,5 +3618,22 @@ public class ArrayTest
#endif
[Test]
public void JaggedArrayCtor ()
{
var type = Type.GetType ("System.Object[][]");
ConstructorInfo ctor = null;
foreach (var c in type.GetConstructors ()) {
if (c.GetParameters ().Length == 2)
ctor = c;
}
Assert.IsNotNull (ctor);
var arr = (object[])ctor.Invoke (new object [] { 4, 10 });
for (int i = 0; i < 4; ++i) {
Assert.IsNotNull (arr [i]);
Assert.AreEqual (10, ((object[])arr [i]).Length);
}
}
}
}

View File

@@ -41,9 +41,7 @@ namespace MonoTests.System
{
BadImageFormatException bif = new BadImageFormatException ();
#if NET_2_0
Assert.IsNotNull (bif.Data, "#1");
#endif
Assert.IsNull (bif.FileName, "#2");
Assert.IsNull (bif.InnerException, "#3");
Assert.IsNotNull (bif.Message, "#4"); // Format of the executable (.exe) or library (.dll) is invalid
@@ -56,9 +54,7 @@ namespace MonoTests.System
{
BadImageFormatException bif = new BadImageFormatException ("message");
#if NET_2_0
Assert.IsNotNull (bif.Data, "#1");
#endif
Assert.IsNull (bif.FileName, "#2");
Assert.IsNull (bif.InnerException, "#3");
Assert.IsNotNull (bif.Message, "#4");
@@ -73,9 +69,7 @@ namespace MonoTests.System
{
BadImageFormatException bif = new BadImageFormatException (string.Empty);
#if NET_2_0
Assert.IsNotNull (bif.Data, "#1");
#endif
Assert.IsNull (bif.FileName, "#2");
Assert.IsNull (bif.InnerException, "#3");
Assert.IsNotNull (bif.Message, "#4");
@@ -90,25 +84,14 @@ namespace MonoTests.System
{
BadImageFormatException bif = new BadImageFormatException ((string) null);
#if NET_2_0
Assert.IsNotNull (bif.Data, "#1");
#endif
Assert.IsNull (bif.FileName, "#2");
Assert.IsNull (bif.InnerException, "#3");
#if NET_2_0
Assert.IsNotNull (bif.Message, "#4"); // Could not load file or assembly '' ...
Assert.IsTrue (bif.Message.IndexOf ("''") != -1, "#5");
#else
Assert.IsNotNull (bif.Message, "#4"); // Format of the executable (.exe) or library ...
Assert.IsFalse (bif.Message.IndexOf ("''") != -1, "#5");
#endif
Assert.IsNull (bif.FusionLog, "#5");
Assert.IsTrue (bif.ToString ().StartsWith (bif.GetType ().FullName), "#6");
#if NET_2_0
Assert.IsTrue (bif.ToString ().IndexOf ("''") != -1, "#7");
#else
Assert.IsFalse (bif.ToString ().IndexOf ("''") != -1, "#7");
#endif
}
[Test]
@@ -118,9 +101,7 @@ namespace MonoTests.System
BadImageFormatException bif = new BadImageFormatException ("message",
ame);
#if NET_2_0
Assert.IsNotNull (bif.Data, "#1");
#endif
Assert.IsNull (bif.FileName, "#2");
Assert.IsNotNull (bif.InnerException, "#3");
Assert.AreSame (ame, bif.InnerException, "#4");
@@ -137,9 +118,7 @@ namespace MonoTests.System
ArithmeticException ame = new ArithmeticException ("something");
BadImageFormatException bif = new BadImageFormatException (string.Empty, ame);
#if NET_2_0
Assert.IsNotNull (bif.Data, "#1");
#endif
Assert.IsNull (bif.FileName, "#2");
Assert.IsNotNull (bif.InnerException, "#3");
Assert.AreSame (ame, bif.InnerException, "#4");
@@ -156,19 +135,12 @@ namespace MonoTests.System
ArithmeticException ame = new ArithmeticException ("something");
BadImageFormatException bif = new BadImageFormatException ((string) null, ame);
#if NET_2_0
Assert.IsNotNull (bif.Data, "#1");
#endif
Assert.IsNull (bif.FileName, "#2");
Assert.IsNotNull (bif.InnerException, "#3");
Assert.AreSame (ame, bif.InnerException, "#4");
#if NET_2_0
Assert.IsNotNull (bif.Message, "#5"); // Could not load file or assembly '' ...
Assert.IsTrue (bif.Message.IndexOf ("''") != -1, "#6");
#else
Assert.IsNotNull (bif.Message, "#5"); // Format of the executable (.exe) or library ...
Assert.IsFalse (bif.Message.IndexOf ("''") != -1, "#6");
#endif
Assert.IsNull (bif.FusionLog, "#7");
Assert.IsTrue (bif.ToString ().StartsWith (bif.GetType ().FullName), "#8");
Assert.IsTrue (bif.ToString ().IndexOf ("---> " + ame.GetType ().FullName) != -1, "#9");
@@ -181,9 +153,7 @@ namespace MonoTests.System
BadImageFormatException bif = new BadImageFormatException ("message",
(Exception) null);
#if NET_2_0
Assert.IsNotNull (bif.Data, "#1");
#endif
Assert.IsNull (bif.FileName, "#2");
Assert.IsNull (bif.InnerException, "#3");
Assert.IsNotNull (bif.Message, "#4");
@@ -199,9 +169,7 @@ namespace MonoTests.System
BadImageFormatException bif = new BadImageFormatException ("message",
"file.txt");
#if NET_2_0
Assert.IsNotNull (bif.Data, "#1");
#endif
Assert.IsNotNull (bif.FileName, "#2");
Assert.AreEqual ("file.txt", bif.FileName, "#3");
Assert.IsNull (bif.InnerException, "#4");
@@ -210,13 +178,8 @@ namespace MonoTests.System
Assert.IsNull (bif.FusionLog, "#7");
Assert.IsTrue (bif.ToString ().StartsWith (bif.GetType ().FullName
+ ": message" + Environment.NewLine), "#8");
#if NET_2_0
Assert.IsTrue (bif.ToString ().IndexOf ("'file.txt'") != -1, "#9");
Assert.IsFalse (bif.ToString ().IndexOf ("\"file.txt\"") != -1, "#9");
#else
Assert.IsFalse (bif.ToString ().IndexOf ("'file.txt'") != -1, "#9");
Assert.IsTrue (bif.ToString ().IndexOf ("\"file.txt\"") != -1, "#10");
#endif
}
[Test]
@@ -225,9 +188,7 @@ namespace MonoTests.System
BadImageFormatException bif = new BadImageFormatException ("message",
string.Empty);
#if NET_2_0
Assert.IsNotNull (bif.Data, "#1");
#endif
Assert.IsNotNull (bif.FileName, "#2");
Assert.AreEqual (string.Empty, bif.FileName, "#3");
Assert.IsNull (bif.InnerException, "#4");
@@ -244,9 +205,7 @@ namespace MonoTests.System
BadImageFormatException bif = new BadImageFormatException ("message",
(string) null);
#if NET_2_0
Assert.IsNotNull (bif.Data, "#A1");
#endif
Assert.IsNull (bif.FileName, "#A2");
Assert.IsNull (bif.InnerException, "#A3");
Assert.IsNotNull (bif.Message, "#A4");
@@ -257,9 +216,7 @@ namespace MonoTests.System
bif = new BadImageFormatException (string.Empty, (string) null);
#if NET_2_0
Assert.IsNotNull (bif.Data, "#B1");
#endif
Assert.IsNull (bif.FileName, "#B2");
Assert.IsNull (bif.InnerException, "#B3");
Assert.IsNotNull (bif.Message, "#B4");
@@ -275,9 +232,7 @@ namespace MonoTests.System
BadImageFormatException bif = new BadImageFormatException (string.Empty,
string.Empty);
#if NET_2_0
Assert.IsNotNull (bif.Data, "#1");
#endif
Assert.IsNotNull (bif.FileName, "#2");
Assert.AreEqual (string.Empty, bif.FileName, "#3");
Assert.IsNull (bif.InnerException, "#4");
@@ -293,18 +248,11 @@ namespace MonoTests.System
BadImageFormatException bif = new BadImageFormatException ((string) null,
(string) null);
#if NET_2_0
Assert.IsNotNull (bif.Data, "#1");
#endif
Assert.IsNull (bif.FileName, "#2");
Assert.IsNull (bif.InnerException, "#3");
#if NET_2_0
Assert.IsNotNull (bif.Message, "#4"); // Could not load file or assembly '' ...
Assert.IsTrue (bif.Message.IndexOf ("''") != -1, "#5");
#else
Assert.IsNotNull (bif.Message, "#4"); // Format of the executable (.exe) or library ...
Assert.IsFalse (bif.Message.IndexOf ("''") != -1, "#5");
#endif
Assert.IsNull (bif.FusionLog, "#5");
Assert.IsTrue (bif.ToString ().StartsWith (bif.GetType ().FullName
+ ": "), "#6");
@@ -318,9 +266,7 @@ namespace MonoTests.System
bif = new BadImageFormatException (string.Empty, "file.txt");
#if NET_2_0
Assert.IsNotNull (bif.Data, "#1");
#endif
Assert.IsNotNull (bif.FileName, "#2");
Assert.AreEqual ("file.txt", bif.FileName, "#3");
Assert.IsNull (bif.InnerException, "#4");
@@ -329,13 +275,8 @@ namespace MonoTests.System
Assert.IsNull (bif.FusionLog, "#7");
Assert.IsTrue (bif.ToString ().StartsWith (bif.GetType ().FullName
+ ": " + Environment.NewLine), "#8");
#if NET_2_0
Assert.IsTrue (bif.ToString ().IndexOf ("'file.txt'") != -1, "#9");
Assert.IsFalse (bif.ToString ().IndexOf ("\"file.txt\"") != -1, "#10");
#else
Assert.IsFalse (bif.ToString ().IndexOf ("'file.txt'") != -1, "#9");
Assert.IsTrue (bif.ToString ().IndexOf ("\"file.txt\"") != -1, "#10");
#endif
}
[Test]
@@ -345,9 +286,7 @@ namespace MonoTests.System
bif = new BadImageFormatException ((string) null, "file.txt");
#if NET_2_0
Assert.IsNotNull (bif.Data, "#A1");
#endif
Assert.IsNotNull (bif.FileName, "#A2");
Assert.AreEqual ("file.txt", bif.FileName, "#A3");
Assert.IsNull (bif.InnerException, "#A4");
@@ -360,9 +299,7 @@ namespace MonoTests.System
bif = new BadImageFormatException ((string) null, string.Empty);
#if NET_2_0
Assert.IsNotNull (bif.Data, "#B1");
#endif
Assert.IsNotNull (bif.FileName, "#B2");
Assert.AreEqual (string.Empty, bif.FileName, "#B3");
Assert.IsNull (bif.InnerException, "#B4");

View File

@@ -82,11 +82,7 @@ namespace MonoTests.System
Assert.IsNull (ex.InnerException, "#3");
Assert.IsNotNull (ex.Message, "#4");
Assert.IsNotNull (ex.ParamName, "#5");
#if NET_2_0
Assert.AreEqual ("value", ex.ParamName, "#6");
#else
Assert.AreEqual ("byteArray", ex.ParamName, "#6");
#endif
}
}
@@ -154,11 +150,7 @@ namespace MonoTests.System
Assert.IsNull (ex.InnerException, "#3");
Assert.IsNotNull (ex.Message, "#4");
Assert.IsNotNull (ex.ParamName, "#5");
#if NET_2_0
Assert.AreEqual ("value", ex.ParamName, "#6");
#else
Assert.AreEqual ("byteArray", ex.ParamName, "#6");
#endif
}
}
@@ -188,9 +180,7 @@ namespace MonoTests.System
Assert.IsNull (ex.InnerException, "#B3");
Assert.IsNotNull (ex.Message, "#B4");
Assert.IsNotNull (ex.ParamName, "#B5");
#if NET_2_0
Assert.AreEqual ("startIndex", ex.ParamName, "#B6");
#endif
}
}
@@ -276,11 +266,7 @@ namespace MonoTests.System
Assert.IsNull (ex.InnerException, "#3");
Assert.IsNotNull (ex.Message, "#4");
Assert.IsNotNull (ex.ParamName, "#5");
#if NET_2_0
Assert.AreEqual ("value", ex.ParamName, "#6");
#else
Assert.AreEqual ("byteArray", ex.ParamName, "#6");
#endif
}
}
@@ -346,11 +332,7 @@ namespace MonoTests.System
Assert.IsNull (ex.InnerException, "#3");
Assert.IsNotNull (ex.Message, "#4");
Assert.IsNotNull (ex.ParamName, "#5");
#if NET_2_0
Assert.AreEqual ("value", ex.ParamName, "#6");
#else
Assert.AreEqual ("byteArray", ex.ParamName, "#6");
#endif
}
}
@@ -415,11 +397,7 @@ namespace MonoTests.System
Assert.IsNull (ex.InnerException, "#3");
Assert.IsNotNull (ex.Message, "#4");
Assert.IsNotNull (ex.ParamName, "#5");
#if NET_2_0
Assert.AreEqual ("value", ex.ParamName, "#6");
#else
Assert.AreEqual ("byteArray", ex.ParamName, "#6");
#endif
}
}
@@ -485,11 +463,7 @@ namespace MonoTests.System
Assert.IsNull (ex.InnerException, "#3");
Assert.IsNotNull (ex.Message, "#4");
Assert.IsNotNull (ex.ParamName, "#5");
#if NET_2_0
Assert.AreEqual ("value", ex.ParamName, "#6");
#else
Assert.AreEqual ("byteArray", ex.ParamName, "#6");
#endif
}
}
@@ -554,11 +528,7 @@ namespace MonoTests.System
Assert.IsNull (ex.InnerException, "#3");
Assert.IsNotNull (ex.Message, "#4");
Assert.IsNotNull (ex.ParamName, "#5");
#if NET_2_0
Assert.AreEqual ("value", ex.ParamName, "#6");
#else
Assert.AreEqual ("byteArray", ex.ParamName, "#6");
#endif
}
}
@@ -624,11 +594,7 @@ namespace MonoTests.System
Assert.IsNull (ex.InnerException, "#3");
Assert.IsNotNull (ex.Message, "#4");
Assert.IsNotNull (ex.ParamName, "#5");
#if NET_2_0
Assert.AreEqual ("value", ex.ParamName, "#6");
#else
Assert.AreEqual ("byteArray", ex.ParamName, "#6");
#endif
}
}
@@ -693,11 +659,7 @@ namespace MonoTests.System
Assert.IsNull (ex.InnerException, "#3");
Assert.IsNotNull (ex.Message, "#4");
Assert.IsNotNull (ex.ParamName, "#5");
#if NET_2_0
Assert.AreEqual ("value", ex.ParamName, "#6");
#else
Assert.AreEqual ("byteArray", ex.ParamName, "#6");
#endif
}
}
@@ -752,21 +714,7 @@ namespace MonoTests.System
public void ToString_Value_Empty ()
{
byte [] empty = new byte [0];
#if NET_2_0
Assert.AreEqual (String.Empty, BitConverter.ToString (empty), "#A1");
#else
try {
BitConverter.ToString (empty);
Assert.Fail ("#A1");
} catch (ArgumentOutOfRangeException ex) {
// StartIndex cannot be less than zero
Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#A2");
Assert.IsNull (ex.InnerException, "#A3");
Assert.IsNotNull (ex.Message, "#A4");
Assert.IsNotNull (ex.ParamName, "#A5");
Assert.AreEqual ("startIndex", ex.ParamName, "#A6");
}
#endif
try {
BitConverter.ToString (empty, 3);
@@ -780,21 +728,7 @@ namespace MonoTests.System
Assert.AreEqual ("startIndex", ex.ParamName, "#B6");
}
#if NET_2_0
Assert.AreEqual (String.Empty, BitConverter.ToString (empty, 0), "#C1");
#else
try {
BitConverter.ToString (empty, 0);
Assert.Fail ("#C1");
} catch (ArgumentOutOfRangeException ex) {
// StartIndex cannot be less than zero
Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#C2");
Assert.IsNull (ex.InnerException, "#C3");
Assert.IsNotNull (ex.Message, "#C4");
Assert.IsNotNull (ex.ParamName, "#C5");
Assert.AreEqual ("startIndex", ex.ParamName, "#C6");
}
#endif
try {
BitConverter.ToString (empty, 3, 0);
@@ -808,21 +742,7 @@ namespace MonoTests.System
Assert.AreEqual ("startIndex", ex.ParamName, "#D6");
}
#if NET_2_0
Assert.AreEqual (string.Empty, BitConverter.ToString (empty, 0, 0), "#E1");
#else
try {
BitConverter.ToString (empty, 0, 0);
Assert.Fail ("#E1");
} catch (ArgumentOutOfRangeException ex) {
// StartIndex cannot be less than zero
Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#E2");
Assert.IsNull (ex.InnerException, "#E3");
Assert.IsNotNull (ex.Message, "#E4");
Assert.IsNotNull (ex.ParamName, "#E5");
Assert.AreEqual ("startIndex", ex.ParamName, "#E6");
}
#endif
try {
BitConverter.ToString (empty, 3, -1);

View File

@@ -190,10 +190,18 @@ public class ByteTest
Assert.IsTrue (typeof(FormatException) == e.GetType(), NumberFormatInfo.CurrentInfo.CurrencySymbol+"42, NumberStyles.Integer, Nfi");
}
Assert.AreEqual (734, Int64.Parse ("734\0"), "#1");
Assert.AreEqual (734, Int64.Parse ("734\0\0\0 \0"), "#2");
Assert.AreEqual (734, Int64.Parse ("734\0\0\0 "), "#3");
Assert.AreEqual (734, Int64.Parse ("734\0\0\0"), "#4");
Assert.AreEqual (34, Byte.Parse ("34\0"), "#1");
try {
Byte.Parse ("34\0\0\0 \0");
Assert.Fail ("#2");
} catch (FormatException) {}
try {
Byte.Parse ("34\0\0\0 ");
Assert.Fail ("#3");
} catch (FormatException) {}
Assert.AreEqual (34, Byte.Parse ("34\0\0\0"), "#4");
}
[Test]

File diff suppressed because one or more lines are too long

View File

@@ -1 +0,0 @@
e42ae6ac9461f4aca246890a9e7fec7cf8be3839

View File

@@ -470,7 +470,6 @@ public class CharTest
case '\x85':
case '\xa0':
case '\x1680':
case '\x180e':
case '\x2000':
case '\x2001':
case '\x2002':
@@ -487,10 +486,10 @@ public class CharTest
case '\x202f':
case '\x205f':
case '\x3000':
Assert.IsTrue (char.IsWhiteSpace ((char)i), i.ToString ());
Assert.IsTrue (char.IsWhiteSpace ((char)i), "\\x" + i.ToString ("x"));
break;
default:
Assert.IsFalse (char.IsWhiteSpace ((char)i), i.ToString ());
Assert.IsFalse (char.IsWhiteSpace ((char)i), "\\x" + i.ToString ("x"));
break;
}
}

View File

@@ -1 +1 @@
8aee8a9cc657db1a0dc9cdd3bdeb26f77da10970
c97a0a31b7e8efef77818a2016c941aecbb73fcb

View File

@@ -261,8 +261,8 @@ namespace MonoTests.System {
[Test]
public void ParseExactCustomFormat ()
{
var dt = DateTimeOffset.ParseExact ("Sunday, 06-Nov-94 08:49:37 GMT", "dddd, dd'-'MMM'-'yy HH:mm:ss 'GMT'", CultureInfo.InvariantCulture);
Assert.AreEqual (new DateTimeOffset (1994, 11, 6, 8, 49, 37, TimeZone.CurrentTimeZone.GetUtcOffset (DateTime.Now)), dt);
var dt = DateTimeOffset.ParseExact ("Sunday, 06-Nov-94 08:49:37 GMT", "dddd, dd'-'MMM'-'yy HH:mm:ss 'GMT'", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal);
Assert.AreEqual (new DateTimeOffset (1994, 11, 6, 8, 49, 37, TimeSpan.Zero), dt);
}
[Test]
@@ -672,7 +672,7 @@ namespace MonoTests.System {
[Test]
public void TestPartialDateTimeParsing ()
{
var now = DateTime.Now;
var now = DateTime.UtcNow;
const DateTimeStyles style = DateTimeStyles.AssumeUniversal;
//year

View File

@@ -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]
@@ -1271,6 +1277,9 @@ namespace MonoTests.System
public void Parse_Bug53023b ()
{
foreach (CultureInfo ci in CultureInfo.GetCultures (CultureTypes.SpecificCultures)) {
if (ci.Name == "ar-SA")
continue;
try {
DateTime.Parse ("01-Sep-05", ci);
@@ -1511,7 +1520,7 @@ namespace MonoTests.System
d = new DateTime (599264352000000000);
Assert.AreEqual (0.0d, d.ToOADate (), "#2");
d = new DateTime (31242239136000000);
Assert.AreEqual (-657434.999d, d.ToOADate (), "#3");
Assert.AreEqual ("-657434.999", d.ToOADate ().ToString (), "#3");
d = new DateTime (3155378975136000000);
Assert.AreEqual (2958465.999d, d.ToOADate (), "#4");
}
@@ -1523,13 +1532,6 @@ namespace MonoTests.System
Assert.AreEqual (2958465.999d, d.ToOADate ());
}
[Test]
[Ignore ("This test is probably geo location dependent, at least fails on .NET 4.0 in Japan")]
public void ToOADate_MaxValue ()
{
Assert.AreEqual (2958465.99999999d, DateTime.MaxValue.ToOADate ());
}
[Test]
public void ToOADate_UnderMin ()
{
@@ -2619,5 +2621,13 @@ namespace MonoTests.System
string date = "2014-08-25T01:20:23.601911612343423423465789789365674575676746756747467%Z";
DateTime.Parse (date, CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind);
}
[Test]
public void Year_2 ()
{
var res = DateTime.Parse ("12-002", CultureInfo.InvariantCulture, DateTimeStyles.AllowWhiteSpaces | DateTimeStyles.RoundtripKind);
Assert.AreEqual (2, res.Year, "#1");
Assert.AreEqual (12, res.Month, "#2");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1563,6 +1563,55 @@ namespace MonoTests.System
Assert.AreEqual ("3", Math.Round (3M, 5).ToString (CultureInfo.InvariantCulture), "#1");
Assert.AreEqual ("3.01", Math.Round (3.01M, 5).ToString (CultureInfo.InvariantCulture), "#2");
Assert.AreEqual ("-3.01", Math.Round (-3.01M, 5).ToString (CultureInfo.InvariantCulture), "#3");
Assert.AreEqual ("128", Math.Round (127.5M, 0).ToString (CultureInfo.InvariantCulture), "#4");
}
[Test] // Bug Xamarin#14822
public void RoundToString_Bug14822 ()
{
decimal value = 1.600000m;
var roundedValue = Math.Round (value, 3);
Assert.AreEqual ("1.600", roundedValue.ToString (), "#1");
}
[Test] // Bug Xamarin#17538
public void BankerRounding ()
{
decimal dcm3 = 987654321098765432109876543.2m;
decimal dcm4 = 0.05m;
decimal dcm5 = dcm3 + dcm4;
Assert.AreEqual (987654321098765432109876543.2m, dcm5);
}
[Test] // Bug Xamarin #24411
[Category ("MobileNotWorking")] // Bug Xamarin #27269
public void DecimalDivision_24411 ()
{
decimal dd = 45m;
var x = dd / 100;
var bits = decimal.GetBits (x);
var flags = (uint) bits[3];
byte scale2 = (byte)(flags >> 16);
Assert.AreEqual (2, scale2);
// The side effect is that 45m/100 should render as 0.45, not 0.4500000000000000000000000000
// Just for completeness:
Assert.AreEqual ("0.45", (45m/100).ToString ());
}
[Test] // Bug SUSE #655780
[Category ("MobileNotWorking")] // Bug Xamarin #27269
public void TrailingZerosBug ()
{
decimal d;
Assert.AreEqual ("0", (0m/5).ToString ());
Assert.AreEqual ("0.2", (1m/5).ToString ());
Assert.AreEqual ("0.4", (2m/5).ToString ());
Assert.AreEqual ("0.6", (3m/5).ToString ());
Assert.AreEqual ("0.8", (4m/5).ToString ());
}
}
}

View File

@@ -1 +1 @@
aa39bad89918df73061366771587a9ed97b11252
02eacf31cdf3198ab2430b3f31ae5ab17acfb7f8

View File

@@ -17,7 +17,6 @@ namespace MonoTests.System
[TestFixture]
public class DelegateTest
{
#if NET_2_0
public class GenericClass<T> {
public void Method<K> (T t, K k) {}
@@ -51,7 +50,6 @@ namespace MonoTests.System
Assert.IsNotNull (method, "#1");
Assert.AreEqual (target, method, "#2");
}
#endif
[Test] // CreateDelegate (Type, MethodInfo)
public void CreateDelegate1_Method_Static ()
@@ -73,25 +71,11 @@ namespace MonoTests.System
{
C c = new C ();
MethodInfo mi = typeof (C).GetMethod ("M");
#if NET_2_0
Delegate dg = Delegate.CreateDelegate (typeof (D), mi);
Assert.AreSame (mi, dg.Method, "#1");
Assert.IsNull (dg.Target, "#2");
D d = (D) dg;
d (c);
#else
try {
Delegate.CreateDelegate (typeof (D), mi);
Assert.Fail ("#1");
} catch (ArgumentException ex) {
// Method must be a static method
Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
Assert.IsNull (ex.InnerException, "#3");
Assert.IsNotNull (ex.Message, "#4");
Assert.IsNotNull (ex.ParamName, "#5");
Assert.AreEqual ("method", ex.ParamName, "#6");
}
#endif
}
[Test] // CreateDelegate (Type, MethodInfo)
@@ -584,7 +568,6 @@ namespace MonoTests.System
}
}
#if NET_2_0
[Test] // CreateDelegate (Type, Object, String, Boolean, Boolean)
public void CreateDelegate9 ()
{
@@ -1177,7 +1160,6 @@ namespace MonoTests.System
throw new NotSupportedException ();
}
#endif
public static void CreateDelegateOfStaticMethodBoundToNull_Helper (object[] args) {}
[Test]

View File

@@ -294,6 +294,13 @@ namespace MonoTests.System
Assert.AreEqual ("Test", Enum.GetName (c.GetType (), d), "#E4");
}
[Test]
public void GetNameIdenticalToGetEnumName ()
{
Assert.AreEqual (typeof (EnumOverlap).GetEnumName (0), Enum.GetName (typeof(EnumOverlap), 0), "#1");
Assert.AreEqual ("First", Enum.GetName (typeof(EnumOverlap), 0), "#2");
}
[Test]
public void TestGetNames ()
{
@@ -628,11 +635,7 @@ namespace MonoTests.System
Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#G2");
Assert.IsNull (ex.InnerException, "#G3");
Assert.IsNotNull (ex.Message, "#G4");
#if NET_2_0
Assert.IsTrue (ex.Message.IndexOf ("'huh?'") != -1, "#G5");
#else
Assert.IsTrue (ex.Message.IndexOf ("huh?") != -1, "#G5");
#endif
Assert.IsNull (ex.ParamName, "#G6");
}
@@ -646,11 +649,7 @@ namespace MonoTests.System
Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#H2");
Assert.IsNull (ex.InnerException, "#H3");
Assert.IsNotNull (ex.Message, "#H4");
#if NET_2_0
Assert.IsTrue (ex.Message.IndexOf ("'test'") != -1, "#H5");
#else
Assert.IsTrue (ex.Message.IndexOf ("test") != -1, "#H5");
#endif
Assert.IsNull (ex.ParamName, "#H6");
}
@@ -749,9 +748,6 @@ namespace MonoTests.System
}
[Test]
#if ONLY_1_1
[Category ("NotDotNet")]
#endif
public void ToObject_EnumType_UInt64 ()
{
object value = Enum.ToObject (typeof (TestingEnum3), 0);
@@ -780,6 +776,20 @@ namespace MonoTests.System
Assert.AreEqual (TestingEnum5.Test, value, "#2");
}
[Test]
public void ToObject_EnumType_Bool ()
{
object value = Enum.ToObject (typeof (TestingEnum5), true);
Assert.AreEqual (TestingEnum5.Is, value, "#1");
}
[Test]
public void ToObject_EnumType_Char ()
{
object value = Enum.ToObject (typeof (TestingEnum3), (object) '\0');
Assert.AreEqual (TestingEnum3.This, value, "#1");
}
[Test]
public void ToObject_EnumType_Invalid ()
{
@@ -1139,6 +1149,24 @@ namespace MonoTests.System
}
#endif
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void HasFlagNull ()
{
SomeEnum x = SomeEnum.a;
x.HasFlag (null);
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void HasFlagWrongType ()
{
SomeEnum x = SomeEnum.a;
x.HasFlag (SomeByteEnum.a);
}
[Flags]
enum SomeEnum
{
@@ -1394,6 +1422,12 @@ namespace MonoTests.System
ulong_Ee = 0x7FFFFFFFffffffff,
ulong_Ff = 100
}
enum EnumOverlap
{
Unknown = 0,
First = 0,
System_Math = First,
}
}
}

View File

@@ -138,7 +138,7 @@ namespace MonoTests.System
Assert.IsFalse (d.IsSynchronized, "IsSynchronized");
}
#if NET_2_0 && !NET_2_1
#if !NET_2_1
[Test] // bug #333740
public void GetEnvironmentVariables_NewlySet ()
{
@@ -161,7 +161,7 @@ namespace MonoTests.System
Assert.IsNotNull (args [0], "application");
}
#if NET_2_0 && !NET_2_1
#if !NET_2_1
[Test]
[ExpectedException (typeof (ArgumentException))]
public void GetEnvironmentVariable_Target_Invalid ()

Some files were not shown because too many files have changed in this diff Show More