Update contrib.
2 * Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
15 * Test code for miscellaneous functions implemented via the MSystemInterface
16 * This differs from TMISC in that the functions must be tested twice, once with
17 * the local interface and once with the CPosixServer.
29 #include "CTEST.H" /* includes C interface to EPOC32 threads, and SpawnPosixServer */
33 void env_check(char* name, char* correct_value)
35 char* value = getenv(name);
37 test(strcmp(value,correct_value)==0);
41 @SYMTestCaseID SYSLIB-STDLIB-CT-1070
42 @SYMTestCaseDesc Tests for environment variables
44 @SYMTestActions Tests for getting and setting the environment variables
45 @SYMTestExpectedResults Test must not fail
53 test_Next("Environment variables");
54 value=getenv("not_present");
57 ret=setenv("TEST1","value1",0);
59 value=getenv("not_present");
61 env_check("TEST1","value1");
63 ret=setenv("TEST2","value2",0);
65 env_check("TEST2","value2");
67 unsetenv("not_present");
68 env_check("TEST1","value1");
69 env_check("TEST2","value2");
71 ret=setenv("TEST1","different_value",0); /* no rewrite */
72 test(ret==0); /* apparently this isn't an error */
73 env_check("TEST1","value1");
74 env_check("TEST2","value2");
76 ret=setenv("TEST1","different_value",1); /* with rewrite */
78 env_check("TEST1","different_value");
79 env_check("TEST2","value2");
81 ret=setenv("TEST2","value2.1",1);
83 env_check("TEST1","different_value");
84 env_check("TEST2","value2.1");
87 value=getenv("TEST1");
89 env_check("TEST2","value2.1");
91 ret=setenv("TEST1","a third value which is a really long one so I can force it to realloc some more memory when it does the conversion",0);
93 env_check("TEST1","a third value which is a really long one so I can force it to realloc some more memory when it does the conversion");
94 env_check("TEST2","value2.1");
117 test_Title("Misc MSystemInterface functions");
121 test_Next("Do it again using the CPosixServer (for them, not me)");
124 start_posix_server(); /* calls SpawnPosixServer from C++ code */
127 client=create_thread(allTests, "TMISC2 tests");
129 start_thread(client);
130 err=wait_for_thread(client);