Skip to content

Commit 3d6c98b

Browse files
committed
添加 KitopiaTest 项目及相关测试文件
1 parent 291d523 commit 3d6c98b

File tree

6 files changed

+112
-1
lines changed

6 files changed

+112
-1
lines changed

Kitopia.sln

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OnnxRuntime.OpenVino", "Onn
3737
EndProject
3838
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OnnxRuntime.CPU", "OnnxRuntime.CPU\OnnxRuntime.CPU.csproj", "{5B315CC7-34C7-4AEA-BFD0-C275522A63CD}"
3939
EndProject
40+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KitopiaTest", "KitopiaTest\KitopiaTest.csproj", "{003DC581-CAE3-42AD-A052-EE995F42C121}"
41+
EndProject
4042
Global
4143
GlobalSection(SolutionConfigurationPlatforms) = preSolution
4244
Debug|Any CPU = Debug|Any CPU
@@ -293,6 +295,26 @@ Global
293295
{5B315CC7-34C7-4AEA-BFD0-C275522A63CD}.Release|x64.Build.0 = Release|Any CPU
294296
{5B315CC7-34C7-4AEA-BFD0-C275522A63CD}.Release|x86.ActiveCfg = Release|Any CPU
295297
{5B315CC7-34C7-4AEA-BFD0-C275522A63CD}.Release|x86.Build.0 = Release|Any CPU
298+
{003DC581-CAE3-42AD-A052-EE995F42C121}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
299+
{003DC581-CAE3-42AD-A052-EE995F42C121}.Debug|Any CPU.Build.0 = Debug|Any CPU
300+
{003DC581-CAE3-42AD-A052-EE995F42C121}.Debug|ARM.ActiveCfg = Debug|Any CPU
301+
{003DC581-CAE3-42AD-A052-EE995F42C121}.Debug|ARM.Build.0 = Debug|Any CPU
302+
{003DC581-CAE3-42AD-A052-EE995F42C121}.Debug|arm64.ActiveCfg = Debug|Any CPU
303+
{003DC581-CAE3-42AD-A052-EE995F42C121}.Debug|arm64.Build.0 = Debug|Any CPU
304+
{003DC581-CAE3-42AD-A052-EE995F42C121}.Debug|x64.ActiveCfg = Debug|Any CPU
305+
{003DC581-CAE3-42AD-A052-EE995F42C121}.Debug|x64.Build.0 = Debug|Any CPU
306+
{003DC581-CAE3-42AD-A052-EE995F42C121}.Debug|x86.ActiveCfg = Debug|Any CPU
307+
{003DC581-CAE3-42AD-A052-EE995F42C121}.Debug|x86.Build.0 = Debug|Any CPU
308+
{003DC581-CAE3-42AD-A052-EE995F42C121}.Release|Any CPU.ActiveCfg = Release|Any CPU
309+
{003DC581-CAE3-42AD-A052-EE995F42C121}.Release|Any CPU.Build.0 = Release|Any CPU
310+
{003DC581-CAE3-42AD-A052-EE995F42C121}.Release|ARM.ActiveCfg = Release|Any CPU
311+
{003DC581-CAE3-42AD-A052-EE995F42C121}.Release|ARM.Build.0 = Release|Any CPU
312+
{003DC581-CAE3-42AD-A052-EE995F42C121}.Release|arm64.ActiveCfg = Release|Any CPU
313+
{003DC581-CAE3-42AD-A052-EE995F42C121}.Release|arm64.Build.0 = Release|Any CPU
314+
{003DC581-CAE3-42AD-A052-EE995F42C121}.Release|x64.ActiveCfg = Release|Any CPU
315+
{003DC581-CAE3-42AD-A052-EE995F42C121}.Release|x64.Build.0 = Release|Any CPU
316+
{003DC581-CAE3-42AD-A052-EE995F42C121}.Release|x86.ActiveCfg = Release|Any CPU
317+
{003DC581-CAE3-42AD-A052-EE995F42C121}.Release|x86.Build.0 = Release|Any CPU
296318
EndGlobalSection
297319
GlobalSection(SolutionProperties) = preSolution
298320
HideSolutionNode = FALSE

