New test.
[mono.git] / mcs / class / corlib / Mono.Globalization.Unicode / StringNormalizationTestSource.cs
1 using System;
2 using System.Globalization;
3 using System.Collections;
4 using System.Text;
5
6 namespace MonoTests.System
7 {
8         public class StringNormalizationTest
9         {
10                 ArrayList tests = new ArrayList ();
11
12                 class Testcase
13                 {
14                         public Testcase (string src, string nfc, string nfd, string nfkc, string nfkd, int testType)
15                         {
16                                 this.Source = src;
17                                 NFC = nfc;
18                                 NFD = nfd;
19                                 NFKC = nfkc;
20                                 NFKD = nfkd;
21                                 TestType = testType;
22                         }
23
24                         public string Source;
25                         public string NFC;
26                         public string NFD;
27                         public string NFKC;
28                         public string NFKD;
29                         public int TestType;
30                 }
31
32 #if TEST_STANDALONE
33                 public static void Main ()
34                 {
35                         new StringNormalizationTest ().Run ();
36                 }
37 #endif
38
39                 public StringNormalizationTest ()
40                 {
41                         Fill ();
42                 }
43
44                 void Run ()
45                 {
46                         foreach (Testcase tc in tests) {
47                                 TestString (tc, tc.NFD, NormalizationForm.FormD);
48                                 TestString (tc, tc.NFKD, NormalizationForm.FormKD);
49                                 TestString (tc, tc.NFC, NormalizationForm.FormC);
50                                 TestString (tc, tc.NFKC, NormalizationForm.FormKC);
51                         }
52                 }
53
54                 void TestString (Testcase tc, string expected, NormalizationForm f)
55                 {
56                         string actual = tc.Source.Normalize (f);
57                         if (actual != expected)
58                                 Console.WriteLine ("Error: expected {0} but was {1} (for {2},type{3} form {4})",
59                                 expected, actual, tc.Source, tc.TestType, f);
60                 }
61
62                 public void Fill ()
63                 {
64 @@@@@@ Replace Here @@@@@@
65                 }
66         }
67 }