#include #include "zero-pinyin-service.h" static void test_GString() { GString *s = NULL; s = g_string_new(NULL); g_string_append_printf(s, "s0=%d ", 1); g_assert_cmpstr(s->str, ==, "s0=1 "); g_string_free(s, TRUE); } static void test_build_s_y_fields() { gchar *result = NULL; result = build_s_y_fields(1); g_assert_cmpstr(result, ==, ", s0, y0 "); g_free(result); result = build_s_y_fields(2); g_assert_cmpstr(result, ==, ", s0, y0, s1, y1 "); g_free(result); } int main(int argc, char *argv[]) { setlocale(LC_ALL, ""); g_test_init(&argc, &argv, NULL); g_test_add_func("/zero/test_GString", test_GString); g_test_add_func("/zero/test_build_s_y_fields", test_build_s_y_fields); return g_test_run(); }