Skip to content

Commit

Permalink
Add test for event decoder
Browse files Browse the repository at this point in the history
  • Loading branch information
Rikux3 authored and Xeeynamo committed May 27, 2020
1 parent 5b8d15c commit 43b766f
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions OpenKh.Tests/kh2/MsgEncoderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public void AdvancedReEncodeTest(byte commandByte)
[InlineData(0x1f, 0xc7, '念')]
[InlineData(0x1f, 0xc8, '還')]
[InlineData(0x1f, 0xDF, '夕')]
public void DecodeJapaneseTextCorrectly(byte command, byte data, char expected)
public void DecodeJapaneseSystemTextCorrectly(byte command, byte data, char expected)
{
var decoded = Encoders.JapaneseSystem.Decode(new byte[] { command, data });

Expand All @@ -205,7 +205,7 @@ public void DecodeJapaneseTextCorrectly(byte command, byte data, char expected)
[InlineData(0x1b, 0x58, "VI")]
[InlineData(0x1b, 0x59, "IX")]
[InlineData(0x1e, 0x66, "IV")]
public void DecodeRomanNumbersFromJapaneseTable(byte command, byte data, string expected)
public void DecodeRomanNumbersFromJapaneseSystemTable(byte command, byte data, string expected)
{
var decoded = Encoders.JapaneseSystem.Decode(new byte[] { command, data });

Expand All @@ -226,7 +226,7 @@ public void DecodeRomanNumbersFromJapaneseTable(byte command, byte data, string
[InlineData(0x1b, 0x57, "V")]
[InlineData(0x1b, 0x58, "VI")]
[InlineData(0x1b, 0x59, "IX")]
public void EncodeRomanNumbersForJapaneseTable(byte command, byte data, string textSource)
public void EncodeRomanNumbersForJapaneseSystemTable(byte command, byte data, string textSource)
{
var encoded = Encoders.JapaneseSystem.Encode(new List<MessageCommandModel>
{
Expand All @@ -242,5 +242,19 @@ public void EncodeRomanNumbersForJapaneseTable(byte command, byte data, string t
else
Assert.Equal(new byte[] { command, data }, encoded);
}

[Theory]
[InlineData(0x1a, 0x02, '納')]
[InlineData(0x1b, 0x00, '竜')]
[InlineData(0x1c, 0x00, '操')]
[InlineData(0x1d, 0x00, '猫')]
[InlineData(0x1f, 0x00, '捧')]
public void DecodeJapaneseEventTextCorrectly(byte command, byte data, char expected)
{
var decoded = Encoders.JapaneseEvent.Decode(new byte[] { command, data });

Assert.NotEmpty(decoded);
Assert.Equal(expected, decoded.Single().Text.Single());
}
}
}

0 comments on commit 43b766f

Please sign in to comment.