glib/tests/nullify-ptr.c
changeset 50 79045913e4e9
child 72 403e7f6ed6c5
equal deleted inserted replaced
49:e5d77a29bdca 50:79045913e4e9
       
     1 // Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #undef G_DISABLE_ASSERT
       
    17 #undef G_LOG_DOMAIN
       
    18 
       
    19 #include <glib.h>
       
    20 #define LOG_FILE "c:\\logs\\nullify_ptr_log.txt"
       
    21 #include "std_log_result.h"
       
    22 #define LOG_FILENAME_LINE __FILE__, __LINE__
       
    23 
       
    24 void create_xml(int result)
       
    25 {
       
    26     if(result)
       
    27         assert_failed = 1;
       
    28     
       
    29     testResultXml("nullify_ptr_log");
       
    30     close_log_file();
       
    31 }
       
    32 
       
    33 int main (int argc, char *argv[])
       
    34 {
       
    35     char *ptr;
       
    36 	g_nullify_pointer((gpointer)&ptr);
       
    37 	
       
    38 	if(ptr != NULL)
       
    39 	    {
       
    40         std_log(LOG_FILENAME_LINE,"ptr is not NULL");
       
    41 	    assert_failed = 1;
       
    42 	    }
       
    43 	
       
    44 	if(assert_failed)
       
    45           std_log(LOG_FILENAME_LINE,"Test Fail");
       
    46     else
       
    47           std_log(LOG_FILENAME_LINE,"Test Successful");
       
    48 	
       
    49     create_xml(0);
       
    50 
       
    51 	return 0;
       
    52 }