dotgnu-pnet-commits
[Top][All Lists]
Advanced

[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, 22 Feb 2009 16:36:58 +0000

CVSROOT:        /cvsroot/dotgnu-pnet
Module name:    pnetlib
Changes by:     Klaus Treichel <ktreichel>      09/02/22 16:36:58

Modified files:
        .              : ChangeLog 
        resources/en_US/runtime: Arg.txt 
        runtime/System : Decimal.cs Double.cs Math.cs Single.cs 
                         String.cs 
        runtime/System/IO: FileShare.cs 
        runtime/System/Reflection: MethodImplAttributes.cs 
        runtime/System/Runtime/CompilerServices: 
                                                 DecimalConstantAttribute.cs 
        tests/runtime/System: SuiteSystem.cs TestDouble.cs TestSingle.cs 
Added files:
        runtime/System/IO: DriveType.cs FileOptions.cs SearchOption.cs 
        tests/runtime/System: TestMath.cs 

Log message:
        Add more 2.0 stuff and some tests.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pnetlib/ChangeLog?cvsroot=dotgnu-pnet&r1=1.2560&r2=1.2561
http://cvs.savannah.gnu.org/viewcvs/pnetlib/resources/en_US/runtime/Arg.txt?cvsroot=dotgnu-pnet&r1=1.51&r2=1.52
http://cvs.savannah.gnu.org/viewcvs/pnetlib/runtime/System/Decimal.cs?cvsroot=dotgnu-pnet&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/pnetlib/runtime/System/Double.cs?cvsroot=dotgnu-pnet&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/pnetlib/runtime/System/Math.cs?cvsroot=dotgnu-pnet&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/pnetlib/runtime/System/Single.cs?cvsroot=dotgnu-pnet&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/pnetlib/runtime/System/String.cs?cvsroot=dotgnu-pnet&r1=1.44&r2=1.45
http://cvs.savannah.gnu.org/viewcvs/pnetlib/runtime/System/IO/FileShare.cs?cvsroot=dotgnu-pnet&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/pnetlib/runtime/System/IO/DriveType.cs?cvsroot=dotgnu-pnet&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/pnetlib/runtime/System/IO/FileOptions.cs?cvsroot=dotgnu-pnet&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/pnetlib/runtime/System/IO/SearchOption.cs?cvsroot=dotgnu-pnet&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/pnetlib/runtime/System/Reflection/MethodImplAttributes.cs?cvsroot=dotgnu-pnet&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/pnetlib/runtime/System/Runtime/CompilerServices/DecimalConstantAttribute.cs?cvsroot=dotgnu-pnet&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/pnetlib/tests/runtime/System/SuiteSystem.cs?cvsroot=dotgnu-pnet&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/pnetlib/tests/runtime/System/TestDouble.cs?cvsroot=dotgnu-pnet&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/pnetlib/tests/runtime/System/TestSingle.cs?cvsroot=dotgnu-pnet&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/pnetlib/tests/runtime/System/TestMath.cs?cvsroot=dotgnu-pnet&rev=1.1

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/ChangeLog,v
retrieving revision 1.2560
retrieving revision 1.2561
diff -u -b -r1.2560 -r1.2561
--- ChangeLog   15 Feb 2009 20:05:59 -0000      1.2560
+++ ChangeLog   22 Feb 2009 16:36:56 -0000      1.2561
@@ -1,3 +1,39 @@
+2009-02-22  Klaus Treichel  <address@hidden>
+
+       * resources/en_US/runtime/Arg.txt: Add message for the invalid midpoint
+       rounding mode.
+
+       * runtime/System/Decimal.cs: Add the 2.0 ECMA generic interface
+       implementations.
+
+       * runtime/System/Double.cs, runtime/System/Single.cs 
(IsPositiveInfinity,
+       IsNegativeInfinity): Replace the internal calls with simple 
comparisions.
+
+       * runtime/System/Math.cs: Make class static for 2.0 builds.
+       Add 2.0 non ECMA double rounding methods.
+
+       * runtime/System/String.cs (IsNullOrEmpty): Add 2.0 non ECMA convinience
+       method.
+
+       * runtime/System/IO/DriveType.cs, runtime/System/IO/FileOptions.cs,
+       runtime/System/IO/SearchOption.cs: Add some non ECMA 2.0 enumerations.
+
+       * runtime/System/IO/FileShare.cs: Add 2.0 non ECMA member Delete.
+
+       * runtime/System/Reflection/MethodImplAttributes.cs: Add undocumented 
2.0
+       non ECMA member NoOptimization.
+
+       * runtime/System/Runtime/CompilerServices/DecimalConstantAttribute.cs:
+       Add additional 2.0 non ECMA constructor.
+
+       * tests/runtime/System/SuiteSystem.cs: Add TestMath to the tests.
+
+       * tests/runtime/System/TestDouble.cs, 
tests/runtime/System/TestSingle.cs;
+       Add Tests for IsPositiveInfinity and IsNegativeInfinity.
+
+       * tests/runtime/System/TestMath.cs: Add tests for System.Math double
+       rounding methods.
+
 2009-02-15  Klaus Treichel  <address@hidden>
 
        * resources/en_US/runtime/Arg.txt: Add messages for Exceptions thrown

Index: resources/en_US/runtime/Arg.txt
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/resources/en_US/runtime/Arg.txt,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -b -r1.51 -r1.52
--- resources/en_US/runtime/Arg.txt     15 Feb 2009 15:56:52 -0000      1.51
+++ resources/en_US/runtime/Arg.txt     22 Feb 2009 16:36:57 -0000      1.52
@@ -142,6 +142,7 @@
 Arg_InvalidColor=Invalid console color value
 Arg_LowSurrogate=Invalid low surrogate
 Arg_HighSurrogate=Invalid high surrogate
+Arg_InvalidMidpointRounding=Invalid midpoint rounding mode
 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

Index: runtime/System/Decimal.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Decimal.cs,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- runtime/System/Decimal.cs   18 Oct 2004 05:16:05 -0000      1.14
+++ runtime/System/Decimal.cs   22 Feb 2009 16:36:57 -0000      1.15
@@ -32,6 +32,9 @@
 #if !ECMA_COMPAT
        , IConvertible
 #endif
+#if CONFIG_FRAMEWORK_2_0
+       , IComparable<decimal>, IEquatable<decimal>
+#endif
 {
        private int flags, high, middle, low;
 
@@ -360,6 +363,22 @@
                                }
                        }
 
