sl@0
|
1 |
// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
#undef G_DISABLE_ASSERT
|
sl@0
|
17 |
#undef G_LOG_DOMAIN
|
sl@0
|
18 |
|
sl@0
|
19 |
#include <glib.h>
|
sl@0
|
20 |
#include <errno.h>
|
sl@0
|
21 |
#include <string.h>
|
sl@0
|
22 |
#define LOG_FILE "c:\\logs\\base_name_log.txt"
|
sl@0
|
23 |
#include "std_log_result.h"
|
sl@0
|
24 |
#define LOG_FILENAME_LINE __FILE__, __LINE__
|
sl@0
|
25 |
|
sl@0
|
26 |
#define MAX_FILENAME_LENGTH 256
|
sl@0
|
27 |
#define MAX_PATH_LENGTH 256
|
sl@0
|
28 |
|
sl@0
|
29 |
void create_xml(int result)
|
sl@0
|
30 |
{
|
sl@0
|
31 |
if(result)
|
sl@0
|
32 |
assert_failed = 1;
|
sl@0
|
33 |
|
sl@0
|
34 |
testResultXml("base_name_log");
|
sl@0
|
35 |
close_log_file();
|
sl@0
|
36 |
}
|
sl@0
|
37 |
|
sl@0
|
38 |
int main (int argc, char *argv[])
|
sl@0
|
39 |
{
|
sl@0
|
40 |
char folder_name[] = "c:\\example\\test\\";
|
sl@0
|
41 |
char file_name[] = "test.txt";
|
sl@0
|
42 |
const gchar *ret_file_name;
|
sl@0
|
43 |
|
sl@0
|
44 |
gchar input_file[MAX_PATH_LENGTH];
|
sl@0
|
45 |
sprintf(input_file, "%s%s", folder_name, file_name);
|
sl@0
|
46 |
|
sl@0
|
47 |
ret_file_name = g_basename(input_file);
|
sl@0
|
48 |
|
sl@0
|
49 |
if(ret_file_name != NULL)
|
sl@0
|
50 |
{
|
sl@0
|
51 |
if(g_strcmp0(ret_file_name, file_name) !=0 )
|
sl@0
|
52 |
{
|
sl@0
|
53 |
std_log(LOG_FILENAME_LINE, "g_basename returned wrong file name");
|
sl@0
|
54 |
assert_failed = 1;
|
sl@0
|
55 |
}
|
sl@0
|
56 |
}
|
sl@0
|
57 |
else
|
sl@0
|
58 |
{
|
sl@0
|
59 |
std_log(LOG_FILENAME_LINE, "g_basename returned NULL. errno = %d", errno);
|
sl@0
|
60 |
assert_failed = 1;
|
sl@0
|
61 |
}
|
sl@0
|
62 |
|
sl@0
|
63 |
|
sl@0
|
64 |
if(assert_failed)
|
sl@0
|
65 |
std_log(LOG_FILENAME_LINE,"Test Failed");
|
sl@0
|
66 |
else
|
sl@0
|
67 |
std_log(LOG_FILENAME_LINE,"Test Successful");
|
sl@0
|
68 |
|
sl@0
|
69 |
create_xml(0);
|
sl@0
|
70 |
|
sl@0
|
71 |
return 0;
|
sl@0
|
72 |
}
|