mirror of
https://github.com/ZDoom/zdoom-macos-deps.git
synced 2024-11-10 06:31:37 +00:00
add glib test
[skip build]
This commit is contained in:
parent
16bcf27a94
commit
ab25a42d09
1 changed files with 20 additions and 0 deletions
20
test/glib-2.0.cpp
Normal file
20
test/glib-2.0.cpp
Normal file
|
@ -0,0 +1,20 @@
|
|||
#include <string.h>
|
||||
#include <glib.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
const char reference[] = "Test 123!@#";
|
||||
const size_t length = strlen(reference);
|
||||
|
||||
gchar* const utf8 = g_convert(reference, sizeof reference - 1, "ascii", "utf-8", nullptr, nullptr, nullptr);
|
||||
AEDI_EXPECT(utf8 != nullptr);
|
||||
|
||||
gchar* const ascii = g_convert(utf8, strlen(utf8), "utf-8", "ascii", nullptr, nullptr, nullptr);
|
||||
AEDI_EXPECT(ascii != nullptr);
|
||||
g_free(utf8);
|
||||
|
||||
AEDI_EXPECT(strcmp(reference, ascii) == 0);
|
||||
g_free(ascii);
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in a new issue