summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKyungwoo Lee <kyulee@microsoft.com>2015-04-27 09:35:34 -0700
committerKyungwoo Lee <kyulee@microsoft.com>2015-04-27 10:02:22 -0700
commit64fa0f0deea7b03a7c8b4e7af60b34901b0d9a9a (patch)
treeb21a3d4be1483bf231f9a9055ba7ac49e084cadd /tests
parent7fc9feeedbabd0f7991aa519271bdc7bd2f740e0 (diff)
downloadcoreclr-64fa0f0deea7b03a7c8b4e7af60b34901b0d9a9a.tar.gz
coreclr-64fa0f0deea7b03a7c8b4e7af60b34901b0d9a9a.tar.bz2
coreclr-64fa0f0deea7b03a7c8b4e7af60b34901b0d9a9a.zip
Test case for store (no-GC) value type to static field
Diffstat (limited to 'tests')
-rw-r--r--tests/src/JIT/CodeGenBringUpTests/StaticValueField.cs40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/src/JIT/CodeGenBringUpTests/StaticValueField.cs b/tests/src/JIT/CodeGenBringUpTests/StaticValueField.cs
new file mode 100644
index 0000000000..a5912a902e
--- /dev/null
+++ b/tests/src/JIT/CodeGenBringUpTests/StaticValueField.cs
@@ -0,0 +1,40 @@
+// Copyright (c) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+//
+
+using System;
+struct TestValue
+{
+ public int a;
+ public short b;
+ public long c;
+}
+
+// This test stores a primitive (no-GC fields) value type to a static field
+// and checks if the contents are correct.
+class StaticValueField
+{
+ const int Pass = 100;
+ const int Fail = -1;
+ static TestValue sField;
+ public static void Init()
+ {
+ TestValue v = new TestValue();
+ v.a = 100;
+ v.b = 200;
+ v.c = 300;
+ sField = v;
+ }
+
+ public static int Main()
+ {
+ Init();
+ if (sField.a == 100
+ && sField.b == 200
+ && sField.c == 300)
+ {
+ return Pass;
+ }
+ return Fail;
+ }
+}