diff options
Diffstat (limited to 'src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test14')
3 files changed, 96 insertions, 0 deletions
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test14/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test14/CMakeLists.txt new file mode 100644 index 0000000000..c6c990312f --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test14/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test14.cpp +) + +add_executable(paltest_vsnwprintf_test14 + ${SOURCES} +) + +add_dependencies(paltest_vsnwprintf_test14 coreclrpal) + +target_link_libraries(paltest_vsnwprintf_test14 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test14/test14.cpp b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test14/test14.cpp new file mode 100644 index 0000000000..cab1b247df --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test14/test14.cpp @@ -0,0 +1,63 @@ +// 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: test14.c +** +** Purpose: Test #14 for the _vsnwprintf_s function. +** +** +**===================================================================*/ + +#include <palsuite.h> +#include "../_vsnwprintf_s.h" + +/* memcmp is used to verify the results, so this test is dependent on it. */ +/* ditto with wcslen */ + +int __cdecl main(int argc, char *argv[]) +{ + double val = 256.0; + double neg = -256.0; + + if (PAL_Initialize(argc, argv) != 0) + { + return(FAIL); + } + + DoDoubleTest(convert("foo %e"), val, convert("foo 2.560000e+002"), + convert("foo 2.560000e+02")); + DoDoubleTest(convert("foo %le"), val, convert("foo 2.560000e+002"), + convert("foo 2.560000e+02")); + DoDoubleTest(convert("foo %he"), val, convert("foo 2.560000e+002"), + convert("foo 2.560000e+02")); + DoDoubleTest(convert("foo %Le"), val, convert("foo 2.560000e+002"), + convert("foo 2.560000e+02")); + DoDoubleTest(convert("foo %I64e"), val, convert("foo 2.560000e+002"), + convert("foo 2.560000e+02")); + DoDoubleTest(convert("foo %14e"), val, convert("foo 2.560000e+002"), + convert("foo 2.560000e+02")); + DoDoubleTest(convert("foo %-14e"), val, convert("foo 2.560000e+002 "), + convert("foo 2.560000e+02 ")); + DoDoubleTest(convert("foo %.1e"), val, convert("foo 2.6e+002"), + convert("foo 2.6e+02")); + DoDoubleTest(convert("foo %.8e"), val, convert("foo 2.56000000e+002"), + convert("foo 2.56000000e+02")); + DoDoubleTest(convert("foo %014e"), val, convert("foo 02.560000e+002"), + convert("foo 002.560000e+02")); + DoDoubleTest(convert("foo %#e"), val, convert("foo 2.560000e+002"), + convert("foo 2.560000e+02")); + DoDoubleTest(convert("foo %+e"), val, convert("foo +2.560000e+002"), + convert("foo +2.560000e+02")); + DoDoubleTest(convert("foo % e"), val, convert("foo 2.560000e+002"), + convert("foo 2.560000e+02")); + DoDoubleTest(convert("foo %+e"), neg, convert("foo -2.560000e+002"), + convert("foo -2.560000e+02")); + DoDoubleTest(convert("foo % e"), neg, convert("foo -2.560000e+002"), + convert("foo -2.560000e+02")); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test14/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test14/testinfo.dat new file mode 100644 index 0000000000..0d46d97649 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test14/testinfo.dat @@ -0,0 +1,14 @@ +# 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 = C Runtime +Function = _vsnwprintf_s +Name = Positive Test for _vsnwprintf_s +TYPE = DEFAULT +EXE1 = test14 +Description += Tests the PAL implementation of the _vsnwprintf_s function. += Tests _vsnwprintf_s with exponential format doubles (lowercase). += This test is modeled after _snwprintf. |