summaryrefslogtreecommitdiff
path: root/tests/src/JIT/Generics/Arrays/ConstructedTypes/MultiDim/struct01.cs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/src/JIT/Generics/Arrays/ConstructedTypes/MultiDim/struct01.cs')
-rw-r--r--tests/src/JIT/Generics/Arrays/ConstructedTypes/MultiDim/struct01.cs105
1 files changed, 105 insertions, 0 deletions
diff --git a/tests/src/JIT/Generics/Arrays/ConstructedTypes/MultiDim/struct01.cs b/tests/src/JIT/Generics/Arrays/ConstructedTypes/MultiDim/struct01.cs
new file mode 100644
index 0000000000..862cc568ed
--- /dev/null
+++ b/tests/src/JIT/Generics/Arrays/ConstructedTypes/MultiDim/struct01.cs
@@ -0,0 +1,105 @@
+// Copyright (c) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+//
+
+using System;
+
+
+public struct ValX1<T>
+{
+ public T t;
+ public ValX1(T t)
+ {
+ this.t = t;
+ }
+
+}
+public class RefX1<T>
+{
+ public T t;
+ public RefX1(T t)
+ {
+ this.t = t;
+ }
+}
+
+
+public struct Gen<T>
+{
+ public T Fld1;
+
+ public Gen(T fld1)
+ {
+ Fld1 = fld1;
+ }
+
+
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ int size = 10;
+ int i, j, k;
+ double sum = 0;
+ int cLoc = 0;
+
+ Gen<int>[, ,] GenArray = new Gen<int>[size, size, size];
+ for (i = 0; (i < size); i++)
+ {
+ for (j = 0; (j < size); j++)
+ {
+ for (k = 0; (k < size); k++)
+ {
+ GenArray[i, j, k] = new Gen<int>(cLoc);
+ cLoc++;
+ }
+ }
+ }
+
+ for (i = 0; (i < size); i++)
+ {
+ for (j = 0; (j < size); j++)
+ {
+ for (k = 0; (k < size); k++)
+ {
+ sum += GenArray[i, j, k].Fld1;
+ cLoc++;
+ }
+ }
+ }
+
+
+
+
+ Eval(sum == 499500);
+ sum = 0;
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
+