Merge pull request #5636 from BrzVlad/fix-xmm-scan
[mono.git] / mcs / tests / test-709.cs
1 // Compiler options: -unsafe
2
3 using System;
4
5 class C
6 {
7         static unsafe void CopyTo (int sourceIndex, char[] destination, int destinationIndex, int count)
8         {
9                 string s = "test string-";
10                 fixed (char* dest = destination, src = s)
11                 {
12                         CharCopy (dest + destinationIndex, src + sourceIndex, count);
13                 }
14         }
15         
16         static unsafe void CharCopy (char *dest, char *src, int count)
17         {
18                 for (int i = 0; i < count; i++) {
19                         *dest++ = *src++;
20                 }
21         }
22         
23         public static int Main ()
24         {
25                 CopyTo (5, null, 0, 0);
26
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;
33                 
34                 return 0;
35         }
36 }