4 using Commons.Xml.Relaxng;
\r
5 using Commons.Xml.Relaxng.Rnc;
\r
9 public static void Main (string [] args)
\r
11 bool outAll = false;
\r
12 bool details = false;
\r
13 bool stopOnError = false;
\r
14 string filter = null;
\r
15 foreach (string arg in args) {
\r
18 outAll = true; break;
\r
20 details = true; break;
\r
21 case "--stoponerror":
\r
22 stopOnError = true; break;
\r
24 filter = arg; break;
\r
29 XmlDocument doc = new XmlDocument ();
\r
30 doc.Load ("test/RNCTest.xml");
\r
33 foreach (XmlElement el in doc.SelectNodes ("/RNCTestCases/TestCase")) {
\r
34 string id = el.GetAttribute ("id");
\r
35 if (filter != null && id.IndexOf (filter) < 0)
\r
38 Console.WriteLine ("testing " + id);
\r
39 bool isValid = el.GetAttribute ("legal") == "true";
\r
40 RncParser p = new RncParser (new NameTable ());
\r
42 string s = new StreamReader ("test" + Path.DirectorySeparatorChar + el.GetAttribute ("path")).ReadToEnd ();
\r
43 p.Parse (new StringReader (s));
\r
46 // Console.Error.WriteLine ("valid " + id);
\r
49 Console.Error.WriteLine ("INCORRECTLY VALID " + id);
\r
51 } catch (Exception ex) {
\r
56 Console.Error.WriteLine ("INCORRECTLY INVALID " + id + " --> " + (details ? ex.ToString () : ex.Message));
\r
59 // Console.Error.WriteLine ("invalid " + id);
\r
63 Console.Error.WriteLine ("Total success: " + success);
\r
64 Console.Error.WriteLine ("Total failure: " + failure);
\r
65 } catch (Exception ex) {
\r
66 Console.Error.WriteLine ("Unexpected Exception: " + ex);
\r