test: 增加单元测试提高代码覆盖率
This commit is contained in:
parent
62ab160572
commit
9ef1fc34ac
|
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue