2004-11-23 Marek Safar <marek.safar@seznam.cz>
authorMarek Safar <marek.safar@gmail.com>
Tue, 23 Nov 2004 06:56:03 +0000 (06:56 -0000)
committerMarek Safar <marek.safar@gmail.com>
Tue, 23 Nov 2004 06:56:03 +0000 (06:56 -0000)
* test-319-*.cs: New test for #69177

svn path=/trunk/mcs/; revision=36416

mcs/tests/ChangeLog
mcs/tests/Makefile
mcs/tests/test-319-dll.cs [new file with mode: 0644]
mcs/tests/test-319-exe.cs [new file with mode: 0644]

index 5424b8142f850250685701d91687b6797920234d..3d68f9f6d5a6d32f5c37ccd64d77c4e687bbcc99 100755 (executable)
@@ -1,3 +1,7 @@
+2004-11-23  Marek Safar <marek.safar@seznam.cz>
+
+       * test-319-*.cs: New test for #69177
+\r
 2004-11-18  Martin Baulig  <martin@ximian.com>
 
        * gen-104.cs: New test for #68265.
index d8c3f0e9d3b457c7948affc07e60309dccab5277..36994e87bd012424334cd9ec699a873d9d4ea9da 100644 (file)
@@ -25,7 +25,8 @@ USE_MCS_FLAGS :=
 # Martin Baulig will manually move them into TEST_SOURCES_common after merging the code into GMCS.
 # He may also move some to TEST_EXCLUDE_net_2_0 if some of the merges are inappropriate for GMCS.
 #
-NEW_TEST_SOURCES_common = test-294 test-304 test-305 test-306 test-307 test-318 mtest-5-dll mtest-5-exe
+NEW_TEST_SOURCES_common = test-294 test-304 test-305 test-306 test-307 test-318 mtest-5-dll mtest-5-exe \\r
+                       test-319-dll test-319-exe
 
 #
 # Please do _not_ add any tests here - all new tests should go into NEW_TEST_SOURCES_common
diff --git a/mcs/tests/test-319-dll.cs b/mcs/tests/test-319-dll.cs
new file mode 100644 (file)
index 0000000..f05257c
--- /dev/null
@@ -0,0 +1,6 @@
+// Compiler options: -t:library
+
+public class C
+{
+    public const decimal D = 4;
+}
diff --git a/mcs/tests/test-319-exe.cs b/mcs/tests/test-319-exe.cs
new file mode 100644 (file)
index 0000000..0625ec1
--- /dev/null
@@ -0,0 +1,44 @@
+// Compiler options: -r:test-319-dll.dll
+
+using System;
+using System.Runtime.CompilerServices;
+
+// TODO: clean up in Decimal.cs
+
+public class ConstFields
+{
+       public const decimal ConstDecimal1 = 314159265358979323846m;
+        public static readonly decimal ConstDecimal2 = -314159265358979323846m;
+       public const decimal ConstDecimal3 = -3;
+        public const decimal ConstDecimal4 = 0;
+        public const decimal MaxValue = 79228162514264337593543950335m;
+        
+        // TODO: check this value
+       static readonly Decimal MaxValueDiv10 = MaxValue / 10;
+            
+        static decimal DecimalValue = -90;
+            
+        static int Main ()
+        {
+            Type t = typeof (ConstFields);
+            DecimalConstantAttribute a = (DecimalConstantAttribute) t.GetField ("ConstDecimal3").GetCustomAttributes (typeof (DecimalConstantAttribute), false) [0];
+            if (a.Value != ConstDecimal3)
+                return 1;
+
+            a = (DecimalConstantAttribute) t.GetField ("ConstDecimal1").GetCustomAttributes (typeof (DecimalConstantAttribute), false) [0];
+            if (a.Value != 314159265358979323846m)
+                return 2;
+            
+            if (ConstDecimal1 != (-1) * ConstDecimal2)
+                return 3;
+
+            // THIS IS TEST TOO
+            Console.WriteLine (C.D);
+            Console.WriteLine (Decimal.One);
+            Console.WriteLine (DecimalValue);
+            Console.WriteLine (Decimal.MaxValue);
+            
+            Console.WriteLine ("Success");
+            return 0;
+        }
+}