| 1 | /* test_encoding.cc - Test string encoding |
| 2 | part of the minizip-ng project |
| 3 | |
| 4 | Copyright (C) Nathan Moinvaziri |
| 5 | https://github.com/zlib-ng/minizip-ng |
| 6 | |
| 7 | This program is distributed under the terms of the same license as zlib. |
| 8 | See the accompanying LICENSE file for the full text of the license. |
| 9 | */ |
| 10 | |
| 11 | #include "mz.h" |
| 12 | #include "mz_os.h" |
| 13 | |
| 14 | #include <gtest/gtest.h> |
| 15 | |
| 16 | TEST(os, utf8_unicode_string) { |
| 17 | const char *test_string = "Heiz�lr�cksto�abd�mpfung"; |
| 18 | char *utf8_string = mz_os_utf8_string_create(test_string, MZ_ENCODING_CODEPAGE_950); |
| 19 | ASSERT_NE(utf8_string, nullptr); |
| 20 | #if defined(_WIN32) |
| 21 | wchar_t *unicode_string = mz_os_unicode_string_create(utf8_string, MZ_ENCODING_UTF8); |
| 22 | ASSERT_NE(unicode_string, nullptr); |
| 23 | mz_os_unicode_string_delete(&unicode_string); |
| 24 | #endif |
| 25 | mz_os_utf8_string_delete(&utf8_string); |
| 26 | } |