[svn r653] Some new tests: stringlist and LiveTV Monitor Handler. trunk
authorrosfran
Mon May 14 19:32:44 2007 +0100 (2007-05-14)
branchtrunk
changeset 647ceb89d5fc325
parent 646 8bd1033f8bf6
child 648 df21cf541248
[svn r653] Some new tests: stringlist and LiveTV Monitor Handler.
gmyth/tests/Makefile.am
gmyth/tests/gmyth_test_stringlist.c
gmyth/tests/gmyth_test_stringlist.o
gmyth/tests/test_stringlist.py
     1.1 --- a/gmyth/tests/Makefile.am	Mon May 14 15:05:42 2007 +0100
     1.2 +++ b/gmyth/tests/Makefile.am	Mon May 14 19:32:44 2007 +0100
     1.3 @@ -29,7 +29,8 @@
     1.4  	gmyth_test_filelocal \
     1.5  	gmyth_test_file_download \
     1.6  	gmyth_test_program_info \
     1.7 -	gmyth_test_monitor_handler
     1.8 +	gmyth_test_monitor_handler \
     1.9 +	gmyth_test_stringlist
    1.10  
    1.11  TESTS = \
    1.12  	relink.py \
    1.13 @@ -47,7 +48,8 @@
    1.14  	test_file_download.py \
    1.15  	test_livetv_stress.py \
    1.16  	test_program_info.py \
    1.17 -	test_monitor_handler.py
    1.18 +	test_monitor_handler.py \
    1.19 +	test_stringlist.py
    1.20  
    1.21  if HAVE_GENHTML
    1.22  TESTS += \
    1.23 @@ -95,6 +97,12 @@
    1.24  gmyth_test_program_info_SOURCES = \
    1.25  	gmyth_test_program_info.c
    1.26  
    1.27 +gmyth_test_monitor_handlerSOURCES = \
    1.28 +	gmyth_test_monitor_handler.c
    1.29 +
    1.30 +gmyth_test_stringlist_SOURCES = \
    1.31 +	gmyth_test_stringlist.c
    1.32 +
    1.33  CLEANFILES = $(BUILT_SOURCES)
    1.34  
    1.35  if HAVE_GCOV
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/gmyth/tests/gmyth_test_stringlist.c	Mon May 14 19:32:44 2007 +0100
     2.3 @@ -0,0 +1,108 @@
     2.4 +#include <glib-object.h>
     2.5 +
     2.6 +#include <gmyth/gmyth_backendinfo.h>
     2.7 +#include <gmyth/gmyth_stringlist.h>
     2.8 +#include <gmyth/gmyth_common.h>
     2.9 +
    2.10 +#include "common.h"
    2.11 +
    2.12 +static gboolean
    2.13 +test_string_list()
    2.14 +{
    2.15 +    gboolean ret = TRUE;
    2.16 +    gchar *str_list_param = NULL;
    2.17 +    GString *str = NULL;
    2.18 +
    2.19 +    GMythStringList *str_list = gmyth_string_list_new();
    2.20 +    
    2.21 +    gmyth_string_list_append_int( str_list, 54 );
    2.22 +
    2.23 +    gmyth_string_list_append_uint64( str_list, 39282L );
    2.24 +
    2.25 +    gmyth_string_list_append_int64( str_list, -123445L );
    2.26 +
    2.27 +    gmyth_string_list_append_char_array( str_list, "lloollabbee" );
    2.28 +
    2.29 +    gmyth_string_list_append_string( str_list, g_string_new( "minarrai" ) );
    2.30 +
    2.31 +    if ( gmyth_string_list_length( str_list ) != 5 )
    2.32 +    {
    2.33 +    	ret = FALSE;
    2.34 +	goto done;
    2.35 +    }
    2.36 +
    2.37 +    if ( gmyth_string_list_get_int( str_list, 0 ) != 54 )
    2.38 +    {
    2.39 +    	ret = FALSE;
    2.40 +	goto done;
    2.41 +    }
    2.42 +
    2.43 +    if ( gmyth_string_list_get_uint64( str_list, 1 ) != 39282L )
    2.44 +    {
    2.45 +    	ret = FALSE;
    2.46 +	goto done;
    2.47 +    }
    2.48 +
    2.49 +    
    2.50 +    if ( gmyth_string_list_get_int64( str_list, 2 ) != -123445L )
    2.51 +    {
    2.52 +    	ret = FALSE;
    2.53 +	goto done;
    2.54 +    }
    2.55 +    
    2.56 +
    2.57 +    str_list_param = gmyth_string_list_get_char_array( str_list, 3 );
    2.58 +
    2.59 +    if ( strcmp( str_list_param, "lloollabbee" ) != 0 )
    2.60 +    {
    2.61 +    	ret = FALSE;
    2.62 +	goto done;
    2.63 +    }
    2.64 +
    2.65 +
    2.66 +    str = gmyth_string_list_get_string( str_list, 4 );
    2.67 +
    2.68 +    if ( g_string_equal( str, g_string_new( "minarrai" ) ) )
    2.69 +    {
    2.70 +    	ret = FALSE;
    2.71 +	goto done;
    2.72 +    }
    2.73 +
    2.74 +done:
    2.75 +    if ( str_list != NULL )
    2.76 +    	g_object_unref( str_list );
    2.77 +
    2.78 +    if ( str_list_param != NULL )
    2.79 +    	g_free( str_list_param );
    2.80 +
    2.81 +    if ( str != NULL )
    2.82 +    	g_string_free( str, TRUE );
    2.83 +
    2.84 +    return ret;
    2.85 +}
    2.86 +
    2.87 +int
    2.88 +main (int args, const char **argv)
    2.89 +{
    2.90 +
    2.91 +    g_type_init ();
    2.92 +    g_thread_init (NULL);
    2.93 +
    2.94 +    fprintf(stdout, SYNC_STRING);
    2.95 +    fflush(NULL);
    2.96 +    getchar();
    2.97 + 
    2.98 +    g_debug ("******** Testing main string list function ***********\n");
    2.99 +    if ( !test_string_list () )
   2.100 +    {
   2.101 +    	return -1;
   2.102 +    }
   2.103 +   
   2.104 +    return(0);
   2.105 +
   2.106 +}
   2.107 +
   2.108 +
   2.109 +
   2.110 +
   2.111 +
     3.1 Binary file gmyth/tests/gmyth_test_stringlist.o has changed
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/gmyth/tests/test_stringlist.py	Mon May 14 19:32:44 2007 +0100
     4.3 @@ -0,0 +1,10 @@
     4.4 +#!/usr/bin/python
     4.5 +
     4.6 +#doc: test gmyth_string_list_* methods
     4.7 +
     4.8 +from testing_tools import start, finish
     4.9 +import sys
    4.10 +
    4.11 +p = start('gmyth_test_stringlist')
    4.12 +
    4.13 +sys.exit(finish(p))