You've already forked linux-packaging-mono
Imported Upstream version 4.6.0.125
Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
This commit is contained in:
parent
a569aebcfd
commit
e79aa3c0ed
@ -145,16 +145,8 @@ public class IPAddressTest
|
||||
"0xff.0x7f.0x20.0xf", "255.127.32.15",
|
||||
"0.0.0.0", IPAddress.Any.ToString(),
|
||||
"255.255.255.255", IPAddress.Broadcast.ToString(),
|
||||
"12.1.1.3 abc", "12.1.1.3",
|
||||
"12.1 .1.2", "12.0.0.1",
|
||||
"12.1 .zzzz.2", "12.0.0.1",
|
||||
"12.1.7", "12.1.0.7",
|
||||
"12", "0.0.0.12",
|
||||
"12.5.3 foo.67.test.test.7FFFFFFFFFfaFFF789FFFFFFFFFFFFFFF", "12.5.0.3",
|
||||
"12.1 foo.bar.test.test.baf", "12.0.0.1",
|
||||
"12.1.4.6 foo.bar.test.test.baf", "12.1.4.6",
|
||||
"12.3 foo.bar.test.test.4", "12.0.0.3",
|
||||
"12 foo.bar.test.test.baf", "0.0.0.12",
|
||||
"65536", "0.1.0.0",
|
||||
"65535", "0.0.255.255",
|
||||
"20.65535", "20.0.255.255",
|
||||
@ -187,6 +179,14 @@ public class IPAddressTest
|
||||
"12...",
|
||||
" ",
|
||||
"7848198702",
|
||||
"12.1.1.3 abc",
|
||||
"12.1 .1.2",
|
||||
"12.1 .zzzz.2",
|
||||
"12.5.3 foo.67.test.test.7FFFFFFFFFfaFFF789FFFFFFFFFFFFFFF",
|
||||
"12.1 foo.bar.test.test.baf",
|
||||
"12.1.4.6 foo.bar.test.test.baf",
|
||||
"12.3 foo.bar.test.test.4",
|
||||
"12 foo.bar.test.test.baf",
|
||||
};
|
||||
|
||||
static byte [] ipv4MappedIPv6Prefix = new byte [] { 0,0, 0,0, 0,0, 0,0, 0,0, 0xFF,0xFF };
|
||||
@ -197,8 +197,8 @@ public class IPAddressTest
|
||||
Assert.AreEqual ((long) 0, IPAddress.Any.Address, "#1");
|
||||
Assert.AreEqual ((long) 0xFFFFFFFF, IPAddress.Broadcast.Address, "#2");
|
||||
long loopback = IPAddress.HostToNetworkOrder (BitConverter.IsLittleEndian ?
|
||||
0x7f000001 :
|
||||
0x0100007f);
|
||||
0x7f000001 :
|
||||
0x0100007f);
|
||||
Assert.AreEqual (loopback, IPAddress.Loopback.Address, "#3");
|
||||
Assert.AreEqual ((long) 0xFFFFFFFF, IPAddress.None.Address, "#4");
|
||||
}
|
||||
@ -241,8 +241,8 @@ public class IPAddressTest
|
||||
[Test]
|
||||
public void IsLoopbackV6 ()
|
||||
{
|
||||
if (!Socket.SupportsIPv6)
|
||||
Assert.Ignore ("IPv6 must be enabled in machine.config");
|
||||
// if (!Socket.SupportsIPv6)
|
||||
// Assert.Ignore ("IPv6 must be enabled in machine.config");
|
||||
|
||||
IPAddress ip = IPAddress.IPv6Loopback;
|
||||
Assert.IsTrue (IPAddress.IsLoopback (ip), "#1");
|
||||
@ -277,24 +277,16 @@ public class IPAddressTest
|
||||
[Test]
|
||||
public void Address ()
|
||||
{
|
||||
// hm, lame, anything is accepted by ms.net
|
||||
/*
|
||||
try {
|
||||
IPAddress ip1 = new IPAddress (0x0000000100000000);
|
||||
Assertion.Fail ("#1");
|
||||
Assert.Fail ("#1");
|
||||
} catch (ArgumentOutOfRangeException) {}
|
||||
|
||||
IPAddress ip = IPAddress.Parse ("127.0.0.1");
|
||||
ip.Address = 0;
|
||||
ip.Address = 0xffffffff;
|
||||
try {
|
||||
ip.Address = -1;
|
||||
Assertion.Fail ("#2");
|
||||
} catch (ArgumentOutOfRangeException) {}
|
||||
try {
|
||||
ip.Address = 0x0000000100000000;
|
||||
Assertion.Fail ("#3");
|
||||
} catch (ArgumentOutOfRangeException) {}
|
||||
*/
|
||||
ip.Address = -1;
|
||||
ip.Address = 0x0000000100000000;
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -532,16 +524,11 @@ public class IPAddressTest
|
||||
public void TryParse_IpString_Null ()
|
||||
{
|
||||
IPAddress i;
|
||||
|
||||
try {
|
||||
IPAddress.TryParse ((string) null, out i);
|
||||
Assert.Fail ("#1");
|
||||
} catch (ArgumentNullException ex) {
|
||||
Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
|
||||
Assert.IsNull (ex.InnerException, "#3");
|
||||
Assert.IsNotNull (ex.Message, "#4");
|
||||
Assert.AreEqual ("ipString", ex.ParamName, "#5");
|
||||
}
|
||||
|
||||
bool val1 = IPAddress.TryParse ((string) null, out i);
|
||||
|
||||
Assert.IsFalse (val1, "#1");
|
||||
Assert.IsNull (i, "#2");
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -625,8 +612,8 @@ public class IPAddressTest
|
||||
[Test]
|
||||
public void ParseWrongV6 ()
|
||||
{
|
||||
if (!Socket.SupportsIPv6)
|
||||
Assert.Ignore ("IPv6 must be enabled in machine.config");
|
||||
//if (!Socket.SupportsIPv6)
|
||||
// Assert.Ignore ("IPv6 must be enabled in machine.config");
|
||||
|
||||
for (int i = 0; i < ipv6ParseWrong.Length; i++) {
|
||||
string ipAddress = ipv6ParseWrong [i];
|
||||
@ -636,14 +623,12 @@ public class IPAddressTest
|
||||
Assert.Fail ("#1:" + i + " (" + ipAddress + ")");
|
||||
} catch (FormatException ex) {
|
||||
Assert.AreEqual (typeof (FormatException), ex.GetType (), "#2:" + i);
|
||||
Assert.IsNull (ex.InnerException, "#3:" + i);
|
||||
Assert.AreEqual(typeof(SocketException), ex.InnerException.GetType (), "#3:" + i);
|
||||
Assert.IsNotNull (ex.Message, "#4:" + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if NET_4_5
|
||||
|
||||
[Test]
|
||||
public void MapToIPv6 ()
|
||||
{
|
||||
@ -678,8 +663,6 @@ public class IPAddressTest
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
[Test]
|
||||
public void EqualsFromBytes ()
|
||||
{
|
||||
@ -691,6 +674,18 @@ public class IPAddressTest
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("NotDotNet")]
|
||||
public void UnixInterfaceNameAsZoneIndex ()
|
||||
{
|
||||
var ip = IPAddress.Parse ("fe80::bae8:56ff:fe47:af7e%en0");
|
||||
|
||||
// Should be en0 but it's of long type!
|
||||
Assert.AreEqual (0, ip.ScopeId);
|
||||
|
||||
Assert.AreEqual ("fe80::bae8:56ff:fe47:af7e", ip.ToString ());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user