41 lines
897 B
C#
41 lines
897 B
C#
using NUnit.Framework;
|
|
using System;
|
|
|
|
namespace ln.types.test
|
|
{
|
|
[TestFixture()]
|
|
public class TypesTests
|
|
{
|
|
string[] ipv6TestPatterns = new string[] {
|
|
"::",
|
|
"::1",
|
|
"0.0.0.0/0",
|
|
"127.0.0.1",
|
|
""
|
|
};
|
|
|
|
|
|
[Test()]
|
|
public void IPv6Tests()
|
|
{
|
|
Console.WriteLine("Testing IPv6 class");
|
|
|
|
IPv6 localhostv6 = IPv6.Parse("::1");
|
|
IPv6 localhostv4 = IPv6.Parse("127.0.0.1");
|
|
|
|
foreach (String pattern in ipv6TestPatterns)
|
|
{
|
|
IPv6 ipv6 = IPv6.Parse(pattern);
|
|
IPv6 ipv6b = IPv6.Parse(ipv6.ToCIDR());
|
|
|
|
Assert.AreEqual(ipv6, ipv6b);
|
|
}
|
|
|
|
{
|
|
IPv6 ipv6 = IPv6.Parse("::/128") + 1;
|
|
Assert.AreEqual(ipv6, localhostv6);
|
|
}
|
|
}
|
|
}
|
|
}
|