test: 更新单元测试

This commit is contained in:
Argo Zhang 2025-11-20 16:25:38 +08:00
parent a2778f9b98
commit 87666aa353
1 changed files with 13 additions and 10 deletions

View File

@ -69,22 +69,25 @@ public class SearcherTest
[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]);
}
}
}