glib/tests/unichar-test.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 #include <errno.h>
       
    21 #define LOG_FILE "c:\\logs\\unichar_test_log.txt"
       
    22 #include "std_log_result.h"
       
    23 #define LOG_FILENAME_LINE __FILE__, __LINE__
       
    24 
       
    25 void create_xml(int result)
       
    26 {
       
    27     if(result)
       
    28         assert_failed = 1;
       
    29     
       
    30     testResultXml("unichar_testlog");
       
    31     close_log_file();
       
    32 }
       
    33 
       
    34 int main (int argc, char *argv[])
       
    35 {  
       
    36     gunichar ret;
       
    37     gunichar mark = 0x0BCA; //spacing mark. Tamil letter. 
       
    38     gunichar title = 0x01F2; //Latin letter.
       
    39     gunichar square = 0x25A1; //white square
       
    40     gunichar space = 0x200B; //zero width space
       
    41     gunichar tel_symbol = 0x32C0; //telegraphic symbol for january
       
    42     gunichar CR = 0x000D; //carriage return
       
    43     GUnicodeBreakType type;
       
    44     
       
    45     g_unichar_get_mirror_char('(', &ret);
       
    46     
       
    47     if(!(')' == ret))
       
    48         {
       
    49         std_log(LOG_FILENAME_LINE,"g_unichar_get_mirror_char didnt work as expected");
       
    50         assert_failed = 1;
       
    51         }
       
    52     
       
    53     
       
    54     if(!g_unichar_ismark(mark))
       
    55         {
       
    56         std_log(LOG_FILENAME_LINE,"g_unichar_ismark didnt work as expected");
       
    57         assert_failed = 1;
       
    58         }
       
    59     
       
    60     if(!g_unichar_istitle(title))
       
    61         {
       
    62         std_log(LOG_FILENAME_LINE,"g_unichar_istitle didnt work as expected");
       
    63         assert_failed = 1;
       
    64         }
       
    65     
       
    66     if(!g_unichar_isdefined(square))
       
    67         {
       
    68         std_log(LOG_FILENAME_LINE,"g_unichar_isdefined didnt work as expected");
       
    69         assert_failed = 1;
       
    70         }
       
    71     
       
    72     if(!g_unichar_iszerowidth(space))
       
    73         {
       
    74         std_log(LOG_FILENAME_LINE,"g_unichar_iszerowidth didnt work as expected");
       
    75         assert_failed = 1;
       
    76         }
       
    77     
       
    78     if(!g_unichar_iswide(tel_symbol))
       
    79         {
       
    80         std_log(LOG_FILENAME_LINE,"g_unichar_iswide didnt work as expected");
       
    81         assert_failed = 1;
       
    82         }
       
    83     
       
    84     if(!g_unichar_iswide_cjk(tel_symbol))
       
    85         {
       
    86         std_log(LOG_FILENAME_LINE,"g_unichar_iswide_cjk didnt work as expected");
       
    87         assert_failed = 1;
       
    88         }
       
    89     
       
    90     ret = g_unichar_totitle('a');
       
    91     if(!(ret == 'A'))
       
    92         {
       
    93         std_log(LOG_FILENAME_LINE,"g_unichar_totitle didnt work as expected");
       
    94         assert_failed = 1;
       
    95         }
       
    96     
       
    97     type = g_unichar_break_type(CR);
       
    98     if(type != G_UNICODE_BREAK_CARRIAGE_RETURN)
       
    99         {
       
   100         std_log(LOG_FILENAME_LINE,"g_unichar_break_type didnt work as expected");
       
   101         assert_failed = 1;
       
   102         }
       
   103     
       
   104 	if(assert_failed)
       
   105           std_log(LOG_FILENAME_LINE,"Test Failed");
       
   106     else
       
   107           std_log(LOG_FILENAME_LINE,"Test Successful");
       
   108 	
       
   109     create_xml(0);
       
   110 
       
   111 	return 0;
       
   112 }