aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJeroen van Rijn <Kelimion@users.noreply.github.com>2025-07-11 15:29:27 +0200
committerJeroen van Rijn <Kelimion@users.noreply.github.com>2025-07-11 15:29:27 +0200
commite89abd006f943acdc4f20e3cedc86e5d56c98061 (patch)
treeac4cabedfdf945844ef003739ca5cf0c81338cb0 /tests
parente735e036b4df84db84aa7d66c1118b3e906f0022 (diff)
Fix #5452
Diffstat (limited to 'tests')
-rw-r--r--tests/core/sys/windows/util.odin33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/core/sys/windows/util.odin b/tests/core/sys/windows/util.odin
new file mode 100644
index 000000000..0201395f6
--- /dev/null
+++ b/tests/core/sys/windows/util.odin
@@ -0,0 +1,33 @@
+#+build windows
+package test_core_sys_windows
+
+import "base:intrinsics"
+import "core:testing"
+import win32 "core:sys/windows"
+
+UTF16_Vector :: struct {
+ wstr: win32.wstring,
+ ustr: string,
+}
+
+utf16_vectors := []UTF16_Vector{
+ {
+ intrinsics.constant_utf16_cstring("Hellope, World!"),
+ "Hellope, World!",
+ },
+ {
+ intrinsics.constant_utf16_cstring("Hellope\x00, World!"),
+ "Hellope",
+ },
+}
+
+@(test)
+utf16_to_utf8_buf_test :: proc(t: ^testing.T) {
+ for test in utf16_vectors {
+ buf := make([]u8, len(test.ustr))
+ defer delete(buf)
+
+ res := win32.utf16_to_utf8_buf(buf[:], test.wstr[:len(test.ustr)])
+ testing.expect_value(t, res, test.ustr)
+ }
+} \ No newline at end of file