X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=textprop.cs;h=c44f0e8a6f72b1f2d9990b5080d3534b78534b5d;hb=3c2834c6fba999e42f5f49bb22a5343209b1bc65;hp=391e113aa457da8de15394ac5a28e7bd81aaccd5;hpb=48b06b6df84ac937f4e1a1a16de355ccdc3c18ad;p=m17n%2Fm17n-lib-cs.git diff --git a/textprop.cs b/textprop.cs index 391e113..c44f0e8 100644 --- a/textprop.cs +++ b/textprop.cs @@ -8,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]; @@ -36,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) @@ -113,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) @@ -198,7 +220,7 @@ 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) @@ -232,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: @@ -263,9 +285,11 @@ public class Test break; } + if (M17n.debug) + mt.DumpPropNested (); + if (Compare () == false) { - mt.DumpPropNested (); Console.WriteLine (""); Dump (); Console.WriteLine ("Failed.");