init test

This commit is contained in:
DismissedLight
2025-01-21 17:31:09 +08:00
parent 7f7d28825e
commit d4aae4508a
35 changed files with 806 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
<Project Sdk="MSTest.Sdk/3.6.4">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<UseVSTest>true</UseVSTest>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BetterGenshinImpact.CombatScript\BetterGenshinImpact.CombatScript.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,45 @@
namespace BetterGenshinImpact.CombatScript.Test;
[TestClass]
public sealed class ScriptEmitTest
{
[TestMethod]
public void TestEmit()
{
ScriptUnit scriptUnit = new(
[
new CommentSymbol("测试注释"),
new LineBreakTriviaSymbol(),
new AvatarInstructionListSymbol(new("钟离"), [new SpaceTriviaSymbol()], new(
[
new WalkSymbol(WalkDirection.Backward, [new DoubleSymbol(0.1)], [new CommaTriviaSymbol()]),
new SkillSymbol(true, [new HoldSymbol()], [new CommaTriviaSymbol()]),
new WaitSymbol([new DoubleSymbol(0.3)], [new CommaTriviaSymbol()]),
new WalkSymbol(WalkDirection.Forward, [new DoubleSymbol(0.1)], []),
])),
new LineBreakTriviaSymbol(),
new AvatarInstructionListSymbol(new("芙宁娜"), [new SpaceTriviaSymbol()], new(
[
new SkillSymbol(true, [new CommaTriviaSymbol()]),
new BurstSymbol(true, [])
])),
new LineBreakTriviaSymbol(),
new AvatarInstructionListSymbol(new("行秋"), [new SpaceTriviaSymbol()], new(
[
new SkillSymbol(true, [new CommaTriviaSymbol()]),
new BurstSymbol(true, [new CommaTriviaSymbol()]),
new SkillSymbol(true, []),
])),
]);
Console.WriteLine(scriptUnit.Emit(new DefaultSymbolEmitter()));
}
[TestMethod]
public void Test()
{
ReadOnlySpan<char> raw = "ABCDEF;GHIJKL\r\nMNOPQR\nSTUVWX\rYZ\r\n";
SymbolParser parser = new();
ScriptUnit scriptUnit = parser.Parse(raw);
}
}