os/ossrv/glib/tsrc/BC/src/ttrash.c
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/glib/tsrc/BC/src/ttrash.c	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,87 @@
     1.4 +/*
     1.5 +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
     1.6 +*
     1.7 +* This library is free software; you can redistribute it and/or
     1.8 +* modify it under the terms of the GNU Lesser General Public
     1.9 +* License as published by the Free Software Foundation; either
    1.10 +* version 2 of the License, or (at your option) any later version.
    1.11 +*
    1.12 +* This library is distributed in the hope that it will be useful,
    1.13 +* but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.14 +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    1.15 +* Lesser General Public License for more details.
    1.16 +*
    1.17 +* You should have received a copy of the GNU Lesser General Public
    1.18 +* License along with this library; if not, write to the
    1.19 +* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    1.20 +* Boston, MA 02111-1307, USA.
    1.21 +*
    1.22 +* Description:  ?Description
    1.23 +*
    1.24 +*/
    1.25 +
    1.26 +
    1.27 +#undef G_DISABLE_ASSERT
    1.28 +#undef G_LOG_DOMAIN
    1.29 +
    1.30 +
    1.31 +#include <stdio.h>
    1.32 +#include <string.h>
    1.33 +#include <glib.h>
    1.34 +#include <fcntl.h>
    1.35 +#include <goption.h>
    1.36 +
    1.37 +#ifdef SYMBIAN
    1.38 +#include "mrt2_glib2_test.h"
    1.39 +#endif /*SYMBIAN*/
    1.40 +
    1.41 +#define	C2P(c)		((gpointer) ((long) (c)))
    1.42 +#define GINT_TO_POINTER(i)	((gpointer)  (i))
    1.43 +#define GPOINTER_TO_INT(p)	((gint)   (p))
    1.44 +#define TESTPASS	1
    1.45 +#define TESTFAIL	0
    1.46 +
    1.47 +
    1.48 +void tg_trash_tests()
    1.49 +{
    1.50 +	GTrashStack* stk=NULL;
    1.51 +	gint ip1=5;
    1.52 +	gint ip2=6;
    1.53 +	gint ip3=7;
    1.54 +	gint g_trash_stack_peek_res;
    1.55 +	
    1.56 +	//All test done thro stack_height
    1.57 +	g_assert(g_trash_stack_height(&stk) == 0);
    1.58 +	//Push 2 elements
    1.59 +	g_trash_stack_push(&stk,&ip1);
    1.60 +	g_assert(g_trash_stack_height(&stk) == 1);
    1.61 +	g_trash_stack_push(&stk,&ip2);
    1.62 +	g_assert(g_trash_stack_height(&stk) == 2);
    1.63 +	//Pop one element
    1.64 +	g_trash_stack_pop(&stk);
    1.65 +	g_assert(g_trash_stack_height(&stk) == 1);
    1.66 +	//Push one more
    1.67 +	g_trash_stack_push(&stk,&ip3);
    1.68 +	g_assert(g_trash_stack_height(&stk) == 2);
    1.69 +	//Pop one more
    1.70 +	g_trash_stack_pop(&stk);
    1.71 +	//Check top of stack
    1.72 +	g_trash_stack_peek_res = *(gint*)g_trash_stack_peek(&stk);
    1.73 +	g_assert(g_trash_stack_peek_res == 0);
    1.74 +	
    1.75 +}
    1.76 +
    1.77 +int main (int argc,char *argv[])
    1.78 +{
    1.79 +
    1.80 +	#ifdef SYMBIAN
    1.81 + 
    1.82 + 	g_log_set_handler (NULL,  G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING | G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO |  G_LOG_LEVEL_DEBUG, &mrtLogHandler, NULL);
    1.83 + 	#endif /*SYMBIAN*/
    1.84 + 	
    1.85 + 	tg_trash_tests();
    1.86 + #ifdef SYMBIAN
    1.87 +  testResultXml("ttrash");
    1.88 +#endif /* EMULATOR */
    1.89 + 	return 0;
    1.90 +}
    1.91 \ No newline at end of file