From f03861162f8fca5cf4072ec91e12b13fb46bfe71 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Thu, 20 Nov 2025 17:50:33 +0800 Subject: [PATCH] =?UTF-8?q?test:=20=E5=A2=9E=E5=8A=A0=E5=85=A8=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=AA=8C=E8=AF=81=E5=8D=95=E5=85=83=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../csharp/IP2Region.Net.Test/SearcherTest.cs | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/binding/csharp/IP2Region.Net.Test/SearcherTest.cs b/binding/csharp/IP2Region.Net.Test/SearcherTest.cs index 36716f1..1c88d8d 100644 --- a/binding/csharp/IP2Region.Net.Test/SearcherTest.cs +++ b/binding/csharp/IP2Region.Net.Test/SearcherTest.cs @@ -99,29 +99,29 @@ public class SearcherTest Assert.Equal(expected, region); } - //[Theory] - //[InlineData(CachePolicy.Content, "v4")] - //[InlineData(CachePolicy.VectorIndex, "v4")] - //[InlineData(CachePolicy.File, "v4")] - //[InlineData(CachePolicy.Content, "v6")] - //[InlineData(CachePolicy.VectorIndex, "v6")] - //[InlineData(CachePolicy.File, "v6")] - //public void TestBenchSearch(CachePolicy cachePolicy, string version) - //{ - // var _xdbPath = version == "v4" ? _xdbPathV4 : _xdbPathV6; - // var searcher = new Searcher(cachePolicy, _xdbPath); - // var srcPath = Path.Combine(AppContext.BaseDirectory, "TestData", $"ip{version}_source.txt"); + [Theory] + [InlineData(CachePolicy.Content, "v4")] + [InlineData(CachePolicy.VectorIndex, "v4")] + [InlineData(CachePolicy.File, "v4")] + [InlineData(CachePolicy.Content, "v6")] + [InlineData(CachePolicy.VectorIndex, "v6")] + [InlineData(CachePolicy.File, "v6")] + public void TestBenchSearch(CachePolicy cachePolicy, string version) + { + var _xdbPath = version == "v4" ? _xdbPathV4 : _xdbPathV6; + var searcher = new Searcher(cachePolicy, _xdbPath); + var srcPath = Path.Combine(AppContext.BaseDirectory, "TestData", $"ip{version}_source.txt"); - // foreach (var line in File.ReadLines(srcPath)) - // { - // var ps = line.Trim().Split("|", 3); - // var sip = ps[0]; - // var eip = ps[1]; + foreach (var line in File.ReadLines(srcPath)) + { + var ps = line.Trim().Split("|", 3); + var sip = ps[0]; + var eip = ps[1]; - // var s1 = searcher.Search(sip); - // var s2 = searcher.Search(eip); - // Assert.Equal(s1, ps[2]); - // Assert.Equal(s2, ps[2]); - // } - //} + var s1 = searcher.Search(sip); + var s2 = searcher.Search(eip); + Assert.Equal(s1, ps[2]); + Assert.Equal(s2, ps[2]); + } + } } \ No newline at end of file