Skip to content

Commit

Permalink
Add test for #26
Browse files Browse the repository at this point in the history
  • Loading branch information
ChanyaVRC committed Nov 18, 2022
1 parent 88a4ade commit 121a7a1
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/vrcosclib.Test/Chatbox/OscChatboxTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,29 @@ public void OneTimeTearDown()
}


[TestCase("", true)]
[TestCase("ASCII", true)]
[TestCase("ASCII", false)]
[TestCase("UTF-8", true)]
[TestCase("😂😭😪😥😰😅😓😩😫😨😱", true)]
public async Task SendMessageTest(string message, bool direct)
[TestCase("", true, true)]
[TestCase("ASCII", true, false)]
[TestCase("ASCII", false, true)]
[TestCase("UTF-8", true, false)]
[TestCase("😂😭😪😥😰😅😓😩😫😨😱", true, true)]
public async Task SendMessageTest(string message, bool direct, bool messageComplete)
{
OscMessageValues value = null!;
void valueReadMethod(OscMessageValues v) => value = v;
_server.TryAddMethod(OscChatbox.InputAddress, valueReadMethod);
byte[] recievedMessage = new byte[2024];


OscChatbox.SendMessage(message, direct);
OscChatbox.SendMessage(message, direct, messageComplete);
await TestUtility.LoopWhile(() => value == null, TestUtility.LatencyTimeout);
int length = value.ReadStringElementBytes(0, recievedMessage);
bool recievedDirect = value.ReadBooleanElement(1);
bool recievedMessageComplete = value.ReadBooleanElement(2);


Assert.AreEqual(message, Encoding.UTF8.GetString(recievedMessage, 0, length));
Assert.AreEqual(direct, recievedDirect);
Assert.AreEqual(messageComplete, recievedMessageComplete);
}

[TestCase(true)]
Expand Down

0 comments on commit 121a7a1

Please sign in to comment.