50
|
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 |
|
72
|
19 |
#include <sys/stat.h>
|
50
|
20 |
#include <glib.h>
|
|
21 |
#include <errno.h>
|
72
|
22 |
#include <glib/gprintf.h>
|
|
23 |
#ifdef __SYMBIAN32__
|
|
24 |
#include "mrt2_glib2_test.h"
|
|
25 |
#endif /*__SYMBIAN32__*/
|
50
|
26 |
|
|
27 |
int main (int argc, char *argv[])
|
|
28 |
{
|
|
29 |
gchar *src = "TestString";
|
|
30 |
gchar dest[20];
|
|
31 |
gchar *p;
|
72
|
32 |
#ifdef __SYMBIAN32__
|
|
33 |
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);
|
|
34 |
g_set_print_handler(mrtPrintHandler);
|
|
35 |
#endif /*__SYMBIAN32__*/
|
50
|
36 |
|
72
|
37 |
g_print("Test utf8-string Start");
|
50
|
38 |
p = g_utf8_strncpy(dest, src, strlen(src));
|
|
39 |
|
|
40 |
if(p == dest)
|
|
41 |
{
|
|
42 |
if(strcmp(dest, src))
|
|
43 |
{
|
72
|
44 |
g_print("g_utf8_strncpy didnt work as expected");
|
50
|
45 |
assert_failed = 1;
|
|
46 |
}
|
|
47 |
}
|
|
48 |
else
|
|
49 |
{
|
72
|
50 |
g_print("g_utf8_strncpy's return value is invalid");
|
50
|
51 |
assert_failed = 1;
|
|
52 |
}
|
|
53 |
|
|
54 |
p = NULL;
|
|
55 |
p = g_utf8_strrchr(src, strlen(src), 't');
|
|
56 |
if(strcmp(p, "tring"))
|
|
57 |
{
|
72
|
58 |
g_print("g_utf8_strrchr didnt work as expected");
|
50
|
59 |
assert_failed = 1;
|
|
60 |
}
|
|
61 |
|
|
62 |
if(assert_failed)
|
72
|
63 |
g_print("Test utf8-string Failed");
|
50
|
64 |
else
|
72
|
65 |
g_print("Test utf8-string Successful");
|
50
|
66 |
|
72
|
67 |
#if __SYMBIAN32__
|
|
68 |
testResultXml("utf8-string");
|
|
69 |
#endif /* EMULATOR */
|
50
|
70 |
|
|
71 |
return 0;
|
|
72 |
}
|