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 {
25 get { return expected; }
29 get { return this.error; }
32 public void Execute ()
36 for (int compiled = 0; compiled < 2; ++compiled) {
37 RegexOptions real_options = (compiled == 1) ? (options | RegexOptions.Compiled) : options;
39 Regex re = new Regex (pattern, real_options);
40 int [] group_nums = re.GetGroupNumbers ();
41 Match m = re.Match (input);
46 for (int i = 0; i < m.Groups.Count; ++ i) {
47 int gid = group_nums [i];
48 Group group = m.Groups [gid];
50 result += " Group[" + gid + "]=";
51 foreach (Capture cap in group.Captures)
52 result += "(" + cap.Index + "," + cap.Length + ")";
59 error = e.Message + "\n" + e.StackTrace + "\n\n";
64 Assert.AreEqual (expected, result,
65 "Matching input '{0}' against pattern '{1}' with options '{2}'", input, pattern, real_options);
79 public void Add (string str) {
80 for (int i = 0; i < str.Length; ++ i)
84 public void Add (uint n) {
88 public void Add (ulong n, int bits) {
89 ulong mask = 1ul << (bits - 1);
90 for (int i = 0; i < bits; ++ i) {
91 Add ((n & mask) != 0);
96 public void Add (bool bit) {
97 bool top = (sum & 0x80000000) != 0;
99 sum ^= bit ? (uint)1 : (uint)0;
106 private readonly uint key = 0x04c11db7;