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 ()
37 Regex re = new Regex (pattern, options);
38 Match m = re.Match (input);
43 for (int i = 0; i < m.Groups.Count; ++ i) {
44 Group group = m.Groups [i];
46 result += " Group[" + i + "]=";
47 foreach (Capture cap in group.Captures)
48 result += "(" + cap.Index + "," + cap.Length + ")";
55 error = e.Message + "\n" + e.StackTrace + "\n\n";
60 Assert.AreEqual (expected, result,
61 "Matching input '{0}' against pattern '{1}' with options '{2}'", input, pattern, options);
74 public void Add (string str) {
75 for (int i = 0; i < str.Length; ++ i)
79 public void Add (uint n) {
83 public void Add (ulong n, int bits) {
84 ulong mask = 1ul << (bits - 1);
85 for (int i = 0; i < bits; ++ i) {
86 Add ((n & mask) != 0);
91 public void Add (bool bit) {
92 bool top = (sum & 0x80000000) != 0;
94 sum ^= bit ? (uint)1 : (uint)0;
101 private readonly uint key = 0x04c11db7;