ali@38: /* ali@38: * Copyright (C) 2016 J. Ali Harlow ali@38: * ali@38: * This program is free software; you can redistribute it and/or modify ali@38: * it under the terms of the GNU General Public License as published by ali@38: * the Free Software Foundation; either version 2 of the License, or ali@38: * (at your option) any later version. ali@38: * ali@38: * This program is distributed in the hope that it will be useful, ali@38: * but WITHOUT ANY WARRANTY; without even the implied warranty of ali@38: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ali@38: * GNU General Public License for more details. ali@38: * ali@38: * You should have received a copy of the GNU General Public License along ali@38: * with this program; if not, write to the Free Software Foundation, Inc., ali@38: * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ali@38: */ ali@38: ali@38: #include ali@38: #include ali@38: #include ali@38: ali@38: static void test_basic(void) ali@38: { ali@38: struct comps *comps; ali@38: comps=plover_comps_new(); ali@38: g_assert(comps); ali@38: plover_comps_free(comps); ali@38: } ali@38: ali@38: static void test_from_file(void) ali@38: { ali@38: struct comps *comps; ali@38: struct comps_group *group; ali@38: gchar *s; ali@38: s=g_build_filename(g_getenv("tests_srcdir"),"comps.xml",NULL); ali@38: comps=plover_comps_new_from_file(s); ali@38: if (!comps) ali@38: g_error("%s: Failed to read components",s); ali@38: g_free(s); ali@38: group=plover_comps_lookup_group(comps,"base"); ali@38: g_assert(group); ali@38: g_assert(!plover_comps_lookup_group(comps,"nonexistant")); ali@38: plover_comps_free(comps); ali@38: } ali@38: ali@38: int main(int argc,char **argv) ali@38: { ali@38: int retval; ali@38: g_test_init(&argc,&argv,NULL); ali@38: g_test_bug_base("mailto:ali@juiblex.co.uk"); ali@38: g_test_add_func("/comps/basic",test_basic); ali@38: g_test_add_func("/comps/from-file",test_from_file); ali@38: retval=g_test_run(); ali@38: return retval; ali@38: }