[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dotgnu-pnet-commits] pnetlib ChangeLog resources/en_US/runtime/Arg.t...
From: |
Klaus Treichel |
Subject: |
[dotgnu-pnet-commits] pnetlib ChangeLog resources/en_US/runtime/Arg.t... |
Date: |
Sun, 15 Feb 2009 15:56:53 +0000 |
CVSROOT: /cvsroot/dotgnu-pnet
Module name: pnetlib
Changes by: Klaus Treichel <ktreichel> 09/02/15 15:56:53
Modified files:
. : ChangeLog
resources/en_US/runtime: Arg.txt
runtime/System : Boolean.cs Byte.cs Char.cs CharEnumerator.cs
DateTime.cs Double.cs Guid.cs Int16.cs Int32.cs
Int64.cs IntPtr.cs SByte.cs Single.cs String.cs
UInt16.cs UInt32.cs UInt64.cs Version.cs
tests/runtime/System: SuiteSystem.cs TestDouble.cs
Added files:
tests/runtime/System: TestChar.cs TestSingle.cs
System : GenericUriParserOptions.cs
Log message:
Add more 2.0 stuff.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pnetlib/ChangeLog?cvsroot=dotgnu-pnet&r1=1.2557&r2=1.2558
http://cvs.savannah.gnu.org/viewcvs/pnetlib/resources/en_US/runtime/Arg.txt?cvsroot=dotgnu-pnet&r1=1.50&r2=1.51
http://cvs.savannah.gnu.org/viewcvs/pnetlib/runtime/System/Boolean.cs?cvsroot=dotgnu-pnet&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/pnetlib/runtime/System/Byte.cs?cvsroot=dotgnu-pnet&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/pnetlib/runtime/System/Char.cs?cvsroot=dotgnu-pnet&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/pnetlib/runtime/System/CharEnumerator.cs?cvsroot=dotgnu-pnet&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/pnetlib/runtime/System/DateTime.cs?cvsroot=dotgnu-pnet&r1=1.29&r2=1.30
http://cvs.savannah.gnu.org/viewcvs/pnetlib/runtime/System/Double.cs?cvsroot=dotgnu-pnet&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/pnetlib/runtime/System/Guid.cs?cvsroot=dotgnu-pnet&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/pnetlib/runtime/System/Int16.cs?cvsroot=dotgnu-pnet&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/pnetlib/runtime/System/Int32.cs?cvsroot=dotgnu-pnet&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/pnetlib/runtime/System/Int64.cs?cvsroot=dotgnu-pnet&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/pnetlib/runtime/System/IntPtr.cs?cvsroot=dotgnu-pnet&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/pnetlib/runtime/System/SByte.cs?cvsroot=dotgnu-pnet&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/pnetlib/runtime/System/Single.cs?cvsroot=dotgnu-pnet&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/pnetlib/runtime/System/String.cs?cvsroot=dotgnu-pnet&r1=1.43&r2=1.44
http://cvs.savannah.gnu.org/viewcvs/pnetlib/runtime/System/UInt16.cs?cvsroot=dotgnu-pnet&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/pnetlib/runtime/System/UInt32.cs?cvsroot=dotgnu-pnet&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/pnetlib/runtime/System/UInt64.cs?cvsroot=dotgnu-pnet&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/pnetlib/runtime/System/Version.cs?cvsroot=dotgnu-pnet&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/pnetlib/tests/runtime/System/SuiteSystem.cs?cvsroot=dotgnu-pnet&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/pnetlib/tests/runtime/System/TestDouble.cs?cvsroot=dotgnu-pnet&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/pnetlib/tests/runtime/System/TestChar.cs?cvsroot=dotgnu-pnet&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/pnetlib/tests/runtime/System/TestSingle.cs?cvsroot=dotgnu-pnet&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/pnetlib/System/GenericUriParserOptions.cs?cvsroot=dotgnu-pnet&rev=1.1
Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/ChangeLog,v
retrieving revision 1.2557
retrieving revision 1.2558
diff -u -b -r1.2557 -r1.2558
--- ChangeLog 3 Feb 2009 20:13:18 -0000 1.2557
+++ ChangeLog 15 Feb 2009 15:56:51 -0000 1.2558
@@ -1,3 +1,46 @@
+2009-02-15 Klaus Treichel <address@hidden>
+
+ * resources/en_US/runtime/Arg.txt: Add messages for Exceptions thrown
+ because of invalid high- and low surrogates.
+
+ * runtime/System/Boolean.cs, runtime/System/Byte.cs,
+ runtime/System/Char.cs, runtime/System/DateTime.cs,
+ runtime/System/Double.cs, runtime/System/Guid.cs,
+ runtime/System/Int16.cs, runtime/System/Int32.cs,
+ runtime/System/Int64.cs, runtime/System/SByte.cs,
+ runtime/System/Single.cs, runtime/System/String.cs,
+ runtime/System/UInt16.cs, runtime/System/UInt32.cs,
+ runtime/System/UInt64.cs, runtime/System/Version.cs: Add in 2.0 ECMA
+ implemented generic interfaces IComparable<T> and IEquatable<T> and the
+ implementing methods.
+ Add missing non ECMA 2.0 attributes ComVisible(true) and Serializable
+ where missing.
+
+ * runtime/System/Char.cs: Add some 2.0 non ECMA functions.
+ Replace lots of comparisions by switch statements in unicode category
+ check functions.
+
+ * runtime/System/CharEnumerator.cs: Add the generic 2.0
IEnumerator<char>
+ to the implemented interface for non ECMA builds.
+
+ * runtime/System/Double.cs (IsNaN): Replace the internal call for IsNaN
+ with a check if a compare with itself yields false.
+
+ * runtime/System/IntPtr.cs: Add missing non ECMA 2.0 attributes
+ ComVisible(true) and Serializable
+
+ * runtime/System/Single.cs (IsNaN): Replace the internal call for IsNaN
+ with a check if a compare with itself yields false.
+
+ * System/GenericUriParserOptions.cs: Add non ECMA 2.0 enumeration.
+
+ * tests/runtime/System/SuiteSystem.cs: Add the new tests to the suite.
+
+ * tests/runtime/System/TestDouble.cs: Add tests for the IsNaN method.
+
+ * tests/runtime/System/TestChar.cs, tests/runtime/System/TestSingle.cs:
+ Add testcases for the System.Char and System.Single classes.
+
2009-02-03 Klaus Treichel <address@hidden>
* runtime/System/Reflection/AssemblyNameFlags.cs: Add new 2.0 members.
@@ -215,7 +258,7 @@
* runtime/System/AppDomain.c, runtime/System/AppDomain.c: Replace the
IntPtr appdomain with an Object AppDomain to prevent the process from
- veing collected while an AppDomain still exists.
+ being collected while an AppDomain still exists.
* runtime/System/AppDomain.c: Use the new internal call for retrieving
the id of the process.
Index: resources/en_US/runtime/Arg.txt
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/resources/en_US/runtime/Arg.txt,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -b -r1.50 -r1.51
--- resources/en_US/runtime/Arg.txt 17 Aug 2008 16:43:42 -0000 1.50
+++ resources/en_US/runtime/Arg.txt 15 Feb 2009 15:56:52 -0000 1.51
@@ -140,6 +140,8 @@
Arg_InvalidRegex=Invalid regular expression
Arg_ResourceAlreadyPresent=The specified resource is already present
Arg_InvalidColor=Invalid console color value
+Arg_LowSurrogate=Invalid low surrogate
+Arg_HighSurrogate=Invalid high surrogate
ArgRange_DecimalScale=Decimal scale factor must be between 0 and 28, inclusive
ArgRange_YMD=Year, month, day specification is out of range
ArgRange_HMS=Hour, minute, second specification is out of range
@@ -175,3 +177,5 @@
ArgRange_Width=Width is out of range
ArgRange_Height=Height is out of range
ArgRange_CursorSize=Cursor size must be between 1 and 100
+ArgRange_LowSurrogate=Value must be a valid low surrogate
+ArgRange_HighSurrogate=Value must be a valid high surrogate
Index: runtime/System/Boolean.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Boolean.cs,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- runtime/System/Boolean.cs 27 Sep 2004 06:57:55 -0000 1.8
+++ runtime/System/Boolean.cs 15 Feb 2009 15:56:52 -0000 1.9
@@ -21,10 +21,19 @@
namespace System
{
+#if !ECMA_COMPAT && CONFIG_FRAMEWORK_2_0
+using System.Runtime.InteropServices;
+
+[ComVisible(true)]
+[Serializable]
+#endif
public struct Boolean : IComparable
#if !ECMA_COMPAT
, IConvertible
#endif
+#if CONFIG_FRAMEWORK_2_0
+ , IComparable<bool>, IEquatable<bool>
+#endif
{
private bool value_;
@@ -115,6 +124,26 @@
}
}
+#if CONFIG_FRAMEWORK_2_0
+
+ // Implementation of the IComparable<bool> interface.
+ public int CompareTo(bool value)
+ {
+ if(value_)
+ {
+ return value.value_ ? 0 : 1;
+ }
+ return value.value_ ? -1 : 0;
+ }
+
+ // Implementation of the IEquatable<bool> interface.
+ public bool Equals(bool obj)
+ {
+ return (value_ == obj.value_);
+ }
+
+#endif // CONFIG_FRAMEWORK_2_0
+
#if !ECMA_COMPAT
// Implementation of the IConvertible interface.
Index: runtime/System/Byte.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Byte.cs,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- runtime/System/Byte.cs 25 May 2007 05:49:26 -0000 1.10
+++ runtime/System/Byte.cs 15 Feb 2009 15:56:52 -0000 1.11
@@ -25,10 +25,19 @@
using System.Private.NumberFormat;
using System.Globalization;
+#if !ECMA_COMPAT && CONFIG_FRAMEWORK_2_0
+using System.Runtime.InteropServices;
+
+[ComVisible(true)]
+[Serializable]
+#endif
public struct Byte : IComparable, IFormattable
#if !ECMA_COMPAT
, IConvertible
#endif
+#if CONFIG_FRAMEWORK_2_0
+ , IComparable<byte>, IEquatable<byte>
+#endif
{
private byte value_;
@@ -106,6 +115,22 @@
}
}
+#if CONFIG_FRAMEWORK_2_0
+
+ // Implementation of the IComparable<byte> interface.
+ public int CompareTo(byte value)
+ {
+ return (int)value_ - (int)(value.value_);
+ }
+
+ // Implementation of the IEquatable<byte> interface.
+ public bool Equals(byte obj)
+ {
+ return (value_ == obj.value_);
+ }
+
+#endif // CONFIG_FRAMEWORK_2_0
+
#if !ECMA_COMPAT
// Implementation of the IConvertible interface.
Index: runtime/System/Char.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Char.cs,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- runtime/System/Char.cs 5 Jun 2003 02:28:33 -0000 1.8
+++ runtime/System/Char.cs 15 Feb 2009 15:56:52 -0000 1.9
@@ -23,10 +23,19 @@
using System.Globalization;
+#if !ECMA_COMPAT && CONFIG_FRAMEWORK_2_0
+using System.Runtime.InteropServices;
+
+[ComVisible(true)]
+[Serializable]
+#endif
public struct Char : IComparable
#if !ECMA_COMPAT
, IConvertible
#endif
+#if CONFIG_FRAMEWORK_2_0
+ , IComparable<char>, IEquatable<char>
+#endif
{
private char value_;
@@ -101,6 +110,22 @@
}
}
+#if CONFIG_FRAMEWORK_2_0
+
+ // Implementation of the IComparable<char> interface.
+ public int CompareTo(char value)
+ {
+ return ((int)value_) - ((int)(value.value_));
+ }
+
+ // Implementation of the IEquatable<char> interface.
+ public bool Equals(char obj)
+ {
+ return (value_ == obj.value_);
+ }
+
+#endif // CONFIG_FRAMEWORK_2_0
+
#if !ECMA_COMPAT
// Implementation of IConvertible interface.
@@ -242,11 +267,23 @@
public static bool IsLetter(char c)
{
UnicodeCategory category =
GetUnicodeCategory(c);
- return (category ==
UnicodeCategory.UppercaseLetter ||
- category ==
UnicodeCategory.LowercaseLetter ||
- category ==
UnicodeCategory.TitlecaseLetter ||
- category ==
UnicodeCategory.ModifierLetter ||
- category ==
UnicodeCategory.OtherLetter);
+
+ switch(category)
+ {
+ case UnicodeCategory.UppercaseLetter:
+ case UnicodeCategory.LowercaseLetter:
+ case UnicodeCategory.TitlecaseLetter:
+ case UnicodeCategory.ModifierLetter:
+ case UnicodeCategory.OtherLetter:
+ {
+ return true;
+ }
+
+ default:
+ {
+ return false;
+ }
+ }
}
public static bool IsLetter(String s, int index)
{
@@ -259,12 +296,24 @@
public static bool IsLetterOrDigit(char c)
{
UnicodeCategory category =
GetUnicodeCategory(c);
- return (category ==
UnicodeCategory.UppercaseLetter ||
- category ==
UnicodeCategory.LowercaseLetter ||
- category ==
UnicodeCategory.TitlecaseLetter ||
- category ==
UnicodeCategory.ModifierLetter ||
- category ==
UnicodeCategory.OtherLetter ||
- category ==
UnicodeCategory.DecimalDigitNumber);
+
+ switch(category)
+ {
+ case UnicodeCategory.UppercaseLetter:
+ case UnicodeCategory.LowercaseLetter:
+ case UnicodeCategory.TitlecaseLetter:
+ case UnicodeCategory.ModifierLetter:
+ case UnicodeCategory.OtherLetter:
+ case UnicodeCategory.DecimalDigitNumber:
+ {
+ return true;
+ }
+
+ default:
+ {
+ return false;
+ }
+ }
}
public static bool IsLetterOrDigit(String s, int index)
{
@@ -287,9 +336,21 @@
public static bool IsNumber(char c)
{
UnicodeCategory category =
GetUnicodeCategory(c);
- return (category ==
UnicodeCategory.DecimalDigitNumber ||
- category ==
UnicodeCategory.LetterNumber ||
- category ==
UnicodeCategory.OtherNumber);
+
+ switch(category)
+ {
+ case UnicodeCategory.DecimalDigitNumber:
+ case UnicodeCategory.LetterNumber:
+ case UnicodeCategory.OtherNumber:
+ {
+ return true;
+ }
+
+ default:
+ {
+ return false;
+ }
+ }
}
public static bool IsNumber(String s, int index)
{
@@ -302,13 +363,25 @@
public static bool IsPunctuation(char c)
{
UnicodeCategory category =
GetUnicodeCategory(c);
- return (category ==
UnicodeCategory.ConnectorPunctuation ||
- category ==
UnicodeCategory.DashPunctuation ||
- category ==
UnicodeCategory.OpenPunctuation ||
- category ==
UnicodeCategory.ClosePunctuation ||
- category ==
UnicodeCategory.InitialQuotePunctuation ||
- category ==
UnicodeCategory.FinalQuotePunctuation ||
- category ==
UnicodeCategory.OtherPunctuation);
+
+ switch(category)
+ {
+ case
UnicodeCategory.ConnectorPunctuation:
+ case UnicodeCategory.DashPunctuation:
+ case UnicodeCategory.OpenPunctuation:
+ case UnicodeCategory.ClosePunctuation:
+ case
UnicodeCategory.InitialQuotePunctuation:
+ case
UnicodeCategory.FinalQuotePunctuation:
+ case UnicodeCategory.OtherPunctuation:
+ {
+ return true;
+ }
+
+ default:
+ {
+ return false;
+ }
+ }
}
public static bool IsPunctuation(String s, int index)
{
@@ -321,9 +394,21 @@
public static bool IsSeparator(char c)
{
UnicodeCategory category =
GetUnicodeCategory(c);
- return (category ==
UnicodeCategory.SpaceSeparator ||
- category ==
UnicodeCategory.LineSeparator ||
- category ==
UnicodeCategory.ParagraphSeparator);
+
+ switch(category)
+ {
+ case UnicodeCategory.SpaceSeparator:
+ case UnicodeCategory.LineSeparator:
+ case UnicodeCategory.ParagraphSeparator:
+ {
+ return true;
+ }
+
+ default:
+ {
+ return false;
+ }
+ }
}
public static bool IsSeparator(String s, int index)
{
@@ -346,10 +431,22 @@
public static bool IsSymbol(char c)
{
UnicodeCategory category =
GetUnicodeCategory(c);
- return (category == UnicodeCategory.MathSymbol
||
- category ==
UnicodeCategory.CurrencySymbol ||
- category ==
UnicodeCategory.ModifierSymbol ||
- category ==
UnicodeCategory.OtherSymbol);
+
+ switch(category)
+ {
+ case UnicodeCategory.MathSymbol:
+ case UnicodeCategory.CurrencySymbol:
+ case UnicodeCategory.ModifierSymbol:
+ case UnicodeCategory.OtherSymbol:
+ {
+ return true;
+ }
+
+ default:
+ {
+ return false;
+ }
+ }
}
public static bool IsSymbol(String s, int index)
{
@@ -421,7 +518,154 @@
throw new
ArgumentNullException("culture");
}
}
-#endif
+
+#if CONFIG_FRAMEWORK_2_0
+ public static bool IsHighSurrogate(char c)
+ {
+ return ((c >= 0xd800) && (c <= 0xdbff));
+ }
+
+ public static bool IsHighSurrogate(string s, int index)
+ {
+ if(s == null)
+ {
+ throw new ArgumentNullException("s");
+ }
+ if(index < 0 || index >= s.Length)
+ {
+ throw new ArgumentOutOfRangeException
+ ("index",
_("ArgRange_StringIndex"));
+ }
+ return IsHighSurrogate(s[index]);
+ }
+
+ public static bool IsLowSurrogate(char c)
+ {
+ return ((c >= 0xdc00) && (c <= 0xdfff));
+ }
+
+ public static bool IsLowSurrogate(string s, int index)
+ {
+ if(s == null)
+ {
+ throw new ArgumentNullException("s");
+ }
+ if(index < 0 || index >= s.Length)
+ {
+ throw new ArgumentOutOfRangeException
+ ("index",
_("ArgRange_StringIndex"));
+ }
+ return IsLowSurrogate(s[index]);
+ }
+
+ public static bool IsSurrogatePair(char highSurrogate, char
lowSurrogate)
+ {
+ return (IsHighSurrogate(highSurrogate) &&
+ IsLowSurrogate(lowSurrogate));
+ }
+
+ public static bool IsSurrogatePair(string s, int index)
+ {
+ if(s == null)
+ {
+ throw new ArgumentNullException("s");
+ }
+ if(index < 0 || index >= s.Length)
+ {
+ throw new ArgumentOutOfRangeException
+ ("index",
_("ArgRange_StringIndex"));
+ }
+ if(IsHighSurrogate(s[index]))
+ {
+ if(index + 1 < s.Length)
+ {
+ return IsLowSurrogate(s[index +
1]);
+ }
+ }
+ return false;
+ }
+
+ public static char ToLowerInvariant(char c)
+ {
+ return ToLower(c, CultureInfo.InvariantCulture);
+ }
+
+ public static char ToUpperInvariant(char c)
+ {
+ return ToUpper(c, CultureInfo.InvariantCulture);
+ }
+
+ public static bool TryParse(string s, out char result)
+ {
+ if(s != null)
+ {
+ if(s.Length == 1)
+ {
+ result = s[0];
+ return true;
+ }
+ }
+ return false;
+ }
+
+#if !CONFIG_COMPACT_FRAMEWORK
+ public static int ConvertToUtf32(char highSurrogate, char lowSurrogate)
+ {
+ if(!IsHighSurrogate(highSurrogate))
+ {
+ throw new ArgumentOutOfRangeException
+ ("highSurrogate",
_("ArgRange_HighSurrogate"));
+ }
+ if(!IsLowSurrogate(lowSurrogate))
+ {
+ throw new ArgumentOutOfRangeException
+ ("lowSurrogate",
_("ArgRange_LowSurrogate"));
+ }
+ return ((((int)highSurrogate & 0x3ff) << 10) |
+ ((int)lowSurrogate & 0x3ff)) +
0x10000;
+ }
+
+ public static int ConvertToUtf32(string s, int index)
+ {
+ int char0;
+ int char1;
+
+ if(s == null)
+ {
+ throw new ArgumentNullException("s");
+ }
+ if(index < 0 || index >= s.Length)
+ {
+ throw new ArgumentOutOfRangeException
+ ("index",
_("ArgRange_StringIndex"));
+ }
+ char0 = s[index];
+ // Check if the character is no surrogate
+ if(char0 < 0xd800 || char0 >= 0xe000)
+ {
+ return char0;
+ }
+ if(char0 > 0xdbff)
+ {
+ throw new
ArgumentException(_("Arg_LowSurrogate"));
+ }
+ if(index >= s.Length - 1)
+ {
+ throw new
ArgumentException(_("Arg_HighSurrogate"));
+ }
+ char1 = s[index + 1];
+ // Check if the character is a high surrogate
+ if(char1 < 0xdc00 || char1 >= 0xe000)
+ {
+ throw new
ArgumentException(_("Arg_HighSurrogate"));
+ }
+ return (((char1 & 0x3ff) << 10) |
+ (char0 & 0x3ff)) + 0x10000;
+ }
+
+#endif // !CONFIG_COMPACT_FRAMEWORK
+#endif // CONFIG_FRAMEWORK_2_0
+#endif // !ECMA_COMPAT
}; // class Char
Index: runtime/System/CharEnumerator.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/CharEnumerator.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- runtime/System/CharEnumerator.cs 28 Nov 2001 04:22:39 -0000 1.3
+++ runtime/System/CharEnumerator.cs 15 Feb 2009 15:56:52 -0000 1.4
@@ -22,8 +22,14 @@
{
using System.Collections;
+#if !ECMA_COMPAT && CONFIG_FRAMEWORK_2_0
+using System.Collections.Generic;
+#endif
public sealed class CharEnumerator : IEnumerator, ICloneable
+#if !ECMA_COMPAT && CONFIG_FRAMEWORK_2_0
+ , IEnumerator<char>
+#endif
{
// Internal state for the enumerator.
String str;
@@ -87,6 +93,15 @@
}
}
+#if !ECMA_COMPAT && CONFIG_FRAMEWORK_2_0
+
+ void IDisposable.Dispose()
+ {
+ // Nothing to do here
+ }
+
+#endif // !ECMA_COMPAT && CONFIG_FRAMEWORK_2_0
+
}; // class CharEnumerator
}; // namespace System
Index: runtime/System/DateTime.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/DateTime.cs,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- runtime/System/DateTime.cs 3 Feb 2006 06:28:59 -0000 1.29
+++ runtime/System/DateTime.cs 15 Feb 2009 15:56:52 -0000 1.30
@@ -34,6 +34,9 @@
#if !ECMA_COMPAT
, IConvertible
#endif
+#if CONFIG_FRAMEWORK_2_0
+ , IComparable<DateTime>, IEquatable<DateTime>
+#endif
{
private long value_;
@@ -339,6 +342,16 @@
return (d1.value_ == d2.value_);
}
+#if CONFIG_FRAMEWORK_2_0
+
+ // Implementation of the IEquatable<DateTime> interface.
+ public bool Equals(DateTime obj)
+ {
+ return (value_ == obj.value_);
+ }
+
+#endif // CONFIG_FRAMEWORK_2_0
+
// String conversion.
public override String ToString()
{
@@ -448,6 +461,27 @@
}
}
+#if CONFIG_FRAMEWORK_2_0
+
+ // Implementation of the IComparable<DateTime> interface.
+ public int CompareTo(DateTime value)
+ {
+ if(value_ < value.value_)
+ {
+ return -1;
+ }
+ else if(value_ > value.value_)
+ {
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+#endif // CONFIG_FRAMEWORK_2_0
+
#if !ECMA_COMPAT
// Implementation of IConvertible interface.
Index: runtime/System/Double.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Double.cs,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- runtime/System/Double.cs 25 May 2007 05:49:26 -0000 1.16
+++ runtime/System/Double.cs 15 Feb 2009 15:56:52 -0000 1.17
@@ -28,10 +28,19 @@
using System.Globalization;
using System.Runtime.CompilerServices;
+#if !ECMA_COMPAT && CONFIG_FRAMEWORK_2_0
+using System.Runtime.InteropServices;
+
+[ComVisible(true)]
+[Serializable]
+#endif
public struct Double : IComparable, IFormattable
#if !ECMA_COMPAT
, IConvertible
#endif
+#if CONFIG_FRAMEWORK_2_0
+ , IComparable<double>, IEquatable<double>
+#endif
{
private double value_;
@@ -78,8 +87,11 @@
}
// Value testing methods.
- [MethodImpl(MethodImplOptions.InternalCall)]
- extern public static bool IsNaN(double d);
+ public static bool IsNaN(double d)
+ {
+ // Comparing a NaN with any other value yields
false.
+ return (d != d);
+ }
[MethodImpl(MethodImplOptions.InternalCall)]
extern private static int TestInfinity(double d);
@@ -245,6 +257,50 @@
}
}
+#if CONFIG_FRAMEWORK_2_0
+
+ // Implementation of the IComparable<double> interface.
+ public int CompareTo(double value)
+ {
+ if(value_ == value)
+ {
+ return 0;
+ }
+ else if(IsNaN(value_))
+ {
+ if(IsNaN(value))
+ {
+ return 0;
+ }
+ else
+ {
+ return -1;
+ }
+ }
+ else if(value_ < value)
+ {
+ return -1;
+ }
+ else if(value_ > value)
+ {
+ return 1;
+ }
+ else
+ {
+ return 1;
+ }
+ }
+
+ // Implementation of the IEquatable<double> interface.
+ public bool Equals(double obj)
+ {
+ // We have to handle NaN values especially
+ return ((value_ == obj.value_) ||
+ (IsNaN(this) && IsNaN(obj)));
+ }
+
+#endif // CONFIG_FRAMEWORK_2_0
+
#if !ECMA_COMPAT
// Implementation of the IConvertible interface.
Index: runtime/System/Guid.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Guid.cs,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- runtime/System/Guid.cs 14 Apr 2003 06:38:39 -0000 1.7
+++ runtime/System/Guid.cs 15 Feb 2009 15:56:52 -0000 1.8
@@ -26,7 +26,16 @@
using System.Runtime.CompilerServices;
using System.Text;
+#if CONFIG_FRAMEWORK_2_0
+using System.Runtime.InteropServices;
+
+[ComVisible(true)]
+[Serializable]
+#endif
public struct Guid : IFormattable, IComparable
+#if CONFIG_FRAMEWORK_2_0
+ , IComparable<Guid>, IEquatable<Guid>
+#endif
{
// The empty GUID.
public static readonly Guid Empty;
@@ -424,6 +433,104 @@
}
}
+#if CONFIG_FRAMEWORK_2_0
+
+ // Implementation of the IComparable<Guid> interface.
+ public int CompareTo(Guid value)
+ {
+ if(((uint)a__) < ((uint)(value.a__)))
+ {
+ return -1;
+ }
+ else if(((uint)a__) > ((uint)(value.a__)))
+ {
+ return 1;
+ }
+ if(((ushort)b__) < ((ushort)(value.b__)))
+ {
+ return -1;
+ }
+ else if(((ushort)b__) > ((ushort)(value.b__)))
+ {
+ return 1;
+ }
+ if(((ushort)c__) < ((ushort)(value.c__)))
+ {
+ return -1;
+ }
+ else if(((ushort)c__) > ((ushort)(value.c__)))
+ {
+ return 1;
+ }
+ if(d__ < value.d__)
+ {
+ return -1;
+ }
+ else if(d__ > value.d__)
+ {
+ return 1;
+ }
+ if(e__ < value.e__)
+ {
+ return -1;
+ }
+ else if(e__ > value.e__)
+ {
+ return 1;
+ }
+ if(f__ < value.f__)
+ {
+ return -1;
+ }
+ else if(f__ > value.f__)
+ {
+ return 1;
+ }
+ if(g__ < value.g__)
+ {
+ return -1;
+ }
+ else if(g__ > value.g__)
+ {
+ return 1;
+ }
+ if(h__ < value.h__)
+ {
+ return -1;
+ }
+ else if(h__ > value.h__)
+ {
+ return 1;
+ }
+ if(i__ < value.i__)
+ {
+ return -1;
+ }
+ else if(i__ > value.i__)
+ {
+ return 1;
+ }
+ if(j__ < value.j__)
+ {
+ return -1;
+ }
+ else if(j__ > value.j__)
+ {
+ return 1;
+ }
+ if(k__ < value.k__)
+ {
+ return -1;
+ }
+ else if(k__ > value.k__)
+ {
+ return 1;
+ }
+ return 0;
+ }
+
+#endif // CONFIG_FRAMEWORK_2_0
+
// Determine if two Guid objects are equal.
public override bool Equals(Object obj)
{
@@ -448,6 +555,26 @@
}
}
+#if CONFIG_FRAMEWORK_2_0
+
+ // Implementation of the IEquatable<Guid> interface.
+ public bool Equals(Guid obj)
+ {
+ return (a__ == obj.a__ &&
+ b__ == obj.b__ &&
+ c__ == obj.c__ &&
+ d__ == obj.d__ &&
+ e__ == obj.e__ &&
+ f__ == obj.f__ &&
+ g__ == obj.g__ &&
+ h__ == obj.h__ &&
+ i__ == obj.i__ &&
+ j__ == obj.j__ &&
+ k__ == obj.k__);
+ }
+
+#endif // CONFIG_FRAMEWORK_2_0
+
// Get a hash code for this Guid object.
public override int GetHashCode()
{
Index: runtime/System/Int16.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Int16.cs,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- runtime/System/Int16.cs 25 May 2007 05:49:26 -0000 1.12
+++ runtime/System/Int16.cs 15 Feb 2009 15:56:52 -0000 1.13
@@ -25,10 +25,19 @@
using System.Private.NumberFormat;
using System.Globalization;
+#if !ECMA_COMPAT && CONFIG_FRAMEWORK_2_0
+using System.Runtime.InteropServices;
+
+[ComVisible(true)]
+[Serializable]
+#endif
public struct Int16 : IComparable, IFormattable
#if !ECMA_COMPAT
, IConvertible
#endif
+#if CONFIG_FRAMEWORK_2_0
+ , IComparable<short>, IEquatable<short>
+#endif
{
private short value_;
@@ -109,6 +118,22 @@
}
}
+#if CONFIG_FRAMEWORK_2_0
+
+ // Implementation of the IComparable<short> interface.
+ public int CompareTo(short value)
+ {
+ return ((int)value_) - ((int)value.value_);
+ }
+
+ // Implementation of the IEquatable<short> interface.
+ public bool Equals(short obj)
+ {
+ return (value_ == obj.value_);
+ }
+
+#endif // CONFIG_FRAMEWORK_2_0
+
#if !ECMA_COMPAT
// Implementation of the IConvertible interface.
Index: runtime/System/Int32.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Int32.cs,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- runtime/System/Int32.cs 25 May 2007 05:49:26 -0000 1.14
+++ runtime/System/Int32.cs 15 Feb 2009 15:56:52 -0000 1.15
@@ -25,10 +25,19 @@
using System.Private.NumberFormat;
using System.Globalization;
+#if !ECMA_COMPAT && CONFIG_FRAMEWORK_2_0
+using System.Runtime.InteropServices;
+
+[ComVisible(true)]
+[Serializable]
+#endif
public struct Int32 : IComparable, IFormattable
#if !ECMA_COMPAT
, IConvertible
#endif
+#if CONFIG_FRAMEWORK_2_0
+ , IComparable<int>, IEquatable<int>
+#endif
{
private int value_;
@@ -118,6 +127,22 @@
}
}
+#if CONFIG_FRAMEWORK_2_0
+
+ // Implementation of the IComparable<int> interface.
+ public int CompareTo(int value)
+ {
+ return (value_ - value.value_);
+ }
+
+ // Implementation of the IEquatable<int> interface.
+ public bool Equals(int obj)
+ {
+ return (value_ == obj.value_);
+ }
+
+#endif // CONFIG_FRAMEWORK_2_0
+
#if !ECMA_COMPAT
// Implementation of the IConvertible interface.
Index: runtime/System/Int64.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Int64.cs,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- runtime/System/Int64.cs 25 May 2007 05:49:26 -0000 1.11
+++ runtime/System/Int64.cs 15 Feb 2009 15:56:52 -0000 1.12
@@ -25,10 +25,19 @@
using System.Private.NumberFormat;
using System.Globalization;
+#if !ECMA_COMPAT && CONFIG_FRAMEWORK_2_0
+using System.Runtime.InteropServices;
+
+[ComVisible(true)]
+[Serializable]
+#endif
public struct Int64 : IComparable, IFormattable
#if !ECMA_COMPAT
, IConvertible
#endif
+#if CONFIG_FRAMEWORK_2_0
+ , IComparable<long>, IEquatable<long>
+#endif
{
private long value_;
@@ -120,6 +129,33 @@
}
}
+#if CONFIG_FRAMEWORK_2_0
+
+ // Implementation of the IComparable<long> interface.
+ public int CompareTo(long value)
+ {
+ if(value_ < value.value_)
+ {
+ return -1;
+ }
+ else if(value_ > value.value_)
+ {
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ // Implementation of the IEquatable<long> interface.
+ public bool Equals(long obj)
+ {
+ return (value_ == obj.value_);
+ }
+
+#endif // CONFIG_FRAMEWORK_2_0
+
#if !ECMA_COMPAT
// Implementation of the IConvertible interface.
Index: runtime/System/IntPtr.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/IntPtr.cs,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- runtime/System/IntPtr.cs 26 May 2003 04:41:21 -0000 1.9
+++ runtime/System/IntPtr.cs 15 Feb 2009 15:56:52 -0000 1.10
@@ -25,6 +25,12 @@
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
+#if !ECMA_COMPAT && CONFIG_FRAMEWORK_2_0
+using System.Runtime.InteropServices;
+
+[ComVisible(true)]
+[Serializable]
+#endif
public struct IntPtr
#if CONFIG_SERIALIZATION
: ISerializable
Index: runtime/System/SByte.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/SByte.cs,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- runtime/System/SByte.cs 25 May 2007 05:49:26 -0000 1.11
+++ runtime/System/SByte.cs 15 Feb 2009 15:56:52 -0000 1.12
@@ -30,6 +30,9 @@
#if !ECMA_COMPAT
, IConvertible
#endif
+#if CONFIG_FRAMEWORK_2_0
+ , IComparable<sbyte>, IEquatable<sbyte>
+#endif
{
private sbyte value_;
@@ -113,6 +116,22 @@
}
}
+#if CONFIG_FRAMEWORK_2_0
+
+ // Implementation of the IComparable<sbyte> interface.
+ public int CompareTo(sbyte value)
+ {
+ return ((int)value_ - (int)value.value_);
+ }
+
+ // Implementation of the IEquatable<sbyte> interface.
+ public bool Equals(sbyte obj)
+ {
+ return (value_ == obj.value_);
+ }
+
+#endif // CONFIG_FRAMEWORK_2_0
+
#if !ECMA_COMPAT
// Implementation of the IConvertible interface.
Index: runtime/System/Single.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Single.cs,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- runtime/System/Single.cs 25 May 2007 05:49:26 -0000 1.11
+++ runtime/System/Single.cs 15 Feb 2009 15:56:52 -0000 1.12
@@ -28,10 +28,19 @@
using System.Globalization;
using System.Runtime.CompilerServices;
+#if !ECMA_COMPAT && CONFIG_FRAMEWORK_2_0
+using System.Runtime.InteropServices;
+
+[ComVisible(true)]
+[Serializable]
+#endif
public struct Single : IComparable, IFormattable
#if !ECMA_COMPAT
, IConvertible
#endif
+#if CONFIG_FRAMEWORK_2_0
+ , IComparable<float>, IEquatable<float>
+#endif
{
private float value_;
@@ -91,8 +100,11 @@
}
// Value testing methods.
- [MethodImpl(MethodImplOptions.InternalCall)]
- extern public static bool IsNaN(float f);
+ public static bool IsNaN(float f)
+ {
+ // Comparing a NaN with any other value yields
false.
+ return (f != f);
+ }
[MethodImpl(MethodImplOptions.InternalCall)]
extern private static int TestInfinity(float f);
@@ -200,6 +212,49 @@
}
}
+#if CONFIG_FRAMEWORK_2_0
+
+ // Implementation of the IComparable<float> interface.
+ public int CompareTo(float value)
+ {
+ if(value_ < value.value_)
+ {
+ return -1;
+ }
+ else if(value_ > value.value_)
+ {
+ return 1;
+ }
+ else if(value_ == value.value_)
+ {
+ return 0;
+ }
+ else if(IsNaN(value_))
+ {
+ if(IsNaN(value.value_))
+ {
+ return 0;
+ }
+ else
+ {
+ return -1;
+ }
+ }
+ else
+ {
+ return 1;
+ }
+ }
+
+ // Implementation of the IEquatable<float> interface.
+ public bool Equals(float obj)
+ {
+ return ((value_ == obj.value_) ||
+ (IsNaN(value_) &&
IsNaN(obj.value_)));
+ }
+
+#endif // CONFIG_FRAMEWORK_2_0
+
#if !ECMA_COMPAT
// Implementation of the IConvertible interface.
Index: runtime/System/String.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/String.cs,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -b -r1.43 -r1.44
--- runtime/System/String.cs 21 Nov 2005 06:51:22 -0000 1.43
+++ runtime/System/String.cs 15 Feb 2009 15:56:52 -0000 1.44
@@ -30,6 +30,9 @@
#if !ECMA_COMPAT
, IConvertible
#endif
+#if CONFIG_FRAMEWORK_2_0
+ , IComparable<String>, IEquatable<String>
+#endif
{
// Internal string state.
Index: runtime/System/UInt16.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/UInt16.cs,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- runtime/System/UInt16.cs 25 May 2007 05:49:26 -0000 1.10
+++ runtime/System/UInt16.cs 15 Feb 2009 15:56:52 -0000 1.11
@@ -30,6 +30,9 @@
#if !ECMA_COMPAT
, IConvertible
#endif
+#if CONFIG_FRAMEWORK_2_0
+ , IComparable<ushort>, IEquatable<ushort>
+#endif
{
private ushort value_;
@@ -111,6 +114,22 @@
}
}
+#if CONFIG_FRAMEWORK_2_0
+
+ // Implementation of the IComparable<ushort> interface.
+ public int CompareTo(ushort value)
+ {
+ return ((int)value_ - (int)value.value_);
+ }
+
+ // Implementation of the IEquatable<ushort> interface.
+ public bool Equals(ushort obj)
+ {
+ return (value_ == obj.value_);
+ }
+
+#endif // CONFIG_FRAMEWORK_2_0
+
#if !ECMA_COMPAT
// Implementation of the IConvertible interface.
Index: runtime/System/UInt32.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/UInt32.cs,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- runtime/System/UInt32.cs 25 May 2007 05:49:26 -0000 1.11
+++ runtime/System/UInt32.cs 15 Feb 2009 15:56:53 -0000 1.12
@@ -30,6 +30,9 @@
#if !ECMA_COMPAT
, IConvertible
#endif
+#if CONFIG_FRAMEWORK_2_0
+ , IComparable<uint>, IEquatable<uint>
+#endif
{
private uint value_;
@@ -125,6 +128,33 @@
}
}
+#if CONFIG_FRAMEWORK_2_0
+
+ // Implementation of the IComparable<uint> interface.
+ public int CompareTo(uint value)
+ {
+ if(value_ < value.value_)
+ {
+ return -1;
+ }
+ else if(value_ > value.value_)
+ {
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ // Implementation of the IEquatable<uint> interface.
+ public bool Equals(uint obj)
+ {
+ return (value_ == obj.value_);
+ }
+
+#endif // CONFIG_FRAMEWORK_2_0
+
#if !ECMA_COMPAT
// Implementation of the IConvertible interface.
Index: runtime/System/UInt64.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/UInt64.cs,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- runtime/System/UInt64.cs 25 May 2007 05:49:26 -0000 1.11
+++ runtime/System/UInt64.cs 15 Feb 2009 15:56:53 -0000 1.12
@@ -30,6 +30,9 @@
#if !ECMA_COMPAT
, IConvertible
#endif
+#if CONFIG_FRAMEWORK_2_0
+ , IComparable<ulong>, IEquatable<ulong>
+#endif
{
private ulong value_;
@@ -127,6 +130,33 @@
}
}
+#if CONFIG_FRAMEWORK_2_0
+
+ // Implementation of the IComparable<ulong> interface.
+ public int CompareTo(ulong value)
+ {
+ if(value_ < value.value_)
+ {
+ return -1;
+ }
+ else if(value_ > value.value_)
+ {
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ // Implementation of the IEquatable<ulong> interface.
+ public bool Equals(ulong obj)
+ {
+ return (value_ == obj.value_);
+ }
+
+#endif // CONFIG_FRAMEWORK_2_0
+
#if !ECMA_COMPAT
// Implementation of the IConvertible interface.
Index: runtime/System/Version.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Version.cs,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- runtime/System/Version.cs 8 Oct 2003 15:29:29 -0000 1.11
+++ runtime/System/Version.cs 15 Feb 2009 15:56:53 -0000 1.12
@@ -22,6 +22,9 @@
{
public sealed class Version : ICloneable, IComparable
+#if CONFIG_FRAMEWORK_2_0
+ , IComparable<Version>, IEquatable<Version>
+#endif
{
// Internal state.
private int major, minor, build, revision;
@@ -263,6 +266,52 @@
}
}
+#if CONFIG_FRAMEWORK_2_0
+
+ // Implementation of the IComparable<Value> interface.
+ public int CompareTo(Version value)
+ {
+ if(value != null)
+ {
+ if(major > value.major)
+ {
+ return 1;
+ }
+ else if(major < value.major)
+ {
+ return -1;
+ }
+ if(minor > value.minor)
+ {
+ return 1;
+ }
+ else if(minor < value.minor)
+ {
+ return -1;
+ }
+ if(build > value.build)
+ {
+ return 1;
+ }
+ else if(build < value.build)
+ {
+ return -1;
+ }
+ if(revision > value.revision)
+ {
+ return 1;
+ }
+ else if(revision < value.revision)
+ {
+ return -1;
+ }
+ return 0;
+ }
+ return 1;
+ }
+
+#endif // CONFIG_FRAMEWORK_2_0
+
// Determine if two Version objects are equal.
public override bool Equals(Object obj)
{
@@ -280,6 +329,23 @@
}
}
+#if CONFIG_FRAMEWORK_2_0
+
+ // Implementation of the IEquatable<Version> interface.
+ public bool Equals(Version obj)
+ {
+ if(obj != null)
+ {
+ return (major == obj.major &&
+ minor == obj.minor &&
+ build == obj.build &&
+ revision ==
obj.revision);
+ }
+ return false;
+ }
+
+#endif // CONFIG_FRAMEWORK_2_0
+
// Get a hash code for this Version object.
public override int GetHashCode()
{
Index: tests/runtime/System/SuiteSystem.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/tests/runtime/System/SuiteSystem.cs,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- tests/runtime/System/SuiteSystem.cs 10 Aug 2008 16:18:37 -0000 1.12
+++ tests/runtime/System/SuiteSystem.cs 15 Feb 2009 15:56:53 -0000 1.13
@@ -40,11 +40,13 @@
suite.AddTests(typeof(TestArray));
suite.AddTests(typeof(TestAttribute));
suite.AddTests(typeof(TestBoolean));
+ suite.AddTests(typeof(TestChar));
suite.AddTests(typeof(TestConvert));
suite.AddTests(typeof(TestDecimal));
suite.AddTests(typeof(TestDelegate));
suite.AddTests(typeof(TestDouble));
suite.AddTests(typeof(TestSByte));
+ suite.AddTests(typeof(TestSingle));
suite.AddTests(typeof(TestString));
#if !ECMA_COMPAT
suite.AddTests(typeof(TestGuid));
Index: tests/runtime/System/TestDouble.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/tests/runtime/System/TestDouble.cs,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- tests/runtime/System/TestDouble.cs 6 Aug 2003 04:46:56 -0000 1.6
+++ tests/runtime/System/TestDouble.cs 15 Feb 2009 15:56:53 -0000 1.7
@@ -88,5 +88,12 @@
//d = -1.13d;
//AssertEquals("-1.13", "-1.13", d.ToString());
}
+
+ public void TestDoubleIsNaN()
+ {
+ Assert("!IsNaN(1.0)", !Double.IsNaN(1.0));
+ Assert("IsNaN(Double.NaN)", Double.IsNaN(Double.NaN));
+ }
+
#endif // CONFIG_EXTENDED_NUMERICS
}
Index: tests/runtime/System/TestChar.cs
===================================================================
RCS file: tests/runtime/System/TestChar.cs
diff -N tests/runtime/System/TestChar.cs
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/runtime/System/TestChar.cs 15 Feb 2009 15:56:53 -0000 1.1
@@ -0,0 +1,124 @@
+/*
+ * TestChar.cs - Tests for the "System.Char" class.
+ *
+ * Copyright (C) 2009 Free Software Foundation Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+using System;
+using CSUnit;
+
+public class TestChar : TestCase
+{
+ // Constructor.
+ public TestChar(String name)
+ : base(name)
+ {
+ // Nothing to do here.
+ }
+
+ // Set up for the tests.
+ protected override void Setup()
+ {
+ // Nothing to do here.
+ }
+
+ // Clean up after the tests.
+ protected override void Cleanup()
+ {
+ // Nothing to do here.
+ }
+
+ public void TestCharParseString0()
+ {
+ char c = Char.Parse("a");
+
+ AssertEquals(c, 'a');
+ }
+
+ public void TestCharParseString2()
+ {
+ try
+ {
+ char c = Char.Parse("ab");
+ Fail("Expected a FormatException");
+ }
+ catch(FormatException e)
+ {
+ // success
+ }
+
+ }
+
+ public void TestCharParseStringNull()
+ {
+ try
+ {
+ char c = Char.Parse(null);
+ Fail("Expected an ArgumentNullException");
+ }
+ catch(ArgumentNullException e)
+ {
+ // success
+ }
+ }
+
+#if CONFIG_FRAMEWORK_2_0
+
+ public void TestCharCompare()
+ {
+ Assert("'a'.CompareTo('a')", 'a'.CompareTo('a') == 0);
+ Assert("'b'.CompareTo('a')", 'b'.CompareTo('a') > 0);
+ Assert("'a'.CompareTo('b')", 'a'.CompareTo('b') < 0);
+ }
+
+ public void TestCharEauals()
+ {
+ Assert("'a'.Equals('a')", 'a'.Equals('a'));
+ Assert("!('a'.Equals('b'))", !('a'.Equals('b')));
+ }
+
+#if !ECMA_COMPAT
+
+ public void TestCharHighSurrogate()
+ {
+ char cLow = '\uDC00';
+ char cHigh = '\uD800';
+
+ Assert("!IsHighSurrogate('\uDC00')",
!Char.IsHighSurrogate(cLow));
+ Assert("IsHighSurrogate('\uD800')",
Char.IsHighSurrogate(cHigh));
+ Assert("!IsHighSurrogate('a')", !Char.IsHighSurrogate('a'));
+ }
+
+ public void TestCharLowSurrogate()
+ {
+ char cLow = '\uDC00';
+ char cHigh = '\uD800';
+
+ Assert("IsLowSurrogate('\uDC00')", Char.IsLowSurrogate(cLow));
+ Assert("!IsLowSurrogate('\uD800')",
!Char.IsLowSurrogate(cHigh));
+ Assert("!IsLowSurrogate('a')", !Char.IsLowSurrogate('a'));
+ }
+
+#endif // !ECMA_COMPAT
+#endif // CONFIG_FRAMEWORK_2_0
+
+#if CONFIG_FRAMEWORK_2_0
+
+
+#endif // CONFIG_FRAMEWORK_2_0
+
+}; // class TestChar
Index: tests/runtime/System/TestSingle.cs
===================================================================
RCS file: tests/runtime/System/TestSingle.cs
diff -N tests/runtime/System/TestSingle.cs
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/runtime/System/TestSingle.cs 15 Feb 2009 15:56:53 -0000 1.1
@@ -0,0 +1,53 @@
+/*
+ * TestSingle.cs - Test class for "System.Single"
+ *
+ * Copyright (C) 2009 Free Software Foundation Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+using CSUnit;
+using System;
+
+public class TestSingle : TestCase
+ {
+ // Constructor.
+ public TestSingle(String name) : base(name)
+ {
+ // Nothing to do here.
+ }
+
+ // Set up for the tests.
+ protected override void Setup()
+ {
+ // Nothing to do here.
+ }
+
+ // Clean up after the tests.
+ protected override void Cleanup()
+ {
+ // Nothing to do here.
+ }
+
+#if CONFIG_EXTENDED_NUMERICS
+
+ public void TestSingleIsNaN()
+ {
+ Assert("!IsNaN(1.0)", !Single.IsNaN((float)1.0));
+ Assert("IsNaN(Single.NaN)", Single.IsNaN(Single.NaN));
+ }
+
+#endif // CONFIG_EXTENDED_NUMERICS
+}
Index: System/GenericUriParserOptions.cs
===================================================================
RCS file: System/GenericUriParserOptions.cs
diff -N System/GenericUriParserOptions.cs
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ System/GenericUriParserOptions.cs 15 Feb 2009 15:56:53 -0000 1.1
@@ -0,0 +1,48 @@
+/*
+ * GenericUriParserOptions.cs - Implementation of the
+ *
"System.GenericUriParserOptions" enumeration.
+ *
+ * Copyright (C) 2009 Free Software Foundation Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+namespace System
+{
+
+#if !ECMA_COMPAT && CONFIG_FRAMEWORK_2_0 && !CONFIG_COMPACT_FRAMEWORK
+
+[Flags]
+public enum GenericUriParserOptions
+{
+
+ Default = 0x0000,
+ GenericAuthority = 0x0001,
+ AllowEmptyAuthority = 0x0002,
+ NoUserInfo = 0x0004,
+ NoPort = 0x0008,
+ NoQuery = 0x0010,
+ NoFragment = 0x0020,
+ DontConvertPathBackslashes = 0x0040,
+ DontCompressPath = 0x0080,
+ DontUnescapePathDotsAndSlashes = 0x0100,
+ Idn =
0x0200,
+ IriParsing = 0x0400
+
+}; // enum GenericUriParserOptions
+
+#endif // !ECMA_COMPAT && CONFIG_FRAMEWORK_2_0 && !CONFIG_COMPACT_FRAMEWORK
+
+}; // namespace System
- [dotgnu-pnet-commits] pnetlib ChangeLog resources/en_US/runtime/Arg.t...,
Klaus Treichel <=