+#if CONFIG_FRAMEWORK_2_0
+
+       // Implementation of the IComparable<decimal> interface.
+       public int CompareTo(decimal value)
+                       {
+                               return Compare(this, value);
+                       }
+
+       // Implementation of the IEquatable<decimal> interface.
+       public bool Equals(decimal obj)
+                       {
+                               return (Compare(this, obj) == 0);
+                       }
+
+#endif // CONFIG_FRAMEWORK_2_0
+
 #if !ECMA_COMPAT
 
        // Implementation of the IConvertible interface.

Index: runtime/System/Double.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Double.cs,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- runtime/System/Double.cs    15 Feb 2009 15:56:52 -0000      1.17
+++ runtime/System/Double.cs    22 Feb 2009 16:36:57 -0000      1.18
@@ -102,11 +102,11 @@
                                }
        public static bool IsPositiveInfinity(double d)
                                {
-                                       return (TestInfinity(d) > 0);
+                                       return (d == PositiveInfinity);
                                }
        public static bool IsNegativeInfinity(double d)
                                {
-                                       return (TestInfinity(d) < 0);
+                                       return (d == NegativeInfinity);
                                }
 
        // String conversion.

Index: runtime/System/Math.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Math.cs,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- runtime/System/Math.cs      15 Apr 2003 07:27:54 -0000      1.9
+++ runtime/System/Math.cs      22 Feb 2009 16:36:57 -0000      1.10
@@ -25,15 +25,25 @@
 
 using System.Runtime.CompilerServices;
 
-public sealed class Math
+public
+#if CONFIG_FRAMEWORK_2_0
+static
+#else
+sealed
+#endif
+class Math
 {
        // Constants.
        public const double E  = 2.7182818284590452354;
        public const double PI = 3.14159265358979323846;
 
+#if !CONFIG_FRAMEWORK_2_0
+
        // This class cannot be instantiated.
        private Math() {}
 
+#endif // !CONFIG_FRAMEWORK_2_0
+
        // Get the absolute value of a number.
        [CLSCompliant(false)]
        public static sbyte Abs(sbyte value)
@@ -261,6 +271,46 @@
                                }
                                return RoundDouble(value, digits);
                        }
