From 1ceafa03c2690fb86e43103b00c476142eb5e01d Mon Sep 17 00:00:00 2001 From: Alistair Evans Date: Fri, 11 Nov 2022 15:03:55 +0000 Subject: [PATCH] Add tests for IPv4 to BigInt --- tests/Enclave.FastPacket.Tests/ValueIpAddressTests.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/Enclave.FastPacket.Tests/ValueIpAddressTests.cs b/tests/Enclave.FastPacket.Tests/ValueIpAddressTests.cs index c176816..d57b1f5 100644 --- a/tests/Enclave.FastPacket.Tests/ValueIpAddressTests.cs +++ b/tests/Enclave.FastPacket.Tests/ValueIpAddressTests.cs @@ -73,6 +73,16 @@ public void CanConvertToUInt(string ip, uint expected) Assert.Equal(expected, ValueIpAddress.Create(IPAddress.Parse(ip)).ToUInt()); } + [Theory] + [InlineData("81.152.41.187", 1368926651u)] + [InlineData("100.154.122.4", 1687845380u)] + [InlineData("4.122.154.100", 75143780u)] + public void CanConvertIpV4ToBigInt(string ip, uint expected) + { + Assert.Equal(new BigInteger(expected), ValueIpAddress.Create(IPAddress.Parse(ip)).ToBigInteger()); + } + + [Fact] public void CannotConvertIpv6ToUInt() {