2010-05-13 Rodrigo Kumpera <rkumpera@novell.com>
[mono-project.git] / mcs / tests / test-709.cs
blobf5a5865995ce46c5ff446fa7de757e0e7ca86374
1 // Compiler options: -unsafe
3 using System;
5 class C
7 static unsafe void CopyTo (int sourceIndex, char[] destination, int destinationIndex, int count)
9 string s = "test string-";
10 fixed (char* dest = destination, src = s)
12 CharCopy (dest + destinationIndex, src + sourceIndex, count);
16 static unsafe void CharCopy (char *dest, char *src, int count)
18 for (int i = 0; i < count; i++) {
19 *dest++ = *src++;
23 public static int Main ()
25 CopyTo (5, null, 0, 0);
27 char[] output = new char [6];
28 CopyTo (5, output, 0, 6);
29 string s = new string (output);
30 Console.WriteLine (s);
31 if (s != "string")
32 return 1;
34 return 0;