mirror of
https://github.com/lionsoul2014/ip2region.git
synced 2026-02-01 17:46:15 +00:00
test: 增加单元测试提高代码覆盖率
This commit is contained in:
parent
62ab160572
commit
9ef1fc34ac
@ -4,11 +4,17 @@ namespace IP2Region.Net.Test;
|
||||
|
||||
public class UtilTest
|
||||
{
|
||||
[Theory]
|
||||
[InlineData("114.114.114.114")]
|
||||
public void TestIpAddressToUInt32(string value)
|
||||
[Fact]
|
||||
public void IpAddressToUInt32_Ok()
|
||||
{
|
||||
var uintIp = XDB.Util.IpAddressToUInt32(value);
|
||||
Console.WriteLine(uintIp);
|
||||
var uintIp = XDB.Util.IpAddressToUInt32("114.114.114.114");
|
||||
Assert.Equal((uint)1920103026, uintIp);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GetMidIp_Ok()
|
||||
{
|
||||
var uintIp = XDB.Util.GetMidIp(1, 10);
|
||||
Assert.Equal((uint)5, uintIp);
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user