2 using System.Text.RegularExpressions;
4 namespace MonoTests.System.Text.RegularExpressions {
8 public RegexOptions options;
11 public string expected;
12 public string error = "";
14 public RegexTrial (string pattern, RegexOptions options, string input, string expected) {
15 this.pattern = pattern;
16 this.options = options;
18 this.expected = expected;
21 public string Expected {
22 get { return expected; }
31 public string Execute () {
34 Regex re = new Regex (pattern, options);
35 Match m = re.Match (input);
40 for (int i = 0; i < m.Groups.Count; ++ i) {
41 Group group = m.Groups[i];
43 result += " Group[" + i + "]=";
44 foreach (Capture cap in group.Captures) {
45 result += "(" + cap.Index + "," + cap.Length + ")";
54 error = e.Message + "\n" + e.StackTrace + "\n\n";
62 public override string ToString () {
64 "Matching input '" + input +
65 "' against pattern '" + pattern +
66 "' with options '" + 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;