+#if !ECMA_COMPAT && CONFIG_FRAMEWORK_2_0 && !CONFIG_COMPACT_FRAMEWORK
+       public static double Round(double value, MidpointRounding mode)
+                       {
+                               if(mode == MidpointRounding.ToEven)
+                               {
+                                       return Math.Round(value);
+                               }
+                               else if(mode == MidpointRounding.AwayFromZero)
+                               {
+                                       return RoundDoubleAwayFromZero(value);
+                               }
+                               else
+                               {
+                                       throw new ArgumentException
+                                               
(_("Arg_InvalidMidpointRounding"));
+                               }
+                       }
+
+       public static double Round(double value, int digits, MidpointRounding 
mode)
+                       {
+                               if(digits < 0 || digits > 15)
+                               {
+                                       throw new ArgumentOutOfRangeException
+                                               ("digits", 
_("ArgRange_RoundDigits"));
+                               }
+                               if(mode == MidpointRounding.ToEven)
+                               {
+                                       return RoundDouble(value, digits);
+                               }
+                               else if(mode == MidpointRounding.AwayFromZero)
+                               {
+                                       return RoundDoubleAwayFromZero(value, 
digits);
+                               }
+                               else
+                               {
+                                       throw new ArgumentException
+                                               
(_("Arg_InvalidMidpointRounding"));
+                               }
+                       }
+#endif // !ECMA_COMPAT && CONFIG_FRAMEWORK_2_0 && !CONFIG_COMPACT_FRAMEWORK
        public static Decimal Round(Decimal value)
                        {
                                return Decimal.Round(value, 0);
@@ -423,6 +473,14 @@
        [MethodImpl(MethodImplOptions.InternalCall)]
        extern private static double RoundDouble(double value, int digits);
 
+#if !ECMA_COMPAT && CONFIG_FRAMEWORK_2_0 && !CONFIG_COMPACT_FRAMEWORK
+       [MethodImpl(MethodImplOptions.InternalCall)]
+       extern private static double RoundDoubleAwayFromZero(double a);
+
+       [MethodImpl(MethodImplOptions.InternalCall)]
+       extern private static double RoundDoubleAwayFromZero(double a, int 
digits);
+#endif // !ECMA_COMPAT && CONFIG_FRAMEWORK_2_0 && !CONFIG_COMPACT_FRAMEWORK
+
        [MethodImpl(MethodImplOptions.InternalCall)]
        extern public static double Sin(double a);
 
@@ -438,6 +496,11 @@
        [MethodImpl(MethodImplOptions.InternalCall)]
        extern public static double Tanh(double value);
 
+#if !ECMA_COMPAT && CONFIG_FRAMEWORK_2_0 && !CONFIG_COMPACT_FRAMEWORK
+       [MethodImpl(MethodImplOptions.InternalCall)]
+       extern public static double Truncate(double d);
+#endif // !ECMA_COMPAT && CONFIG_FRAMEWORK_2_0 && !CONFIG_COMPACT_FRAMEWORK
+
 }; // class Math
 
 #endif // CONFIG_EXTENDED_NUMERICS

Index: runtime/System/Single.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Single.cs,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- runtime/System/Single.cs    15 Feb 2009 15:56:52 -0000      1.12
+++ runtime/System/Single.cs    22 Feb 2009 16:36:57 -0000      1.13
@@ -115,11 +115,11 @@
                                }
        public static bool IsPositiveInfinity(float f)
                                {
-                                       return (TestInfinity(f) > 0);
+                                       return (f == PositiveInfinity);
                                }
        public static bool IsNegativeInfinity(float f)
                                {
-                                       return (TestInfinity(f) < 0);
+                                       return (f == NegativeInfinity);
                                }
 
        // Parsing methods.

Index: runtime/System/String.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/String.cs,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -b -r1.44 -r1.45
--- runtime/System/String.cs    15 Feb 2009 15:56:52 -0000      1.44
+++ runtime/System/String.cs    22 Feb 2009 16:36:57 -0000      1.45
@@ -1096,6 +1096,15 @@
                                return result;
                        }
 
