From ab25a42d0952177db20c98c755c0d6b33c935d24 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Tue, 20 Sep 2022 13:36:21 +0300 Subject: [PATCH] add glib test [skip build] --- test/glib-2.0.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 test/glib-2.0.cpp diff --git a/test/glib-2.0.cpp b/test/glib-2.0.cpp new file mode 100644 index 00000000..392bb798 --- /dev/null +++ b/test/glib-2.0.cpp @@ -0,0 +1,20 @@ +#include +#include + +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; +}