2 using System.Text.RegularExpressions;
6 namespace MonoTests.System.Text.RegularExpressions {
10 public RegexOptions options;
13 public string expected;
14 public string error = "";
16 public RegexTrial (string pattern, RegexOptions options, string input, string expected)
18 this.pattern = pattern;
19 this.options = options;
21 this.expected = expected;
24 public string Expected {
36 public void Execute ()
40 for (int compiled = 0; compiled < 2; ++compiled) {
41 RegexOptions real_options = (compiled == 1) ? (options | RegexOptions.Compiled) : options;
43 Regex re = new Regex (pattern, real_options);
44 int [] group_nums = re.GetGroupNumbers ();
45 Match m = re.Match (input);
50 for (int i = 0; i < m.Groups.Count; ++ i) {
51 int gid = group_nums [i];
52 Group group = m.Groups [gid];
54 result += " Group[" + gid + "]=";
55 foreach (Capture cap in group.Captures)
56 result += "(" + cap.Index + "," + cap.Length + ")";
63 error = e.Message + "\n" + e.StackTrace + "\n\n";
68 Assert.AreEqual (expected, result,
69 "Matching input '{0}' against pattern '{1}' with options '{2}'", input, pattern, real_options);
85 public void Add (string str) {
86 for (int i = 0; i < str.Length; ++ i)
90 public void Add (uint n) {
94 public void Add (ulong n, int bits) {
95 ulong mask = 1ul << (bits - 1);
96 for (int i = 0; i < bits; ++ i) {
97 Add ((n & mask) != 0);
102 public void Add (bool bit) {
103 bool top = (sum & 0x80000000) != 0;
105 sum ^= bit ? (uint)1 : (uint)0;
112 private readonly uint key = 0x04c11db7;