test: 增加单元测试提高代码覆盖率

This commit is contained in:
Argo Zhang 2025-11-20 17:31:13 +08:00
parent 62ab160572
commit 9ef1fc34ac
1 changed files with 11 additions and 5 deletions

View File

@ -4,11 +4,17 @@ namespace IP2Region.Net.Test;
public class UtilTest public class UtilTest
{ {
[Theory] [Fact]
[InlineData("114.114.114.114")] public void IpAddressToUInt32_Ok()
public void TestIpAddressToUInt32(string value)
{ {
var uintIp = XDB.Util.IpAddressToUInt32(value); var uintIp = XDB.Util.IpAddressToUInt32("114.114.114.114");
Console.WriteLine(uintIp); Assert.Equal((uint)1920103026, uintIp);
}
[Fact]
public void GetMidIp_Ok()
{
var uintIp = XDB.Util.GetMidIp(1, 10);
Assert.Equal((uint)5, uintIp);
} }
} }