KitopiaTest/KitopiaTest.csproj

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup Condition=" '$(OS)' != 'Windows_NT' ">
3+
<TargetFrameworks>net9.0</TargetFrameworks>
4+
</PropertyGroup>
5+
<PropertyGroup Condition=" '$(OS)' == 'Windows_NT' ">
6+
<TargetFrameworks>net9.0-windows10.0.19041.0</TargetFrameworks>
7+
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
8+
<WindowsPackageType>None</WindowsPackageType>
9+
<EnableMsixTooling>true</EnableMsixTooling>
10+
</PropertyGroup>
11+
<PropertyGroup>
12+
13+
<LangVersion>latest</LangVersion>
14+
<ImplicitUsings>enable</ImplicitUsings>
15+
<Nullable>enable</Nullable>
16+
</PropertyGroup>
17+
<PropertyGroup Condition="'$(OS)' == 'Windows_NT'">
18+
<DefineConstants>$(DefineConstants);WINDOWS</DefineConstants>
19+
</PropertyGroup>
20+
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))'">
21+
<DefineConstants>$(DefineConstants);LINUX</DefineConstants>
22+
</PropertyGroup>
23+
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))'">
24+
<DefineConstants>$(DefineConstants);OSX</DefineConstants>
25+
</PropertyGroup>
26+
<ItemGroup>
27+
<PackageReference Include="MSTest" Version="4.0.1"/>
28+
</ItemGroup>
29+
30+
<ItemGroup>
31+
<Using Include="Microsoft.VisualStudio.TestTools.UnitTesting"/>
32+
</ItemGroup>
33+
34+
<ItemGroup>
35+
<ProjectReference Include="..\Core.Window\Core.Window.csproj" />
36+
<ProjectReference Include="..\Core\Core.csproj" />
37+
<ProjectReference Include="..\KitopiaAvalonia\KitopiaAvalonia.csproj" />
38+
</ItemGroup>
39+
40+
</Project>

KitopiaTest/MSTestSettings.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[assembly: Parallelize(Scope = ExecutionScope.MethodLevel)]

KitopiaTest/PinyinTest.cs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Author: liaom
2+
// SolutionName: Kitopia
3+
// ProjectName: KitopiaTest
4+
// FileName:PinyinTest.cs
5+
// Date: 2025/11/29 15:11
6+
// FileEffect:
7+
8+
using Pinyin.NET;
9+
10+
namespace KitopiaTest;
11+
12+
[TestClass]
13+
public class PinyinTest
14+
{
15+
public class AppInfo
16+
{
17+
public string Name { get; set; }
18+
}
19+
[TestMethod]
20+
public void TestMethod1()
21+
{
22+
var apps = new List<AppInfo>
23+
{
24+
new AppInfo { Name = "微信" },
25+
new AppInfo { Name = "网易云音乐" },
26+
new AppInfo { Name = "Windows相机" }
27+
};
28+
29+
var searcher = new PinyinSearcher<AppInfo>(apps, app => app.Name);
30+
31+
var results = searcher.Search("weixin");
32+
Assert.AreEqual(results.First().Source.Name, "微信");
33+
foreach (var result in results)
34+
{
35+
Console.WriteLine($"匹配度: {result.Weight}, 应用: {result.Source.Name}");
36+
}
37+
}
38+
}

KitopiaTest/Test1.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
namespace KitopiaTest;
2+
3+
[TestClass]
4+
public sealed class Test1
5+
{
6+
[TestMethod]
7+
public void TestMethod1()
8+
{
9+
}
10+
}

PinyinM.NET

0 commit comments

Comments
 (0)