*** empty log message ***
[m17n/m17n-lib-cs.git] / textprop.cs
index 3a020de..c44f0e8 100644 (file)
@@ -1,5 +1,6 @@
 using System;
 using System.Collections.Generic;
+using M17N;
 using M17N.Core;
 
 public class Test
@@ -7,13 +8,35 @@ public class Test
   const int LENGTH = 10;
   const int DEPTH = 10;
   static MText mt = new MText ("0123456789");
-  static MSymbol key = new MSymbol ("k");
-  static MSymbol val0 = new MSymbol ("0");
-  static MSymbol val1 = new MSymbol ("1");
-  static MSymbol val2 = new MSymbol ("2");
-  static MTextProperty prop0 = new MTextProperty (key, val0);
-  static MTextProperty prop1 = new MTextProperty (key, val1);
-  static MTextProperty prop2 = new MTextProperty (key, val2);
+  static MSymbol key = MSymbol.PropertyKey ("___");
+#if false
+  static MSymbol key_r = MSymbol.PropertyKey ("r__",
+                                             MProperty.Flags.RearSticky);
+  static MSymbol key_f = MSymbol.PropertyKey ("_f_",
+                                             MProperty.Flags.FrontSticky);
+  static MSymbol key_rf = MSymbol.PropertyKey ("rf_",
+                                              (MProperty.Flags.RearSticky
+                                               | MProperty.Flags.FrontSticky));
+  static MSymbol key_s = MSymbol.PropertyKey ("__s",
+                                             MProperty.Flags.Sensitive);
+  static MSymbol key_rs = MSymbol.PropertyKey ("r_s",
+                                              (MProperty.Flags.RearSticky
+                                               | MProperty.Flags.Sensitive));
+  static MSymbol key_fs = MSymbol.PropertyKey ("_fs",
+                                              (MProperty.Flags.FrontSticky
+                                               | MProperty.Flags.Sensitive));
+  static MSymbol key_rfs = MSymbol.PropertyKey ("rfs",
+                                               (MProperty.Flags.RearSticky
+                                                | MProperty.Flags.FrontSticky
+                                                | MProperty.Flags.Sensitive));
+#endif
+
+  static MSymbol val0 = MSymbol.Of ("0");
+  static MSymbol val1 = MSymbol.Of ("1");
+  static MSymbol val2 = MSymbol.Of ("2");
+  static MProperty prop0 = new MProperty (key, val0);
+  static MProperty prop1 = new MProperty (key, val1);
+  static MProperty prop2 = new MProperty (key, val2);
 
   static int[] nvals = new int[LENGTH];
   static MSymbol[,] valtable = new MSymbol[LENGTH, DEPTH + 1];
@@ -35,7 +58,7 @@ public class Test
     mt.PushProp (from, to, key, val);
   }
 
-  static void TestPushProp (int from, int to, MTextProperty prop)
+  static void TestPushProp (int from, int to, MProperty prop)
   {
     for (int i = from; i < to; i++)
       if (nvals[i] == DEPTH)
@@ -112,7 +135,7 @@ public class Test
   {
     for (int i = 0; i < LENGTH; i++)
       {
-       MTextProperty[] array;
+       MProperty[] array;
        object val = mt.GetProp (i, key, out array);
 
        if (array == null)
@@ -197,14 +220,14 @@ public class Test
     Random r = new Random (int.Parse (args[0]));
     int check = (args.Length > 1 ? int.Parse (args[1]) : 0xFFFFFFF);
 
-    for (int loop = 0; loop < 100000; loop++)
+    for (int loop = 0; loop < 1000000; loop++)
       {
        Console.WriteLine ("--- loop = {0} ---\n", loop);
        if (loop >= check)
          {
            mt.DumpPropNested ();
            Dump ();
-           M17N.M17N.debug = true;
+           M17n.debug = true;
          }
 
        int from = r.Next (LENGTH);
@@ -231,8 +254,8 @@ public class Test
            break;
          }
 
-       MTextProperty prop;
-       //MTextProperty prop = r.Next (2) == 0 ? prop0 : prop1;
+       MProperty prop;
+       //MProperty prop = r.Next (2) == 0 ? prop0 : prop1;
        switch (r.Next (3))
          {
          case 0:
@@ -262,9 +285,11 @@ public class Test
            break;
          }
 
+       if (M17n.debug)
+         mt.DumpPropNested ();
+
        if (Compare () == false)
          {
-           mt.DumpPropNested ();
            Console.WriteLine ("");
            Dump ();
            Console.WriteLine ("Failed.");