+#if !ECMA_COMPAT && CONGIG_FRAMEWORK_2_0
+
+       public static bool IsNullOrEmpty(String value)
+                       {
+                               return (value == null || value.length == 0);
+                       }
+
+#endif // !ECMA_COMPAT && CONGIG_FRAMEWORK_2_0
+
        // Intern a string.
        [MethodImpl(MethodImplOptions.InternalCall)]
        extern public static String Intern(String str);

Index: runtime/System/IO/FileShare.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/IO/FileShare.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- runtime/System/IO/FileShare.cs      30 Oct 2002 18:32:05 -0000      1.3
+++ runtime/System/IO/FileShare.cs      22 Feb 2009 16:36:57 -0000      1.4
@@ -20,18 +20,25 @@
 
 namespace System.IO
 {
+#if !ECMA_COMPAT && CONFIG_FRAMEWORK_2_0 && !CONFIG_COMPACT_FRAMEWORK
 
-using System;
+using System.Runtime.InteropServices;
 
+[ComVisible(true)]
+[Serializable]
+#endif // !ECMA_COMPAT && CONFIG_FRAMEWORK_2_0 && !CONFIG_COMPACT_FRAMEWORK
 [Flags]
 public enum FileShare
 {
        None        = 0x00,
        Read        = 0x01,
        Write       = 0x02,
-       ReadWrite   = Read | Write,
-
-#if !ECMA_COMPAT
+       ReadWrite   = Read | Write
+#if !ECMA_COMPAT && !CONFIG_COMPACT_FRAMEWORK
+       ,
+#if CONFIG_FRAMEWORK_2_0
+       Delete          = 0x04,
+#endif // CONFIG_FRAMEWORK_2_0
        Inheritable = 0x10
 #endif
 

Index: runtime/System/Reflection/MethodImplAttributes.cs
===================================================================
RCS file: 
/cvsroot/dotgnu-pnet/pnetlib/runtime/System/Reflection/MethodImplAttributes.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- runtime/System/Reflection/MethodImplAttributes.cs   23 Apr 2003 05:39:49 
-0000      1.4
+++ runtime/System/Reflection/MethodImplAttributes.cs   22 Feb 2009 16:36:58 
-0000      1.5
@@ -38,6 +38,9 @@
        NoInlining                      = 0x0008,
        ForwardRef                      = 0x0010,
        Synchronized            = 0x0020,
+#if CONFIG_FRAMEWORK_2_0
+       NoOptimization          = 0x0040,
+#endif
        PreserveSig                     = 0x0080,
        InternalCall            = 0x1000,
        MaxMethodImplVal        = 0xFFFF

Index: runtime/System/Runtime/CompilerServices/DecimalConstantAttribute.cs
===================================================================
RCS file: 
/cvsroot/dotgnu-pnet/pnetlib/runtime/System/Runtime/CompilerServices/DecimalConstantAttribute.cs,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- runtime/System/Runtime/CompilerServices/DecimalConstantAttribute.cs 12 Nov 
2007 21:22:19 -0000      1.5
+++ runtime/System/Runtime/CompilerServices/DecimalConstantAttribute.cs 22 Feb 
2009 16:36:58 -0000      1.6
@@ -51,6 +51,16 @@
                                }
                        }
 
