Skip to content

Commit

Permalink
2009-01-20 Gonzalo Paniagua Javier <gonzalo@novell.com>
Browse files Browse the repository at this point in the history
	* IPAddressTest.cs: tests for bug #467472.


svn path=/trunk/mcs/; revision=123858
  • Loading branch information
gonzalop committed Jan 20, 2009
1 parent 975f926 commit 86c70cb
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
4 changes: 4 additions & 0 deletions mcs/class/System/Test/System.Net/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@

2009-01-20 Gonzalo Paniagua Javier <gonzalo@novell.com>

* IPAddressTest.cs: tests for bug #467472.

2009-01-16 Gonzalo Paniagua Javier <gonzalo@novell.com>

* FtpWebRequestTest.cs: add directory listing test when the $HOME is
Expand Down
26 changes: 26 additions & 0 deletions mcs/class/System/Test/System.Net/IPAddressTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,32 @@ public void Constructor1_Address_Null ()
}

#if NET_2_0
[Test]
public void FromBytes1 ()
{
byte[] val1 = new byte[4];
val1[0] = 82;
val1[1] = 165;
val1[2] = 240;
val1[3] = 134;
CompareIPs (val1, "82.165.240.134");

byte[] val2 = new byte[4];
val2[0] = 123;
val2[1] = 124;
val2[2] = 125;
val2[3] = 126;
CompareIPs (val2, "123.124.125.126");
}

void CompareIPs (byte [] bytes, string address)
{
IPAddress ip = new IPAddress (bytes);
IPAddress ip2 = IPAddress.Parse (address);
Assert.IsTrue (ip2.Equals (ip), "#A-" + address);
Assert.IsTrue (ip.Equals (ip2), "#B-" + address);
}

[Test]
public void TryParse_IpString_Null ()
{
Expand Down

0 comments on commit 86c70cb

Please sign in to comment.