From fc8337df4611f62289d30b92e6b509b3ac2576b5 Mon Sep 17 00:00:00 2001 From: ChrisDill Date: Sat, 11 Dec 2021 13:00:02 +0000 Subject: [PATCH] Add a few text tests --- Raylib-cs.Tests/Raylib-cs.Tests.csproj | 2 +- Raylib-cs.Tests/RaylibTests.cs | 48 ++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/Raylib-cs.Tests/Raylib-cs.Tests.csproj b/Raylib-cs.Tests/Raylib-cs.Tests.csproj index 6bf7026..d9469c1 100644 --- a/Raylib-cs.Tests/Raylib-cs.Tests.csproj +++ b/Raylib-cs.Tests/Raylib-cs.Tests.csproj @@ -13,6 +13,6 @@ - + \ No newline at end of file diff --git a/Raylib-cs.Tests/RaylibTests.cs b/Raylib-cs.Tests/RaylibTests.cs index 327ae81..df7c63b 100644 --- a/Raylib-cs.Tests/RaylibTests.cs +++ b/Raylib-cs.Tests/RaylibTests.cs @@ -40,5 +40,53 @@ namespace Raylib_cs.Tests Assert.True(BlittableHelper.IsBlittable()); Assert.True(BlittableHelper.IsBlittable()); } + + [Fact] + public void TextToInteger() + { + int value = Raylib.TextToInteger("99999"); + Assert.Equal(99999, value); + } + + [Fact] + public void TextToPascal() + { + string input = "hello_world"; + string text = Raylib.TextToPascal(input).ToString(); + Assert.Equal("HelloWorld", text); + } + + [Fact] + public void LoadCodepoints() + { + int count = 0; + string input = "aàáâãäāăąȧXǎȁȃeèéêẽëē"; + int[] codepoints1 = Raylib.LoadCodepoints(input, ref count); + + for (int i = 0; i < input.Length; i++) + { + Assert.Equal(codepoints1[i], input[i]); + } + } + + [Fact] + public void CodepointToUTF8() + { + int byteSize = 0; + string text = Raylib.CodepointToUTF8(224, ref byteSize).ToString(); + Assert.Equal(text, "à"); + } + + [Fact] + public void TextCodepointsToUTF8() + { + string input = "aàáâãäāăąȧXǎȁȃeèéêẽëē"; + + int count = 0; + int[] codepoints1 = Raylib.LoadCodepoints(input, ref count); + + string text = Raylib.TextCodepointsToUTF8(codepoints1, codepoints1.Length).ToString(); + Assert.Equal(text, input); + } } }