+#if !ECMA_COMPAT && CONFIG_FRAMEWORK_2_0 && !CONFIG_COMPACT_FRAMEWORK
+
+       public DecimalConstantAttribute(byte scale, byte sign,
+                                                                       int hi, 
int mid, int low)
+                       {
+                               value = new Decimal(low, mid, hi, (sign != 0), 
scale);
+                       }
+
+#endif // !ECMA_COMPAT && CONFIG_FRAMEWORK_2_0 && !CONFIG_COMPACT_FRAMEWORK
+
        // Properties.
        public Decimal Value
                        {

Index: tests/runtime/System/SuiteSystem.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/tests/runtime/System/SuiteSystem.cs,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- tests/runtime/System/SuiteSystem.cs 15 Feb 2009 15:56:53 -0000      1.13
+++ tests/runtime/System/SuiteSystem.cs 22 Feb 2009 16:36:58 -0000      1.14
@@ -45,6 +45,7 @@
                                suite.AddTests(typeof(TestDecimal));
                                suite.AddTests(typeof(TestDelegate));
                                suite.AddTests(typeof(TestDouble));
+                               suite.AddTests(typeof(TestMath));
                                suite.AddTests(typeof(TestSByte));
                                suite.AddTests(typeof(TestSingle));
                                suite.AddTests(typeof(TestString));

Index: tests/runtime/System/TestDouble.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/tests/runtime/System/TestDouble.cs,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- tests/runtime/System/TestDouble.cs  15 Feb 2009 15:56:53 -0000      1.7
+++ tests/runtime/System/TestDouble.cs  22 Feb 2009 16:36:58 -0000      1.8
@@ -95,5 +95,21 @@
                Assert("IsNaN(Double.NaN)", Double.IsNaN(Double.NaN));
        }
 
+       public void TestDoubleIsNegativeInfinity()
+       {
+               Assert("!IsNegativeInfinity(1.0)", 
!Double.IsNegativeInfinity(1.0));
+               Assert("!IsNegativeInfinity(Double.NaN)", 
!Double.IsNegativeInfinity(Double.NaN));
+               Assert("!IsNegativeInfinity(Double.PositiveInfinity)", 
!Double.IsNegativeInfinity(Double.PositiveInfinity));
+               Assert("IsNegativeInfinity(Double.NegativeInfinity)", 
Double.IsNegativeInfinity(Double.NegativeInfinity));
+       }
+
+       public void TestDoubleIsPositiveInfinity()
+       {
+               Assert("!IsPositiveInfinity(1.0)", 
!Double.IsPositiveInfinity(1.0));
+               Assert("!IsPositiveInfinity(Double.NaN)", 
!Double.IsPositiveInfinity(Double.NaN));
+               Assert("!IsPositiveInfinity(Double.NegativeInfinity)", 
!Double.IsPositiveInfinity(Double.NegativeInfinity));
+               Assert("IsPositiveInfinity(Double.PositiveInfinity)", 
Double.IsPositiveInfinity(Double.PositiveInfinity));
+       }
+
 #endif // CONFIG_EXTENDED_NUMERICS
 }

Index: tests/runtime/System/TestSingle.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/tests/runtime/System/TestSingle.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- tests/runtime/System/TestSingle.cs  15 Feb 2009 15:56:53 -0000      1.1
+++ tests/runtime/System/TestSingle.cs  22 Feb 2009 16:36:58 -0000      1.2
@@ -45,9 +45,25 @@
 
        public void TestSingleIsNaN()
        {
-               Assert("!IsNaN(1.0)", !Single.IsNaN((float)1.0));
+               Assert("!IsNaN(1.0)", !Single.IsNaN(1.0f));
                Assert("IsNaN(Single.NaN)", Single.IsNaN(Single.NaN));
        }
 
+       public void TestSingleIsNegativeInfinity()
+       {
+               Assert("!IsNegativeInfinity(1.0)", 
!Single.IsNegativeInfinity(1.0f));
+               Assert("!IsNegativeInfinity(Single.NaN)", 
!Single.IsNegativeInfinity(Single.NaN));
+               Assert("!IsNegativeInfinity(Single.PositiveInfinity)", 
!Single.IsNegativeInfinity(Single.PositiveInfinity));
+               Assert("IsNegativeInfinity(Single.NegativeInfinity)", 
Single.IsNegativeInfinity(Single.NegativeInfinity));
+       }
+
+       public void TestSingleIsPositiveInfinity()
+       {
+               Assert("!IsPositiveInfinity(1.0)", 
!Single.IsPositiveInfinity(1.0f));
+               Assert("!IsPositiveInfinity(Single.NaN)", 
!Single.IsPositiveInfinity(Single.NaN));
+               Assert("!IsPositiveInfinity(Single.NegativeInfinity)", 
!Single.IsPositiveInfinity(Single.NegativeInfinity));
+               Assert("IsPositiveInfinity(Single.PositiveInfinity)", 
Single.IsPositiveInfinity(Single.PositiveInfinity));
+       }
+
 #endif // CONFIG_EXTENDED_NUMERICS
 }

