* Exec.cs: Write the commands, which can be multiline,
[mcs.git] / tests / gtest-166.cs
blobe558cf496a87abaa44a556cc524852969cdd9275
1 // Compiler options: -unsafe -r:gtest-166-lib.dll
3 // Fixed buffers tests
5 using System;
6 using System.Runtime.InteropServices;
8 //[module: DefaultCharSet (CharSet.Ansi)]
10 [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
11 public unsafe struct TestNew {
12 private fixed char test_1 [128];
13 public fixed bool test2 [4];
15 public fixed int T [2];
16 public fixed bool test20 [4], test21 [40];
18 private int foo, foo2;
19 public void SetTest () {
20 fixed (char* c = test_1) {
21 *c = 'g';
26 public class C {
27 unsafe static int Test () {
28 TestNew tt = new TestNew ();
29 tt.SetTest ();
30 tt.test2 [2] = false;
31 tt.T [1] = 5544;
32 if (tt.T [1] != 5544)
33 return 2;
35 ExternalStruct es = new ExternalStruct ();
36 es.double_buffer [1] = 999999.8888;
37 es.double_buffer [0] = es.double_buffer [1];
39 // Attributes test
40 if (Attribute.GetCustomAttribute (typeof (TestNew).GetField ("test2"), typeof (System.Runtime.CompilerServices.FixedBufferAttribute)) == null)
41 return 3;
44 if (typeof (TestNew).GetNestedTypes ().Length != 5)
45 return 5;
47 foreach (Type t in typeof (TestNew).GetNestedTypes ()) {
48 if (Attribute.GetCustomAttribute (t, typeof (System.Runtime.CompilerServices.CompilerGeneratedAttribute)) == null)
49 return 40;
51 if (Attribute.GetCustomAttribute (t, typeof (System.Runtime.CompilerServices.UnsafeValueTypeAttribute)) == null)
52 return 41;
54 if (!t.IsUnicodeClass)
55 return 42;
58 Console.WriteLine ("OK");
59 return 0;
62 public static int Main () {
63 return Test ();