blob: ba22cb311e822d5f9a13c277a90e9fe3de0a6d96 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more 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 ArrayHolder
{
public static Gen<int>[, ,] GenArray = new Gen<int>[10, 10, 10];
}
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;
for (i = 0; (i < size); i++)
{
for (j = 0; (j < size); j++)
{
for (k = 0; (k < size); k++)
{
ArrayHolder.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 += ArrayHolder.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;
}
}
}
|