Index: runtime/System/IO/DriveType.cs
===================================================================
RCS file: runtime/System/IO/DriveType.cs
diff -N runtime/System/IO/DriveType.cs
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ runtime/System/IO/DriveType.cs      22 Feb 2009 16:36:57 -0000      1.1
@@ -0,0 +1,44 @@
+/*
+ * DriveType.cs - Implementation of the "System.IO.DriveType" 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
+ */
+
+namespace System.IO
+{
+
+#if !ECMA_COMPAT && CONFIG_FRAMEWORK_2_0 && !CONFIG_COMPACT_FRAMEWORK
+
+using System.Runtime.InteropServices;
+
+[ComVisible(true)]
+[Serializable]
+public enum DriveType
+{
+       Unknown,
+       NoRootDirectory,
+       Removable,
+       Fixed,
+       Network,
+       CDRom,
+       Ram
+
+}; // enum DriveType
+
+#endif // !ECMA_COMPAT && CONFIG_FRAMEWORK_2_0 && !CONFIG_COMPACT_FRAMEWORK
+
+}; // namespace System.IO

Index: runtime/System/IO/FileOptions.cs
===================================================================
RCS file: runtime/System/IO/FileOptions.cs
diff -N runtime/System/IO/FileOptions.cs
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ runtime/System/IO/FileOptions.cs    22 Feb 2009 16:36:57 -0000      1.1
@@ -0,0 +1,45 @@
+/*
+ * FileOptions.cs - Implementation of the "System.IO.FileOptions" 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
+ */
+
+namespace System.IO
+{
+
+#if !ECMA_COMPAT && CONFIG_FRAMEWORK_2_0 && !CONFIG_COMPACT_FRAMEWORK
+
+using System.Runtime.InteropServices;
+
+[ComVisible(true)]
+[Serializable]
+[Flags]
+public enum FileOptions
+{
+       None                    = 0x00000000,
+       Encrypted               = 0x00004000,
+       DeleteOnClose   = 0x04000000,
+       SequentialScan  = 0x08000000,
+       RandomAccess    = 0x10000000,
+       Asynchronous    = 0x40000000,
+       WriteThrough    = 0x80000000
+
+}; // enum FileOptions
+
+#endif // !ECMA_COMPAT && CONFIG_FRAMEWORK_2_0 && !CONFIG_COMPACT_FRAMEWORK
+
+}; // namespace System.IO

