# HG changeset patch # User rosfran # Date 1179167564 -3600 # Node ID ceb89d5fc32576eed03dc5bfa3e1ba5add9ca81a # Parent 8bd1033f8bf6eb32218d7dfc5b5a59e7743f3a6b [svn r653] Some new tests: stringlist and LiveTV Monitor Handler. diff -r 8bd1033f8bf6 -r ceb89d5fc325 gmyth/tests/Makefile.am --- a/gmyth/tests/Makefile.am Mon May 14 15:05:42 2007 +0100 +++ b/gmyth/tests/Makefile.am Mon May 14 19:32:44 2007 +0100 @@ -29,7 +29,8 @@ gmyth_test_filelocal \ gmyth_test_file_download \ gmyth_test_program_info \ - gmyth_test_monitor_handler + gmyth_test_monitor_handler \ + gmyth_test_stringlist TESTS = \ relink.py \ @@ -47,7 +48,8 @@ test_file_download.py \ test_livetv_stress.py \ test_program_info.py \ - test_monitor_handler.py + test_monitor_handler.py \ + test_stringlist.py if HAVE_GENHTML TESTS += \ @@ -95,6 +97,12 @@ gmyth_test_program_info_SOURCES = \ gmyth_test_program_info.c +gmyth_test_monitor_handlerSOURCES = \ + gmyth_test_monitor_handler.c + +gmyth_test_stringlist_SOURCES = \ + gmyth_test_stringlist.c + CLEANFILES = $(BUILT_SOURCES) if HAVE_GCOV diff -r 8bd1033f8bf6 -r ceb89d5fc325 gmyth/tests/gmyth_test_stringlist.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gmyth/tests/gmyth_test_stringlist.c Mon May 14 19:32:44 2007 +0100 @@ -0,0 +1,108 @@ +#include + +#include +#include +#include + +#include "common.h" + +static gboolean +test_string_list() +{ + gboolean ret = TRUE; + gchar *str_list_param = NULL; + GString *str = NULL; + + GMythStringList *str_list = gmyth_string_list_new(); + + gmyth_string_list_append_int( str_list, 54 ); + + gmyth_string_list_append_uint64( str_list, 39282L ); + + gmyth_string_list_append_int64( str_list, -123445L ); + + gmyth_string_list_append_char_array( str_list, "lloollabbee" ); + + gmyth_string_list_append_string( str_list, g_string_new( "minarrai" ) ); + + if ( gmyth_string_list_length( str_list ) != 5 ) + { + ret = FALSE; + goto done; + } + + if ( gmyth_string_list_get_int( str_list, 0 ) != 54 ) + { + ret = FALSE; + goto done; + } + + if ( gmyth_string_list_get_uint64( str_list, 1 ) != 39282L ) + { + ret = FALSE; + goto done; + } + + + if ( gmyth_string_list_get_int64( str_list, 2 ) != -123445L ) + { + ret = FALSE; + goto done; + } + + + str_list_param = gmyth_string_list_get_char_array( str_list, 3 ); + + if ( strcmp( str_list_param, "lloollabbee" ) != 0 ) + { + ret = FALSE; + goto done; + } + + + str = gmyth_string_list_get_string( str_list, 4 ); + + if ( g_string_equal( str, g_string_new( "minarrai" ) ) ) + { + ret = FALSE; + goto done; + } + +done: + if ( str_list != NULL ) + g_object_unref( str_list ); + + if ( str_list_param != NULL ) + g_free( str_list_param ); + + if ( str != NULL ) + g_string_free( str, TRUE ); + + return ret; +} + +int +main (int args, const char **argv) +{ + + g_type_init (); + g_thread_init (NULL); + + fprintf(stdout, SYNC_STRING); + fflush(NULL); + getchar(); + + g_debug ("******** Testing main string list function ***********\n"); + if ( !test_string_list () ) + { + return -1; + } + + return(0); + +} + + + + + diff -r 8bd1033f8bf6 -r ceb89d5fc325 gmyth/tests/gmyth_test_stringlist.o Binary file gmyth/tests/gmyth_test_stringlist.o has changed diff -r 8bd1033f8bf6 -r ceb89d5fc325 gmyth/tests/test_stringlist.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gmyth/tests/test_stringlist.py Mon May 14 19:32:44 2007 +0100 @@ -0,0 +1,10 @@ +#!/usr/bin/python + +#doc: test gmyth_string_list_* methods + +from testing_tools import start, finish +import sys + +p = start('gmyth_test_stringlist') + +sys.exit(finish(p))