dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnetlib/tests/System TestUri.cs,1.10,1.11


From: Gopal.V <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/tests/System TestUri.cs,1.10,1.11
Date: Sat, 24 May 2003 13:47:41 -0400

Update of /cvsroot/dotgnu-pnet/pnetlib/tests/System
In directory subversions:/tmp/cvs-serv13766/tests/System

Modified Files:
        TestUri.cs 
Log Message:
Improved test cases for Uri classes


Index: TestUri.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/tests/System/TestUri.cs,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** TestUri.cs  22 Nov 2002 19:06:29 -0000      1.10
--- TestUri.cs  24 May 2003 17:47:39 -0000      1.11
***************
*** 32,38 ****
  
  public class TestUri : TestCase
!  {
  
        Uri rmsUri, pathEnding, noPathEnding;
  
        // Constructor.
--- 32,42 ----
  
  public class TestUri : TestCase
! {
  
        Uri rmsUri, pathEnding, noPathEnding;
+       const String rmsString
+                               
="ftp://address@hidden:2538/pub/gnu/?freesoftware=good";;
+       const String guileDir= "http://www.gnu.org/software/../software/guile/";;
+       const String guileFile= "http://www.gnu.org/software/../software/guile";;
  
        // Constructor.
***************
*** 45,51 ****
        protected override void Setup()
        {
!               this.rmsUri = new 
Uri("ftp://address@hidden:2538/pub/gnu/?freesoftware=good";);
!               this.pathEnding = new 
Uri("http://www.gnu.org/software/../software/guile/";);
!               this.noPathEnding = new 
Uri("http://www.gnu.org/software/../software/guile";);
        }
  
--- 49,55 ----
        protected override void Setup()
        {
!               this.rmsUri = new Uri(rmsString);
!               this.pathEnding = new Uri(guileDir);
!               this.noPathEnding = new Uri(guileFile);
        }
  
***************
*** 55,82 ****
                // Nothing to do here.
        }
! 
!       private bool constructorTested = false;
        public void TestUriConstructor()
        {
!               try
                {
!                       if (!constructorTested) // others depend on this one
!                       {
!                               String lasturi = null;
!                               try // good constructors
!                               {
!                                       Uri myUri = new Uri(lasturi = 
"ftp://address@hidden:2538/pub/gnu/?freesoftware=good";);
!                                       myUri = new Uri(lasturi = 
"http://www.gnu.org/software/../software/guile/";);
!                                       myUri = new Uri(lasturi = 
"http://www.gnu.org/software/../software/guile";);
!                               }
!                               catch (Exception)
!                               {
!                                       Fail(lasturi.ToString()+" threw an 
exception it shouldn't have!");
!                               }
!                       }
                }
!               finally
                {
!                       constructorTested = true;
                }
        }
--- 59,77 ----
                // Nothing to do here.
        }
! 
        public void TestUriConstructor()
        {
!               String lasturi = null;
!               try // good constructors
                {
!                       new Uri(lasturi = rmsString);
!                       new Uri(lasturi = guileDir);
!                       new Uri(lasturi = guileFile);
!                       new Uri(lasturi = "mailto:address@hidden";);
!                       new Uri(lasturi = "jabber:address@hidden/MyPresence");
                }
!               catch (Exception)
                {
!                       Fail(lasturi.ToString()+" threw an exception it 
shouldn't have!");
                }
        }
***************
*** 84,94 ****
        public void TestUriCanonicalize()
        {
!               AssertEquals("StripMetaDirectories should keep the ending slash 
when there is one",
!                            pathEnding.AbsolutePath,
!                            "/software/guile/");
!               AssertEquals("StripMetaDirectories shouldn't have an ending 
slash when there isn't one",
!                            noPathEnding.AbsolutePath,
!                            "/software/guile");
                
        }
  
--- 79,88 ----
        public void TestUriCanonicalize()
        {
!               AssertEquals("Should keep the ending slash when there is one",
!                                    "/software/guile/", 
pathEnding.AbsolutePath);
                
+               AssertEquals("Shouldn't have an ending slash when there isn't 
one",
+                               "/software/guile",
+                                    noPathEnding.AbsolutePath);
        }
  
***************
*** 96,133 ****
        {
                AssertEquals("www.gnu.org is a DNS name",
!                            Uri.CheckHostName("www.gnu.org"),
!                            UriHostNameType.Dns);
                AssertEquals("www.southern.-storm.com.au is not a DNS name",
!                            Uri.CheckHostName("www.southern.-storm.com.au"),
!                            UriHostNameType.Unknown);
                AssertEquals("www.southern-storm.com.au is a DNS name",
!                            Uri.CheckHostName("www.southern-storm.com.au"),
!                            UriHostNameType.Dns);
                AssertEquals("127.0.0.1 is an IPv4 address",
!                            Uri.CheckHostName("127.0.0.1"),
!                            UriHostNameType.IPv4);
                AssertEquals(".63.64.201.1 is not an IPv4 address",
!                            Uri.CheckHostName(".63.64.201.1"),
!                            UriHostNameType.Unknown);
                AssertEquals("207..211.18.4 is not an IPv4 address",
!                            Uri.CheckHostName("207..211.18.4"),
!                            UriHostNameType.Unknown);
  
                // checking IPng
!               /*
                AssertEquals(":F0F0::0 should have bad IPng zerocompress at 
beginning",
!                            Uri.CheckHostName(":F0F0::0"),
!                            UriHostNameType.Unknown);*/
  
                AssertEquals("::F0F0:0 allows fake zerocompress at beginning",
!                            Uri.CheckHostName("::F0F0:0"),
!                            UriHostNameType.IPv6);
!               /*
                AssertEquals("0:1:2:3:4:5:6:127.0.0.1 has too many elements",
!                            Uri.CheckHostName("0:1:2:3:4:5:6:127.0.0.1"),
!                            UriHostNameType.Unknown);*/
                AssertEquals("0:1:2:3:4:5:127.0.0.1 has the right number of 
elements",
!                            Uri.CheckHostName("0:1:2:3:4:5:127.0.0.1"),
!                            UriHostNameType.IPv6);
        }
  
--- 90,126 ----
        {
                AssertEquals("www.gnu.org is a DNS name",
!                            UriHostNameType.Dns,
!                            Uri.CheckHostName("www.gnu.org"));
                AssertEquals("www.southern.-storm.com.au is not a DNS name",
!                            UriHostNameType.Unknown,
!                            Uri.CheckHostName("www.southern.-storm.com.au"));
                AssertEquals("www.southern-storm.com.au is a DNS name",
!                            UriHostNameType.Dns,
!                            Uri.CheckHostName("www.southern-storm.com.au"));
                AssertEquals("127.0.0.1 is an IPv4 address",
!                            UriHostNameType.IPv4,
!                            Uri.CheckHostName("127.0.0.1"));
                AssertEquals(".63.64.201.1 is not an IPv4 address",
!                            UriHostNameType.Unknown,
!                            Uri.CheckHostName(".63.64.201.1"));
                AssertEquals("207..211.18.4 is not an IPv4 address",
!                            UriHostNameType.Unknown,
!                            Uri.CheckHostName("207..211.18.4"));
  
                // checking IPng
! 
                AssertEquals(":F0F0::0 should have bad IPng zerocompress at 
beginning",
!                            UriHostNameType.Unknown,
!                            Uri.CheckHostName(":F0F0::0"));
  
                AssertEquals("::F0F0:0 allows fake zerocompress at beginning",
!                            UriHostNameType.IPv6,
!                            Uri.CheckHostName("::F0F0:0"));
                AssertEquals("0:1:2:3:4:5:6:127.0.0.1 has too many elements",
!                            UriHostNameType.Unknown,
!                            Uri.CheckHostName("0:1:2:3:4:5:6:127.0.0.1"));
                AssertEquals("0:1:2:3:4:5:127.0.0.1 has the right number of 
elements",
!                            UriHostNameType.IPv6,
!                            Uri.CheckHostName("0:1:2:3:4:5:127.0.0.1"));
        }
  
***************
*** 225,230 ****
        }
  
-       /* TODO */
- /*
        public void TestUriMakeRelative()
        {
--- 218,221 ----
***************
*** 237,243 ****
                Uri debianrelease = new 
Uri("ftp://distro.ibiblio.org/pub/Linux/distributions/debian/main/source/Release";);
  
!               AssertEquals("Code figures out simple relative Uri correctly 
(with files)",
                             gnuphil.MakeRelative(gnuoreilly),
!                            "../thegnuproject.html");
                AssertEquals("notices different schemes when comparing Uris",
                             mozillaftp.MakeRelative(mozillahttp),
--- 228,235 ----
                Uri debianrelease = new 
Uri("ftp://distro.ibiblio.org/pub/Linux/distributions/debian/main/source/Release";);
  
!               AssertEquals(
!                               "Code figures out simple relative Uri correctly 
(with files)",
                             gnuphil.MakeRelative(gnuoreilly),
!                            "../gnu/thegnuproject.html");
                AssertEquals("notices different schemes when comparing Uris",
                             mozillaftp.MakeRelative(mozillahttp),
***************
*** 250,254 ****
                AssertEquals("correctly goes further into subdirectories",
                        debian.MakeRelative(debianrelease), "source/Release");
!       }*/
  
        // Parse N/A
--- 242,246 ----
                AssertEquals("correctly goes further into subdirectories",
                        debian.MakeRelative(debianrelease), "source/Release");
!       }
  
        // Parse N/A
***************
*** 256,260 ****
        public void TestUriToString()
        {
!       /*TODO*/
        }
  
--- 248,259 ----
        public void TestUriToString()
        {
!               Uri uri=new Uri("http://dotgnu.org:80";);        
!               AssertEquals("Removing default ports from uris",
!                                       "http://dotgnu.org/";,
!                                       uri.ToString());
!               uri = new Uri("mailto:developers:address@hidden";);
!               AssertEquals("Passwords in the uris",
!                                       "mailto:developers:address@hidden";,
!                                       uri.ToString());
        }
  
***************
*** 263,267 ****
        /*TODO*/
        }
- 
        public void TestUriAbsolutePath()
        {
--- 262,265 ----





reply via email to

[Prev in Thread] Current Thread [Next in Thread]