Index: runtime/System/IO/SearchOption.cs
===================================================================
RCS file: runtime/System/IO/SearchOption.cs
diff -N runtime/System/IO/SearchOption.cs
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ runtime/System/IO/SearchOption.cs   22 Feb 2009 16:36:58 -0000      1.1
@@ -0,0 +1,40 @@
+/*
+ * SearchOption.cs - Implementation of the
+ *                                                                      
"System.IO.SearchOption" 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.IO
+{
+
+#if !ECMA_COMPAT && CONFIG_FRAMEWORK_2_0 && !CONFIG_COMPACT_FRAMEWORK
+
+using System.Runtime.InteropServices;
+
+[ComVisible(true)]
+[Serializable]
+public enum SearchOption
+{
+       TopDirectoryOnly,
+       AllDirectories
+
+}; // enum SearchOption
+
+#endif // !ECMA_COMPAT && CONFIG_FRAMEWORK_2_0 && !CONFIG_COMPACT_FRAMEWORK
+
+}; // namespace System.IO

Index: tests/runtime/System/TestMath.cs
===================================================================
RCS file: tests/runtime/System/TestMath.cs
diff -N tests/runtime/System/TestMath.cs
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ tests/runtime/System/TestMath.cs    22 Feb 2009 16:36:58 -0000      1.1
@@ -0,0 +1,173 @@
+/*
+ * TestMath.cs - Test class for "System.Math" 
+ *
+ * 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 TestMath : TestCase
+ {
+       // Constructor.
+       public TestMath(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 TestMathCeilingDouble()
+       {
+               // Checks for non finite values
+               Assert("NaN", Double.IsNaN(Math.Ceiling(Double.NaN)));
+               Assert("NegativeInfinity", Double.IsNegativeInfinity
+                       (Math.Ceiling(Double.NegativeInfinity)));
+               Assert("PositiveInfinity", Double.IsPositiveInfinity
+                       (Math.Ceiling(Double.PositiveInfinity)));
+               // Checks for finite values
+               AssertEquals("1.0", 1.0, Math.Ceiling(1.0));
+               AssertEquals("1.1", 2.0, Math.Ceiling(1.1));
+               AssertEquals("1.5", 2.0, Math.Ceiling(1.5));
+               AssertEquals("1.7", 2.0, Math.Ceiling(1.7));
+               AssertEquals("-1.0", -1.0, Math.Ceiling(-1.0));
+               AssertEquals("-1.1", -1.0, Math.Ceiling(-1.1));
+               AssertEquals("-1.5", -1.0, Math.Ceiling(-1.5));
+               AssertEquals("-1.7", -1.0, Math.Ceiling(-1.7));
+       }
+
+       public void TestMathFloorDouble()
+       {
+               // Checks for non finite values
+               Assert("NaN", Double.IsNaN(Math.Floor(Double.NaN)));
+               Assert("NegativeInfinity", Double.IsNegativeInfinity
+                       (Math.Floor(Double.NegativeInfinity)));
+               Assert("PositiveInfinity", Double.IsPositiveInfinity
+                       (Math.Floor(Double.PositiveInfinity)));
+               // Checks for finite values
+               AssertEquals("1.0", 1.0, Math.Floor(1.0));
+               AssertEquals("1.1", 1.0, Math.Floor(1.1));
+               AssertEquals("1.5", 1.0, Math.Floor(1.5));
+               AssertEquals("1.7", 1.0, Math.Floor(1.7));
+               AssertEquals("-1.0", -1.0, Math.Floor(-1.0));
+               AssertEquals("-1.1", -2.0, Math.Floor(-1.1));
+               AssertEquals("-1.5", -2.0, Math.Floor(-1.5));
+               AssertEquals("-1.7", -2.0, Math.Floor(-1.7));
+       }
+
+       public void TestMathRoundDouble()
+       {
+               // Checks for non finite values
+               Assert("NaN", Double.IsNaN(Math.Round(Double.NaN)));
+               Assert("NegativeInfinity", Double.IsNegativeInfinity
+                       (Math.Round(Double.NegativeInfinity)));
+               Assert("PositiveInfinity", Double.IsPositiveInfinity
+                       (Math.Round(Double.PositiveInfinity)));
+               // Checks for finite values
+               AssertEquals("1.0", 1.0, Math.Round(1.0));
+               AssertEquals("1.1", 1.0, Math.Round(1.1));
+               AssertEquals("1.5", 2.0, Math.Round(1.5));
+               AssertEquals("1.7", 2.0, Math.Round(1.7));
+               AssertEquals("2.5", 2.0, Math.Round(2.5));
+               AssertEquals("-1.0", -1.0, Math.Round(-1.0));
+               AssertEquals("-1.1", -1.0, Math.Round(-1.1));
+               AssertEquals("-1.5", -2.0, Math.Round(-1.5));
+               AssertEquals("-1.7", -2.0, Math.Round(-1.7));
+               AssertEquals("-2.5", -2.0, Math.Round(-2.5));
+       }
+
+#if !ECMA_COMPAT && CONFIG_FRAMEWORK_2_0 && !CONFIG_COMPACT_FRAMEWORK
+
+       public void TestMathRoundDoubleMidpointRounding()
+       {
+               // Tests for Rounding to even (results have to be the same
+               // as for the simple Round method)
+               // Checks for non finite values
+               Assert("NaN", Double.IsNaN(Math.Round(Double.NaN,
+                                                                               
          MidpointRounding.ToEven)));
+               Assert("NegativeInfinity", Double.IsNegativeInfinity
+                       (Math.Round(Double.NegativeInfinity, 
MidpointRounding.ToEven)));
+               Assert("PositiveInfinity", Double.IsPositiveInfinity
+                       (Math.Round(Double.PositiveInfinity, 
MidpointRounding.ToEven)));
+               // Checks for finite values
+               AssertEquals("1.0", 1.0, Math.Round(1.0, 
MidpointRounding.ToEven));
+               AssertEquals("1.1", 1.0, Math.Round(1.1, 
MidpointRounding.ToEven));
+               AssertEquals("1.5", 2.0, Math.Round(1.5, 
MidpointRounding.ToEven));
+               AssertEquals("1.7", 2.0, Math.Round(1.7, 
MidpointRounding.ToEven));
+               AssertEquals("2.5", 2.0, Math.Round(2.5, 
MidpointRounding.ToEven));
+               AssertEquals("-1.0", -1.0, Math.Round(-1.0, 
MidpointRounding.ToEven));
+               AssertEquals("-1.1", -1.0, Math.Round(-1.1, 
MidpointRounding.ToEven));
+               AssertEquals("-1.5", -2.0, Math.Round(-1.5, 
MidpointRounding.ToEven));
+               AssertEquals("-1.7", -2.0, Math.Round(-1.7, 
MidpointRounding.ToEven));
+               AssertEquals("-2.5", -2.0, Math.Round(-2.5, 
MidpointRounding.ToEven));
+
+               // Tests for Rounding away from zero.
+               // Checks for non finite values
+               Assert("NaN", Double.IsNaN(Math.Round(Double.NaN,
+                                                                               
          MidpointRounding.AwayFromZero)));
+               Assert("NegativeInfinity", Double.IsNegativeInfinity
+                       (Math.Round(Double.NegativeInfinity, 
MidpointRounding.AwayFromZero)));
+               Assert("PositiveInfinity", Double.IsPositiveInfinity
+                       (Math.Round(Double.PositiveInfinity, 
MidpointRounding.AwayFromZero)));
+               // Checks for finite values
+               AssertEquals("1.0", 1.0, Math.Round(1.0, 
MidpointRounding.AwayFromZero));
+               AssertEquals("1.1", 1.0, Math.Round(1.1, 
MidpointRounding.AwayFromZero));
+               AssertEquals("1.5", 2.0, Math.Round(1.5, 
MidpointRounding.AwayFromZero));
+               AssertEquals("1.7", 2.0, Math.Round(1.7, 
MidpointRounding.AwayFromZero));
+               AssertEquals("2.5", 3.0, Math.Round(2.5, 
MidpointRounding.AwayFromZero));
+               AssertEquals("-1.0", -1.0, Math.Round(-1.0, 
MidpointRounding.AwayFromZero));
+               AssertEquals("-1.1", -1.0, Math.Round(-1.1, 
MidpointRounding.AwayFromZero));
+               AssertEquals("-1.5", -2.0, Math.Round(-1.5, 
MidpointRounding.AwayFromZero));
+               AssertEquals("-1.7", -2.0, Math.Round(-1.7, 
MidpointRounding.AwayFromZero));
+               AssertEquals("-2.5", -3.0, Math.Round(-2.5, 
MidpointRounding.AwayFromZero));
+       }
+
+       public void TestMathTruncateDouble()
+       {
+               // Checks for non finite values
+               Assert("NaN", Double.IsNaN(Math.Truncate(Double.NaN)));
+               Assert("NegativeInfinity", Double.IsNegativeInfinity
+                       (Math.Truncate(Double.NegativeInfinity)));
+               Assert("PositiveInfinity", Double.IsPositiveInfinity
+                       (Math.Truncate(Double.PositiveInfinity)));
+               // Checks for finite values
+               AssertEquals("1.0", 1.0, Math.Truncate(1.0));
+               AssertEquals("1.1", 1.0, Math.Truncate(1.1));
+               AssertEquals("1.5", 1.0, Math.Truncate(1.5));
+               AssertEquals("1.7", 1.0, Math.Truncate(1.7));
+               AssertEquals("-1.0", -1.0, Math.Truncate(-1.0));
+               AssertEquals("-1.1", -1.0, Math.Truncate(-1.1));
+               AssertEquals("-1.5", -1.0, Math.Truncate(-1.5));
+               AssertEquals("-1.7", -1.0, Math.Truncate(-1.7));
+       }
+
+#endif // !ECMA_COMPAT && CONFIG_FRAMEWORK_2_0 && !CONFIG_COMPACT_FRAMEWORK
+
+#endif // CONFIG_EXTENDED_NUMERICS
+}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]