diff options
author | Jiyoung Yun <jy910.yun@samsung.com> | 2016-11-23 19:09:09 +0900 |
---|---|---|
committer | Jiyoung Yun <jy910.yun@samsung.com> | 2016-11-23 19:09:09 +0900 |
commit | 4b4aad7217d3292650e77eec2cf4c198ea9c3b4b (patch) | |
tree | 98110734c91668dfdbb126fcc0e15ddbd93738ca /src/pal/tests/palsuite/miscellaneous/FreeEnvironmentStringsW/test1 | |
parent | fa45f57ed55137c75ac870356a1b8f76c84b229c (diff) | |
download | coreclr-4b4aad7217d3292650e77eec2cf4c198ea9c3b4b.tar.gz coreclr-4b4aad7217d3292650e77eec2cf4c198ea9c3b4b.tar.bz2 coreclr-4b4aad7217d3292650e77eec2cf4c198ea9c3b4b.zip |
Imported Upstream version 1.1.0upstream/1.1.0
Diffstat (limited to 'src/pal/tests/palsuite/miscellaneous/FreeEnvironmentStringsW/test1')
3 files changed, 87 insertions, 0 deletions
diff --git a/src/pal/tests/palsuite/miscellaneous/FreeEnvironmentStringsW/test1/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/FreeEnvironmentStringsW/test1/CMakeLists.txt new file mode 100644 index 0000000000..be39b63ec9 --- /dev/null +++ b/src/pal/tests/palsuite/miscellaneous/FreeEnvironmentStringsW/test1/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test.c +) + +add_executable(paltest_freeenvironmentstringsw_test1 + ${SOURCES} +) + +add_dependencies(paltest_freeenvironmentstringsw_test1 coreclrpal) + +target_link_libraries(paltest_freeenvironmentstringsw_test1 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/miscellaneous/FreeEnvironmentStringsW/test1/test.c b/src/pal/tests/palsuite/miscellaneous/FreeEnvironmentStringsW/test1/test.c new file mode 100644 index 0000000000..56010039d7 --- /dev/null +++ b/src/pal/tests/palsuite/miscellaneous/FreeEnvironmentStringsW/test1/test.c @@ -0,0 +1,53 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/*============================================================ +** +** Source: test.c +** +** Purpose: Test for FreeEnvironmentStringsW() function +** +** +**=========================================================*/ + +#define UNICODE +#include <palsuite.h> + +int __cdecl main(int argc, char *argv[]) +{ + + LPWSTR CapturedEnvironment = NULL; + BOOL TheResult = 0; + + /* + * Initialize the PAL and return FAILURE if this fails + */ + + if(0 != (PAL_Initialize(argc, argv))) + { + return FAIL; + } + + CapturedEnvironment = GetEnvironmentStrings(); + + /* If it's pointing to NULL, it failed. This checks the dependency */ + if(CapturedEnvironment == NULL) { + Fail("The function GetEnvironmentStrings() failed, and the " + "FreeEnvironmentStrings() tests is dependant on it.\n"); + } + + /* This should return 1, if it succeeds, otherwise, test fails */ + TheResult = FreeEnvironmentStrings(CapturedEnvironment); + if(TheResult != 1) { + Fail("The function returned %d which indicates failure to Free the " + "Environment Strings.\n",TheResult); + } + + + PAL_Terminate(); + return PASS; +} + + + diff --git a/src/pal/tests/palsuite/miscellaneous/FreeEnvironmentStringsW/test1/testinfo.dat b/src/pal/tests/palsuite/miscellaneous/FreeEnvironmentStringsW/test1/testinfo.dat new file mode 100644 index 0000000000..f653bf5dc2 --- /dev/null +++ b/src/pal/tests/palsuite/miscellaneous/FreeEnvironmentStringsW/test1/testinfo.dat @@ -0,0 +1,15 @@ +# Licensed to the .NET Foundation under one or more agreements. +# The .NET Foundation licenses this file to you under the MIT license. +# See the LICENSE file in the project root for more information. + +Version = 1.0 +Section = Miscellaneous +Function = FreeEnvironmentStringsW +Name = Return value test for FreeEnvironmentStringsW +TYPE = DEFAULT +EXE1 = test +Description += Get a set of strings and then free it to see if function returns success + + + |