Test for System.Xml.NameTable.
authorDuncan Mak <duncan@mono-cvs.ximian.com>
Tue, 26 Feb 2002 22:02:59 +0000 (22:02 -0000)
committerDuncan Mak <duncan@mono-cvs.ximian.com>
Tue, 26 Feb 2002 22:02:59 +0000 (22:02 -0000)
svn path=/trunk/mcs/; revision=2698

mcs/class/System.XML/Test/AllTests.cs
mcs/class/System.XML/Test/ChangeLog
mcs/class/System.XML/Test/NameTableTests.cs [new file with mode: 0755]

index af0f25b42088b9f28b3ec09f51213dafc4223a37..05522af3132b525d6afe016356bd55bc56b55edd 100644 (file)
@@ -22,6 +22,7 @@ namespace Ximian.Mono.Tests
                                suite.AddTest(new TestSuite(typeof(XmlTextReaderTests)));
                                suite.AddTest(new TestSuite(typeof(XmlNamespaceManagerTests)));
                                suite.AddTest(new TestSuite(typeof(XmlDocumentTests)));
+                               suite.AddTest (new TestSuite (typeof (NameTableTests)));
                                return suite;
                        }
                }
index 9f87842b23375c52353f38d9b4346c8c9afdb938..c15e55a32487edb774ac6819584365b4d4034470 100644 (file)
@@ -1,3 +1,7 @@
+2002-02-26  Duncan Mak  <duncan@ximian.com>
+
+       * NameTableTests.cs: Test for System.Xml.NameTable.
+
 2002-02-26  Jason Diamond <jason@injektilo.org>
 
        * XmlTextReaderTests.cs: Test for namespace declarations as
diff --git a/mcs/class/System.XML/Test/NameTableTests.cs b/mcs/class/System.XML/Test/NameTableTests.cs
new file mode 100755 (executable)
index 0000000..854ba9e
--- /dev/null
@@ -0,0 +1,88 @@
+//
+// System.Xml.NameTableTests.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+using System.Diagnostics;
+using System.Xml;
+
+using NUnit.Framework;
+
+namespace Ximian.Mono.Tests
+{
+       public class NameTableTests : TestCase
+       {
+               NameTable table;
+               
+               public NameTableTests (string name)
+                       : base (name)
+               {
+               }
+
+               protected override void SetUp ()
+               {
+                       table = new NameTable ();
+               }
+
+               //
+               // Tests System.Xml.NameTable.Add (string)
+               //              
+               public void TestAdd1 ()
+               {
+                       string testAdd =  table.Add ("add1");
+                       AssertEquals ("add1", testAdd);
+               }
+
+               //
+               // Tests System.Xml.NameTable.Add (char[], int, int)
+               //              
+               public void TestAdd2 ()
+               {
+                       char[] test = new char [4] { 'a', 'd', 'd', '2' };
+                       int index = 0;
+                       int length = 3; // "add"                        
+
+                       AssertEquals ("add", table.Add (test, index, length));
+               }
+
+               //
+               // Tests System.Xml.NameTable.Get (string)
+               //
+               public void TestGet1 ()
+               {
+                       string testGet = table.Add ("get1");                    
+
+                       AssertEquals (table.Get ("get1"), testGet);
+               }
+
+               //
+               // Tests System.Xml.NameTable.Get (char[], int, int)
+               //
+               public void TestGet2 ()
+               {                                               
+                       char[] test = new char [4] { 'g', 'e', 't', '2' };
+                       int index = 0; 
+                       int length = 3; // "get"
+                       
+                       string testGet = table.Add (test, index, length);                       
+
+                       AssertEquals (table.Get (test, index, length), testGet);
+               }
+
+               //
+               // Tests System.Xml.NameTable.Get (char[], int, 0)
+               //
+               public void TestGet3 ()
+               {
+                       char[] test = new char [4] { 't', 'e', 's', 't' };
+                       int index = 0;
+                       int length = 0;
+
+                       AssertEquals (table.Get (test, index, length), String.Empty);
+               }
+       }
+}