diff options
Diffstat (limited to 'src/pal/tests/palsuite/c_runtime')
1443 files changed, 13906 insertions, 11764 deletions
diff --git a/src/pal/tests/palsuite/c_runtime/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/CMakeLists.txt index 533454c285..cf062530eb 100644 --- a/src/pal/tests/palsuite/c_runtime/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/CMakeLists.txt @@ -2,16 +2,23 @@ cmake_minimum_required(VERSION 2.8.12.2) add_subdirectory(abs) add_subdirectory(acos) +add_subdirectory(acosf) add_subdirectory(asin) +add_subdirectory(asinf) add_subdirectory(atan) add_subdirectory(atan2) +add_subdirectory(atan2f) +add_subdirectory(atanf) add_subdirectory(atof) add_subdirectory(atoi) add_subdirectory(atol) add_subdirectory(bsearch) add_subdirectory(ceil) +add_subdirectory(ceilf) add_subdirectory(cos) +add_subdirectory(cosf) add_subdirectory(cosh) +add_subdirectory(coshf) # TODO: make this test compile # add_subdirectory(ctime) @@ -19,6 +26,7 @@ add_subdirectory(cosh) add_subdirectory(errno) add_subdirectory(exit) add_subdirectory(exp) +add_subdirectory(expf) add_subdirectory(fabs) add_subdirectory(fabsf) add_subdirectory(fclose) @@ -27,6 +35,7 @@ add_subdirectory(ferror) add_subdirectory(fflush) add_subdirectory(fgets) add_subdirectory(floor) +add_subdirectory(floorf) add_subdirectory(fmod) add_subdirectory(fmodf) add_subdirectory(fopen) @@ -57,6 +66,8 @@ add_subdirectory(llabs) add_subdirectory(localtime) add_subdirectory(log) add_subdirectory(log10) +add_subdirectory(log10f) +add_subdirectory(logf) add_subdirectory(malloc) add_subdirectory(memchr) add_subdirectory(memcmp) @@ -66,15 +77,19 @@ add_subdirectory(memset) add_subdirectory(modf) add_subdirectory(modff) add_subdirectory(pow) +add_subdirectory(powf) add_subdirectory(printf) add_subdirectory(qsort) add_subdirectory(rand_srand) add_subdirectory(realloc) add_subdirectory(sin) +add_subdirectory(sinf) add_subdirectory(sinh) -add_subdirectory(sprintf) +add_subdirectory(sinhf) +add_subdirectory(sprintf_s) add_subdirectory(sqrt) -add_subdirectory(sscanf) +add_subdirectory(sqrtf) +add_subdirectory(sscanf_s) add_subdirectory(strcat) add_subdirectory(strchr) add_subdirectory(strcmp) @@ -94,7 +109,9 @@ add_subdirectory(strtoul) add_subdirectory(swprintf) add_subdirectory(swscanf) add_subdirectory(tan) +add_subdirectory(tanf) add_subdirectory(tanh) +add_subdirectory(tanhf) add_subdirectory(time) add_subdirectory(tolower) add_subdirectory(toupper) @@ -125,6 +142,7 @@ add_subdirectory(_alloca) add_subdirectory(_ecvt) add_subdirectory(_fdopen) add_subdirectory(_finite) +add_subdirectory(_finitef) add_subdirectory(_fullpath) # TODO: make this test compile @@ -132,31 +150,26 @@ add_subdirectory(_fullpath) add_subdirectory(_getw) add_subdirectory(_isnan) +add_subdirectory(_isnanf) add_subdirectory(_itow) -add_subdirectory(_makepath) add_subdirectory(_mbsdec) add_subdirectory(_mbsinc) -add_subdirectory(_mbslen) add_subdirectory(_mbsninc) add_subdirectory(_open_osfhandle) add_subdirectory(_putenv) add_subdirectory(_putw) add_subdirectory(_rotl) add_subdirectory(_rotr) -add_subdirectory(_snprintf) -add_subdirectory(_snwprintf) -add_subdirectory(_splitpath) +add_subdirectory(_snprintf_s) +add_subdirectory(_snwprintf_s) add_subdirectory(_stricmp) add_subdirectory(_strlwr) add_subdirectory(_strnicmp) -add_subdirectory(_swab) add_subdirectory(_vsnprintf) -add_subdirectory(_vsnwprintf) +add_subdirectory(_vsnwprintf_s) add_subdirectory(_wcsicmp) add_subdirectory(_wcslwr) add_subdirectory(_wcsnicmp) add_subdirectory(_wfopen) -add_subdirectory(_wmakepath) -add_subdirectory(_wsplitpath) add_subdirectory(_wtoi) add_subdirectory(__iscsym) diff --git a/src/pal/tests/palsuite/c_runtime/__iscsym/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/__iscsym/test1/CMakeLists.txt index a283161f7d..b4421e77a1 100644 --- a/src/pal/tests/palsuite/c_runtime/__iscsym/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/__iscsym/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - __iscsym.c + __iscsym.cpp ) add_executable(paltest_iscsym_test1 diff --git a/src/pal/tests/palsuite/c_runtime/__iscsym/test1/__iscsym.c b/src/pal/tests/palsuite/c_runtime/__iscsym/test1/__iscsym.cpp index 9c8f1d0f25..9c8f1d0f25 100644 --- a/src/pal/tests/palsuite/c_runtime/__iscsym/test1/__iscsym.c +++ b/src/pal/tests/palsuite/c_runtime/__iscsym/test1/__iscsym.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_alloca/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_alloca/test1/CMakeLists.txt index 236b356185..434633be20 100644 --- a/src/pal/tests/palsuite/c_runtime/_alloca/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_alloca/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_alloca_test1 diff --git a/src/pal/tests/palsuite/c_runtime/_alloca/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_alloca/test1/test1.cpp index c533d84234..c533d84234 100644 --- a/src/pal/tests/palsuite/c_runtime/_alloca/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/_alloca/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_ecvt/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_ecvt/test1/CMakeLists.txt index 86f4547b2b..e78a802723 100644 --- a/src/pal/tests/palsuite/c_runtime/_ecvt/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_ecvt/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_ecvt_test1 diff --git a/src/pal/tests/palsuite/c_runtime/_ecvt/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_ecvt/test1/test1.cpp index fbcf11ecfc..fbcf11ecfc 100644 --- a/src/pal/tests/palsuite/c_runtime/_ecvt/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/_ecvt/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_fdopen/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_fdopen/test1/CMakeLists.txt index 441d32bd5c..60b036f44d 100644 --- a/src/pal/tests/palsuite/c_runtime/_fdopen/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_fdopen/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_fdopen_test1 diff --git a/src/pal/tests/palsuite/c_runtime/_fdopen/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_fdopen/test1/test1.cpp index b88267c6e4..b88267c6e4 100644 --- a/src/pal/tests/palsuite/c_runtime/_fdopen/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/_fdopen/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_finite/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_finite/test1/CMakeLists.txt index 8aca58a8dc..ac2f25d85a 100644 --- a/src/pal/tests/palsuite/c_runtime/_finite/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_finite/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_finite_test1 diff --git a/src/pal/tests/palsuite/c_runtime/_finite/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_finite/test1/test1.cpp index c815055b38..c815055b38 100644 --- a/src/pal/tests/palsuite/c_runtime/_finite/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/_finite/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_finitef/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_finitef/CMakeLists.txt new file mode 100644 index 0000000000..5e1ef7f28b --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_finitef/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +add_subdirectory(test1) diff --git a/src/pal/tests/palsuite/c_runtime/_finitef/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_finitef/test1/CMakeLists.txt new file mode 100644 index 0000000000..9ef630fbb2 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_finitef/test1/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test1.c +) + +add_executable(paltest_finitef_test1 + ${SOURCES} +) + +add_dependencies(paltest_finitef_test1 coreclrpal) + +target_link_libraries(paltest_finitef_test1 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_finitef/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_finitef/test1/test1.c new file mode 100644 index 0000000000..f9a1109a66 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_finitef/test1/test1.c @@ -0,0 +1,119 @@ +// 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: test1.c +** +** Purpose: Checks that _finitef correctly classifies all types +** of floating point numbers (NaN, -Infinity, Infinity, +** finite nonzero, unnormalized, 0, and -0) +** +**==========================================================================*/ + +#include <palsuite.h> + +/* +The IEEE single precision floating point standard looks like this: + + S EEEEEEEE FFFFFFFFFFFFFFFFFFFFFFF + 0 1 8 9 31 + +S is the sign bit. The E bits are the exponent, and the 23 F bits are +the fraction. These represent a value, V. + +If E=255 and F is nonzero, then V=NaN ("Not a number") +If E=255 and F is zero and S is 1, then V=-Infinity +If E=255 and F is zero and S is 0, then V=Infinity +If 0<E<255 then V=(-1)^S * 2^(E-1028) * (1.F) where "1.F" is the binary + number created by prefixing F with a leading 1 and a binary point. +If E=0 and F is nonzero, then V=(-1)^S * 2^(-127) * (0.F) These are + "unnormalized" values. +If E=0 and F is zero and S is 1, then V=-0 +If E=0 and F is zero and S is 0, then V=0 + +*/ + +#define TO_FLOAT(x) (*((float*)((void*)&x))) + +int __cdecl main(int argc, char **argv) +{ + /*non-finite numbers*/ + UINT32 lsnan = 0xffffffffu; + UINT32 lqnan = 0x7fffffffu; + UINT32 lneginf = 0xff800000u; + UINT32 lposinf = 0x7f800000u; + + float snan = TO_FLOAT(lsnan); + float qnan = TO_FLOAT(lqnan); + float neginf = TO_FLOAT(lneginf); + float posinf = TO_FLOAT(lposinf); + + /*finite numbers*/ + UINT32 lnegunnormalized = 0x807fffffu; + UINT32 lposunnormalized = 0x007fffffu; + UINT32 lnegzero = 0x80000000u; + + float negunnormalized = TO_FLOAT(lnegunnormalized); + float posunnormalized = TO_FLOAT(lposunnormalized); + float negzero = TO_FLOAT(lnegzero); + + /* + * Initialize the PAL and return FAIL if this fails + */ + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + /*non-finite numbers*/ + if (_finitef(snan) || _finitef(qnan)) + { + Fail("_finitef() found NAN to be finite.\n"); + } + + if (_finitef(neginf)) + { + Fail("_finitef() found negative infinity to be finite.\n"); + } + + if (_finitef(posinf)) + { + Fail("_finitef() found infinity to be finite.\n"); + } + + /*finite numbers*/ + if (!_finitef(negunnormalized)) + { + Fail("_finitef() found a negative unnormalized value to be infinite.\n"); + } + + if (!_finitef(posunnormalized)) + { + Fail("_finitef() found an unnormalized value to be infinite.\n"); + } + + if (!_finitef(negzero)) + { + Fail("_finitef() found negative zero to be infinite.\n"); + } + + if (!_finitef(+0.0f)) + { + Fail("_finitef() found zero to be infinite.\n"); + } + + if (!_finitef(-123.456f)) + { + Fail("_finitef() found %f to be infinite.\n", -123.456f); + } + + if (!_finitef(+123.456f)) + { + Fail("_finitef() found %f to be infinite.\n", +123.456f); + } + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/_finitef/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_finitef/test1/testinfo.dat new file mode 100644 index 0000000000..b0767431e5 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_finitef/test1/testinfo.dat @@ -0,0 +1,13 @@ +# 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 = _finitef +Name = Positive Test for _finitef +TYPE = DEFAULT +EXE1 = test1 +Description += Checks that _finitef correctly classifies all types of floating point += numbers (NaN, -Infinity, Infinity, finite nonzero, unnormalized, 0, and -0). diff --git a/src/pal/tests/palsuite/c_runtime/_fullpath/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_fullpath/test1/CMakeLists.txt index 9306efa700..0c9029f6e2 100644 --- a/src/pal/tests/palsuite/c_runtime/_fullpath/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_fullpath/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_fullpath_test1 diff --git a/src/pal/tests/palsuite/c_runtime/_fullpath/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_fullpath/test1/test1.cpp index f390f4309b..f390f4309b 100644 --- a/src/pal/tests/palsuite/c_runtime/_fullpath/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/_fullpath/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_gcvt/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_gcvt/test1/CMakeLists.txt index 33eb5cf19c..47dcb95754 100644 --- a/src/pal/tests/palsuite/c_runtime/_gcvt/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_gcvt/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - _gcvt.c + _gcvt.cpp ) add_executable(paltest_gcvt_test1 diff --git a/src/pal/tests/palsuite/c_runtime/_gcvt/test1/_gcvt.c b/src/pal/tests/palsuite/c_runtime/_gcvt/test1/_gcvt.cpp index ccfc286898..ccfc286898 100644 --- a/src/pal/tests/palsuite/c_runtime/_gcvt/test1/_gcvt.c +++ b/src/pal/tests/palsuite/c_runtime/_gcvt/test1/_gcvt.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_gcvt/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_gcvt/test2/CMakeLists.txt index 05641b9b78..5b0f5608f3 100644 --- a/src/pal/tests/palsuite/c_runtime/_gcvt/test2/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_gcvt/test2/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test2.c + test2.cpp ) add_executable(paltest_gcvt_test2 diff --git a/src/pal/tests/palsuite/c_runtime/_gcvt/test2/test2.c b/src/pal/tests/palsuite/c_runtime/_gcvt/test2/test2.cpp index 7ac9a4fcf0..7ac9a4fcf0 100644 --- a/src/pal/tests/palsuite/c_runtime/_gcvt/test2/test2.c +++ b/src/pal/tests/palsuite/c_runtime/_gcvt/test2/test2.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_getw/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_getw/test1/CMakeLists.txt index d44477b232..4f763bed6b 100644 --- a/src/pal/tests/palsuite/c_runtime/_getw/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_getw/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_getw_test1 diff --git a/src/pal/tests/palsuite/c_runtime/_getw/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_getw/test1/test1.cpp index 34ce4ee7de..34ce4ee7de 100644 --- a/src/pal/tests/palsuite/c_runtime/_getw/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/_getw/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_isnan/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_isnan/test1/CMakeLists.txt index e14d0cc64b..106ccb93d7 100644 --- a/src/pal/tests/palsuite/c_runtime/_isnan/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_isnan/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_isnan_test1 diff --git a/src/pal/tests/palsuite/c_runtime/_isnan/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_isnan/test1/test1.cpp index d793c9b371..d793c9b371 100644 --- a/src/pal/tests/palsuite/c_runtime/_isnan/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/_isnan/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_isnanf/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_isnanf/CMakeLists.txt new file mode 100644 index 0000000000..5e1ef7f28b --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_isnanf/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +add_subdirectory(test1) diff --git a/src/pal/tests/palsuite/c_runtime/_isnanf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_isnanf/test1/CMakeLists.txt new file mode 100644 index 0000000000..a8d42aa975 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_isnanf/test1/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test1.c +) + +add_executable(paltest_isnanf_test1 + ${SOURCES} +) + +add_dependencies(paltest_isnanf_test1 coreclrpal) + +target_link_libraries(paltest_isnanf_test1 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_isnanf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_isnanf/test1/test1.c new file mode 100644 index 0000000000..9b75a7236d --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_isnanf/test1/test1.c @@ -0,0 +1,115 @@ +// 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: test1.c +** +** Purpose: +** Test _isnanf with a number of trivial values, to ensure they indicated that +** they are numbers. Then try with Positive/Negative Infinite, which should +** also be numbers. Finally set the least and most significant bits of +** the fraction to positive and negative, at which point it should return +** the true value. +** +**==========================================================================*/ + +#include <palsuite.h> + +#define TO_FLOAT(x) (*((float*)((void*)&x))) +#define TO_I32(x) (*((INT32*)((void*)&x))) + +/* + * NaN: any float with maximum exponent (0x7f8) and non-zero fraction + */ +int __cdecl main(int argc, char *argv[]) +{ + /* + * Initialize the PAL and return FAIL if this fails + */ + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + /* + * Try some trivial values + */ + if (_isnanf(0.0f)) + { + Fail("_isnanf() incorrectly identified %f as NaN!\n", 0.0f); + } + + if (_isnanf(1.234567f)) + { + Fail("_isnanf() incorrectly identified %f as NaN!\n", 1.234567f); + } + + if (_isnanf(42.0f)) + { + Fail("_isnanf() incorrectly identified %f as NaN!\n", 42.0f); + } + + UINT32 lneginf = 0xff800000u; + UINT32 lposinf = 0x7f800000u; + + float neginf = TO_FLOAT(lneginf); + float posinf = TO_FLOAT(lposinf); + + /* + * Try positive and negative infinity + */ + if (_isnanf(neginf)) + { + Fail("_isnanf() incorrectly identified negative infinity as NaN!\n"); + } + + if (_isnanf(posinf)) + { + Fail("_isnanf() incorrectly identified infinity as NaN!\n"); + } + + /* + * Try setting the least significant bit of the fraction, + * positive and negative + */ + UINT32 lsnan = 0xff800001u; + float snan = TO_FLOAT(lsnan); + + if (!_isnanf(snan)) + { + Fail("_isnanf() failed to identify %I32x as NaN!\n", lsnan); + } + + UINT32 lqnan = 0x7f800001u; + float qnan = TO_FLOAT(lqnan); + + if (!_isnanf(qnan)) + { + Fail("_isnanf() failed to identify %I32x as NaN!\n", lqnan); + } + + /* + * Try setting the most significant bit of the fraction, + * positive and negative + */ + lsnan = 0xffc00000u; + snan = TO_FLOAT(lsnan); + + if (!_isnanf(snan)) + { + Fail ("_isnanf() failed to identify %I32x as NaN!\n", lsnan); + } + + lqnan = 0x7fc00000u; + qnan = TO_FLOAT(lqnan); + + if (!_isnanf(qnan)) + { + Fail ("_isnanf() failed to identify %I32x as NaN!\n", lqnan); + } + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/_isnanf/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_isnanf/test1/testinfo.dat new file mode 100644 index 0000000000..22b0edbd74 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_isnanf/test1/testinfo.dat @@ -0,0 +1,16 @@ +# 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 = _isnanf +Name = Test #1 for _isnanf +TYPE = DEFAULT +EXE1 = test1 +Description += Test _isnanf with a number of trivial values, to ensure they indicated that += they are numbers. Then try with Positive/Negative Infinite, which should += also be numbers. Finally set the least and most significant bits of += the fraction to positive and negative, at which point it should return += the true value. diff --git a/src/pal/tests/palsuite/c_runtime/_itow/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_itow/test1/CMakeLists.txt index bd37f31216..2c5d57bd34 100644 --- a/src/pal/tests/palsuite/c_runtime/_itow/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_itow/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_itow_test1 diff --git a/src/pal/tests/palsuite/c_runtime/_itow/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_itow/test1/test1.c deleted file mode 100644 index 745ce4acaa..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_itow/test1/test1.c +++ /dev/null @@ -1,102 +0,0 @@ -// 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: test1.c -** -** Purpose: Tests the PAL implementation of the _itow function. -** Test a number of ints with different radix on each, -** to ensure that the string returned is correct. -** -** -**===================================================================*/ - -#define UNICODE - -#include <palsuite.h> - -struct testCase -{ - wchar_t *CorrectResult; - int value; - int radix; -}; - -int __cdecl main(int argc, char **argv) -{ - - wchar_t result[20]; - wchar_t *pResult = NULL; - char *PrintResult = NULL; /* Use with convertC so we can */ - char *PrintCorrectResult = NULL; /* print out the results */ - int i = 0; - - WCHAR case1[] = {'5','0','\0'}; - WCHAR case2[] = {'5','5','5','\0'}; - WCHAR case3[] = {'1','0','1','0','\0'}; - WCHAR case4[] = {'2','2','\0'}; - WCHAR case5[] = {'a','\0'}; - WCHAR case6[] = {'c','g','\0'}; - - /* Correct Result, Value to Convert, Radix to use */ - struct testCase testCases[] = - { - {case1, 50, 10}, - {case2,555,10}, - {case3,10,2}, - {case4,10,4}, - {case5,10,16}, - {case6,400,32} - }; - - /* - * Initialize the PAL and return FAIL if this fails - */ - if (0 != (PAL_Initialize(argc, argv))) - { - return FAIL; - } - - /* Loop through each case. Convert the ints to strings. Check - to ensure they were converted properly. - */ - - for(i = 0; i < sizeof(testCases) / sizeof(struct testCase); i++) - { - pResult = _itow(testCases[i].value,result,testCases[i].radix); - - if(pResult != &result[0]) - { - Fail("ERROR: _itow didn't return a correct pointer to the " - "newly formed string.\n"); - } - - if (0 != wcscmp(testCases[i].CorrectResult,pResult)) - { - PrintResult = convertC(pResult); - PrintCorrectResult = convertC(testCases[i].CorrectResult); - Fail("ERROR: _itow was called on %i, returning the string %s " - "when it should have returned the string %s.\n" - , testCases[i].value, PrintResult, PrintCorrectResult); - } - - } - - PAL_Terminate(); - return PASS; -} - - - - - - - - - - - - - diff --git a/src/pal/tests/palsuite/c_runtime/_itow/test1/test1.cpp b/src/pal/tests/palsuite/c_runtime/_itow/test1/test1.cpp new file mode 100644 index 0000000000..01f32f2520 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_itow/test1/test1.cpp @@ -0,0 +1,101 @@ +// 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: test1.c +** +** Purpose: Tests the PAL implementation of the _itow_s function. +** Test a number of ints with different radix on each, +** to ensure that the string returned is correct. +** +** +**===================================================================*/ + +#define UNICODE + +#include <palsuite.h> + +struct testCase +{ + wchar_t *CorrectResult; + int value; + int radix; +}; + +int __cdecl main(int argc, char **argv) +{ + + wchar_t result[20]; + wchar_t *pResult = NULL; + char *PrintResult = NULL; /* Use with convertC so we can */ + char *PrintCorrectResult = NULL; /* print out the results */ + int i = 0; + + WCHAR case1[] = {'5','0','\0'}; + WCHAR case2[] = {'5','5','5','\0'}; + WCHAR case3[] = {'1','0','1','0','\0'}; + WCHAR case4[] = {'2','2','\0'}; + WCHAR case5[] = {'a','\0'}; + WCHAR case6[] = {'c','g','\0'}; + + /* Correct Result, Value to Convert, Radix to use */ + struct testCase testCases[] = + { + {case1, 50, 10}, + {case2,555,10}, + {case3,10,2}, + {case4,10,4}, + {case5,10,16}, + {case6,400,32} + }; + + /* + * Initialize the PAL and return FAIL if this fails + */ + if (0 != (PAL_Initialize(argc, argv))) + { + return FAIL; + } + + /* Loop through each case. Convert the ints to strings. Check + to ensure they were converted properly. + */ + + for(i = 0; i < sizeof(testCases) / sizeof(struct testCase); i++) + { + errno_t err = _itow_s(testCases[i].value, result, sizeof(result) / sizeof(result[0]), testCases[i].radix); + + if(err != 0) + { + Fail("ERROR: _itow_s didn't return success, error code %d.\n", err); + } + + if (0 != wcscmp(testCases[i].CorrectResult, result)) + { + PrintResult = convertC(pResult); + PrintCorrectResult = convertC(testCases[i].CorrectResult); + Fail("ERROR: _itow_s was called on %i, returning the string %s " + "when it should have returned the string %s.\n" + , testCases[i].value, PrintResult, PrintCorrectResult); + } + + } + + PAL_Terminate(); + return PASS; +} + + + + + + + + + + + + + diff --git a/src/pal/tests/palsuite/c_runtime/_itow/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_itow/test1/testinfo.dat index 394c34dff3..91f0e62e09 100644 --- a/src/pal/tests/palsuite/c_runtime/_itow/test1/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/_itow/test1/testinfo.dat @@ -4,12 +4,12 @@ Version = 1.0 Section = C Runtime -Function = _itow -Name = Positive Test for _itow +Function = _itow_s +Name = Positive Test for _itow_s TYPE = DEFAULT EXE1 = test1 Description -= Tests the PAL implementation of the _itow function. += Tests the PAL implementation of the _itow_s function. = Test a number of ints with different radix on each, to ensure that the = string returned is correct. diff --git a/src/pal/tests/palsuite/c_runtime/_makepath/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_makepath/test1/CMakeLists.txt deleted file mode 100644 index 9fd81cce1a..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_makepath/test1/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test1.c -) - -add_executable(paltest_makepath_test1 - ${SOURCES} -) - -add_dependencies(paltest_makepath_test1 coreclrpal) - -target_link_libraries(paltest_makepath_test1 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_makepath/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_makepath/test1/test1.c deleted file mode 100644 index 94b366a7bb..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_makepath/test1/test1.c +++ /dev/null @@ -1,65 +0,0 @@ -// 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: test1.c -** -** Purpose: Tests the PAL implementation of the _makepath function. -** Create a path, and ensure that it builds how it is -** supposed to. -** -** -** -**===================================================================*/ - -#if WIN32 -#define PATHNAME "C:\\test\\test.txt" -#else -#define PATHNAME "/test/test.txt" -#endif - -#include <palsuite.h> - -int __cdecl main(int argc, char **argv) -{ - char FullPath[128]; - - /* - * Initialize the PAL and return FAIL if this fails - */ - if (0 != (PAL_Initialize(argc,argv))) - { - return FAIL; - } - -#if WIN32 - _makepath(FullPath,"C","\\test","test","txt"); -#else - _makepath(FullPath,NULL,"/test","test","txt"); -#endif - - if(strcmp(FullPath,PATHNAME) != 0) - { - Fail("ERROR: The pathname which was created turned out to be %s " - "when it was supposed to be %s.\n",FullPath,PATHNAME); - } - - - PAL_Terminate(); - return PASS; -} - - - - - - - - - - - - - diff --git a/src/pal/tests/palsuite/c_runtime/_makepath/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_makepath/test1/testinfo.dat deleted file mode 100644 index 2aed8e549b..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_makepath/test1/testinfo.dat +++ /dev/null @@ -1,14 +0,0 @@ -# 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 = _makepath -Name = Positive Test for _makepath -TYPE = DEFAULT -EXE1 = test1 -Description -= Purpose: Tests the PAL implementation of the _makepath function. -= Create a path, and ensure that it builds how it is supposed to. - diff --git a/src/pal/tests/palsuite/c_runtime/_mbsdec/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_mbsdec/test1/CMakeLists.txt index 064f241f24..b016f27982 100644 --- a/src/pal/tests/palsuite/c_runtime/_mbsdec/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_mbsdec/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_mbsdec_test1 diff --git a/src/pal/tests/palsuite/c_runtime/_mbsdec/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_mbsdec/test1/test1.cpp index 1cd7513293..1cd7513293 100644 --- a/src/pal/tests/palsuite/c_runtime/_mbsdec/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/_mbsdec/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_mbsinc/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_mbsinc/test1/CMakeLists.txt index 531ba8e793..c7325b9513 100644 --- a/src/pal/tests/palsuite/c_runtime/_mbsinc/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_mbsinc/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_mbsinc_test1 diff --git a/src/pal/tests/palsuite/c_runtime/_mbsinc/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_mbsinc/test1/test1.cpp index 95a5041af2..95a5041af2 100644 --- a/src/pal/tests/palsuite/c_runtime/_mbsinc/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/_mbsinc/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_mbslen/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_mbslen/CMakeLists.txt deleted file mode 100644 index f6aa0cb2d9..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_mbslen/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -add_subdirectory(test1) - diff --git a/src/pal/tests/palsuite/c_runtime/_mbslen/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_mbslen/test1/CMakeLists.txt deleted file mode 100644 index 38aa6fb16e..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_mbslen/test1/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test1.c -) - -add_executable(paltest_mbslen_test1 - ${SOURCES} -) - -add_dependencies(paltest_mbslen_test1 coreclrpal) - -target_link_libraries(paltest_mbslen_test1 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_mbslen/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_mbslen/test1/test1.c deleted file mode 100644 index fa24c77d8a..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_mbslen/test1/test1.c +++ /dev/null @@ -1,66 +0,0 @@ -// 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: test1.c -** -** Purpose: -** Check the length of a number of arrays. The first is a normal string -** which should return its length. The second has two bytes and a null -** character, which only returns a size of 2, and the last is just a NULL -** array which should return 0. -** -** -**========================================================================*/ - -#include <palsuite.h> - -/* - * Note: it seems like these functions would only be useful if they - * didn't assume a character was equivalent to a single byte. Be that - * as it may, I haven't seen a way to get it to behave otherwise - * (eg locale) - */ - -int __cdecl main(int argc, char *argv[]) -{ - unsigned char *str1 = (unsigned char*) "foo"; - unsigned char str2[] = {0xC0, 0x80, 0}; /* the char U+0080 */ - unsigned char str3[] = {0}; - int ret=0; - - /* - * Initialize the PAL and return FAIL if this fails - */ - if (0 != (PAL_Initialize(argc, argv))) - { - return FAIL; - } - - ret = _mbslen(str1); - if (ret != 3) - { - Fail ("ERROR: _mbslen(\"%s\") returned %d. Expected %d\n", - str1, ret, 3); - } - - ret = _mbslen(str2); - if (ret != 2) - { - Fail ("ERROR: _mbslen(\"%s\") returned %d. Expected %d\n", - str2, ret, 2); - } - - ret = _mbslen(str3); - if (ret != 0) - { - Fail ("ERROR: _mbslen(\"%s\") returned %d. Expected %d\n", - str3, ret, 0); - } - - PAL_Terminate(); - return PASS; -} - diff --git a/src/pal/tests/palsuite/c_runtime/_mbslen/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_mbslen/test1/testinfo.dat deleted file mode 100644 index cf830a7539..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_mbslen/test1/testinfo.dat +++ /dev/null @@ -1,15 +0,0 @@ -# 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 = _mbsinc -Name = Positive Test for _mbslen -TYPE = DEFAULT -EXE1 = test1 -Description -= Check the length of a number of arrays. The first is a normal string -= which should return its length. The second has two bytes and a null -= character, which only returns a size of 2, and the last is just a NULL -= array which should return 0. diff --git a/src/pal/tests/palsuite/c_runtime/_mbsninc/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_mbsninc/test1/CMakeLists.txt index 7285ce229e..81c6c23a53 100644 --- a/src/pal/tests/palsuite/c_runtime/_mbsninc/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_mbsninc/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_mbsninc_test1 diff --git a/src/pal/tests/palsuite/c_runtime/_mbsninc/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_mbsninc/test1/test1.cpp index 59ef50dcc3..59ef50dcc3 100644 --- a/src/pal/tests/palsuite/c_runtime/_mbsninc/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/_mbsninc/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_open_osfhandle/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_open_osfhandle/test1/CMakeLists.txt index e9a3e29192..f4fedb61ae 100644 --- a/src/pal/tests/palsuite/c_runtime/_open_osfhandle/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_open_osfhandle/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_open_osfhandle_test1 diff --git a/src/pal/tests/palsuite/c_runtime/_open_osfhandle/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_open_osfhandle/test1/test1.cpp index ee2c8ea418..ee2c8ea418 100644 --- a/src/pal/tests/palsuite/c_runtime/_open_osfhandle/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/_open_osfhandle/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_open_osfhandle/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_open_osfhandle/test2/CMakeLists.txt index 1031ec1df9..6086868de2 100644 --- a/src/pal/tests/palsuite/c_runtime/_open_osfhandle/test2/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_open_osfhandle/test2/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test2.c + test2.cpp ) add_executable(paltest_open_osfhandle_test2 diff --git a/src/pal/tests/palsuite/c_runtime/_open_osfhandle/test2/test2.c b/src/pal/tests/palsuite/c_runtime/_open_osfhandle/test2/test2.cpp index 6c756b177a..6c756b177a 100644 --- a/src/pal/tests/palsuite/c_runtime/_open_osfhandle/test2/test2.c +++ b/src/pal/tests/palsuite/c_runtime/_open_osfhandle/test2/test2.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_putenv/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_putenv/test1/CMakeLists.txt index 0a75b41113..9096bc1033 100644 --- a/src/pal/tests/palsuite/c_runtime/_putenv/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_putenv/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_putenv_test1 diff --git a/src/pal/tests/palsuite/c_runtime/_putenv/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_putenv/test1/test1.cpp index 2d096adc78..2d096adc78 100644 --- a/src/pal/tests/palsuite/c_runtime/_putenv/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/_putenv/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_putenv/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_putenv/test2/CMakeLists.txt index e0539681cd..ad99eba373 100644 --- a/src/pal/tests/palsuite/c_runtime/_putenv/test2/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_putenv/test2/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test2.c + test2.cpp ) add_executable(paltest_putenv_test2 diff --git a/src/pal/tests/palsuite/c_runtime/_putenv/test2/test2.c b/src/pal/tests/palsuite/c_runtime/_putenv/test2/test2.cpp index 39be4f68b4..39be4f68b4 100644 --- a/src/pal/tests/palsuite/c_runtime/_putenv/test2/test2.c +++ b/src/pal/tests/palsuite/c_runtime/_putenv/test2/test2.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_putenv/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_putenv/test3/CMakeLists.txt index a67241022b..fc97b951b3 100644 --- a/src/pal/tests/palsuite/c_runtime/_putenv/test3/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_putenv/test3/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test3.c + test3.cpp ) add_executable(paltest_putenv_test3 diff --git a/src/pal/tests/palsuite/c_runtime/_putenv/test3/test3.c b/src/pal/tests/palsuite/c_runtime/_putenv/test3/test3.cpp index 8aa6777307..8aa6777307 100644 --- a/src/pal/tests/palsuite/c_runtime/_putenv/test3/test3.c +++ b/src/pal/tests/palsuite/c_runtime/_putenv/test3/test3.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_putenv/test4/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_putenv/test4/CMakeLists.txt index 518282ccc7..3881626d01 100644 --- a/src/pal/tests/palsuite/c_runtime/_putenv/test4/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_putenv/test4/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test4.c + test4.cpp ) add_executable(paltest_putenv_test4 diff --git a/src/pal/tests/palsuite/c_runtime/_putenv/test4/test4.c b/src/pal/tests/palsuite/c_runtime/_putenv/test4/test4.cpp index 48d7ba963c..48d7ba963c 100644 --- a/src/pal/tests/palsuite/c_runtime/_putenv/test4/test4.c +++ b/src/pal/tests/palsuite/c_runtime/_putenv/test4/test4.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_putw/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_putw/test1/CMakeLists.txt index c3018ad322..78833d4e13 100644 --- a/src/pal/tests/palsuite/c_runtime/_putw/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_putw/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_putw_test1 diff --git a/src/pal/tests/palsuite/c_runtime/_putw/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_putw/test1/test1.c deleted file mode 100644 index ecfc9046ac..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_putw/test1/test1.c +++ /dev/null @@ -1,112 +0,0 @@ -// 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: test1.c -** -** Purpose: Writes a series of integers to a file, test.dat, -** then verifies the results. -** -** Dependency: fopen(...) -** fclose(...) -** CloseHandle(...) -** DeleteFileA(...) -** _getw(...) -** -** -** -**==========================================================================*/ - - -#include <palsuite.h> - -const char testFileName[] = "test.dat"; - -static void Cleanup(HANDLE hFile) -{ - if (fclose(hFile)) - { - Trace("_putw: ERROR -> Unable to close file \"%s\".\n", - testFileName); - } - if (!DeleteFileA(testFileName)) - { - Trace("_putw: ERROR -> Unable to delete file \"%s\". ", - "GetLastError returned %u.\n", - testFileName, - GetLastError()); - } -} - - -int __cdecl main(int argc, char **argv) -{ - - FILE * pfTest = NULL; - int testArray[] = {0,1,-1,0x7FFFFFFF,0x80000000,0xFFFFFFFF,0xFFFFAAAA}; - int i = 0; - int retValue = 0; - - /* - * Initialize the PAL and return FAIL if this fails - */ - if (0 != (PAL_Initialize(argc, argv))) - { - return FAIL; - } - - /*write the file that we will use to test */ - pfTest = fopen(testFileName, "w"); - if (pfTest == NULL) - { - Fail ("Unable to write test file.\n"); - } - - for (i = 0; i < sizeof(testArray)/sizeof(int) ; i++) - { - _putw(testArray[i], pfTest); - - if( ferror( pfTest ) ) - { - Cleanup(pfTest); - Fail( "Error:in _putw -> error has occurred in the " - "stream while writing to the file: \"test.dat\"\n"); - } - - } - - if (fclose(pfTest) != 0) - { - Cleanup(pfTest); - Fail ("Error closing file after writing with _putw(..).\n"); - } - - /*open the new test file and compare*/ - pfTest = fopen(testFileName, "r"); - if (pfTest == NULL) - { - Fail ("Error opening \"%s\", which is odd, since I just finished " - "creating that file.\n", testFileName); - } - retValue =_getw( pfTest ); - i = 0; - while(retValue != EOF) - { - if(retValue != testArray[i]) - { - Cleanup(pfTest); - Fail ("Integers written by _putw are not in the correct format\n", - testFileName); - } - retValue = _getw( pfTest ); - i++ ; - } - - Cleanup(pfTest); - PAL_Terminate(); - return PASS; -} - - diff --git a/src/pal/tests/palsuite/c_runtime/_putw/test1/test1.cpp b/src/pal/tests/palsuite/c_runtime/_putw/test1/test1.cpp new file mode 100644 index 0000000000..02b7cc7a49 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_putw/test1/test1.cpp @@ -0,0 +1,112 @@ +// 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: test1.c +** +** Purpose: Writes a series of integers to a file, test.dat, +** then verifies the results. +** +** Dependency: fopen(...) +** fclose(...) +** CloseHandle(...) +** DeleteFileA(...) +** _getw(...) +** +** +** +**==========================================================================*/ + + +#include <palsuite.h> + +const char testFileName[] = "test.dat"; + +static void Cleanup(HANDLE hFile) +{ + if (fclose((PAL_FILE*)hFile)) + { + Trace("_putw: ERROR -> Unable to close file \"%s\".\n", + testFileName); + } + if (!DeleteFileA(testFileName)) + { + Trace("_putw: ERROR -> Unable to delete file \"%s\". ", + "GetLastError returned %u.\n", + testFileName, + GetLastError()); + } +} + + +int __cdecl main(int argc, char **argv) +{ + + FILE * pfTest = NULL; + int testArray[] = {0,1,-1,0x7FFFFFFF,0x80000000,0xFFFFFFFF,0xFFFFAAAA}; + int i = 0; + int retValue = 0; + + /* + * Initialize the PAL and return FAIL if this fails + */ + if (0 != (PAL_Initialize(argc, argv))) + { + return FAIL; + } + + /*write the file that we will use to test */ + pfTest = fopen(testFileName, "w"); + if (pfTest == NULL) + { + Fail ("Unable to write test file.\n"); + } + + for (i = 0; i < sizeof(testArray)/sizeof(int) ; i++) + { + _putw(testArray[i], pfTest); + + if( ferror( pfTest ) ) + { + Cleanup(pfTest); + Fail( "Error:in _putw -> error has occurred in the " + "stream while writing to the file: \"test.dat\"\n"); + } + + } + + if (fclose(pfTest) != 0) + { + Cleanup(pfTest); + Fail ("Error closing file after writing with _putw(..).\n"); + } + + /*open the new test file and compare*/ + pfTest = fopen(testFileName, "r"); + if (pfTest == NULL) + { + Fail ("Error opening \"%s\", which is odd, since I just finished " + "creating that file.\n", testFileName); + } + retValue =_getw( pfTest ); + i = 0; + while(retValue != EOF) + { + if(retValue != testArray[i]) + { + Cleanup(pfTest); + Fail ("Integers written by _putw are not in the correct format\n", + testFileName); + } + retValue = _getw( pfTest ); + i++ ; + } + + Cleanup(pfTest); + PAL_Terminate(); + return PASS; +} + + diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf/CMakeLists.txt deleted file mode 100644 index cafb9536b0..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -add_subdirectory(test1) -add_subdirectory(test10) -add_subdirectory(test11) -add_subdirectory(test12) -add_subdirectory(test13) -add_subdirectory(test14) -add_subdirectory(test15) -add_subdirectory(test16) -add_subdirectory(test17) -add_subdirectory(test18) -add_subdirectory(test19) -add_subdirectory(test2) -add_subdirectory(test3) -add_subdirectory(test4) -add_subdirectory(test5) -add_subdirectory(test6) -add_subdirectory(test7) -add_subdirectory(test8) -add_subdirectory(test9) - diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/_snprintf.h b/src/pal/tests/palsuite/c_runtime/_snprintf/_snprintf.h deleted file mode 100644 index 84abf62f0b..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/_snprintf.h +++ /dev/null @@ -1,194 +0,0 @@ -// 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: _snprintf.h -** -** Purpose: Containts common testing functions for _snprintf -** -** -**==========================================================================*/ - -#ifndef __STRINGTEST_H__ -#define __STRINGTEST_H__ - -void DoStrTest(char *formatstr, char* param, char *checkstr) -{ - char buf[256] = { 0 }; - - _snprintf(buf, 256, formatstr, param); - if (memcmp(buf, checkstr, strlen(checkstr) + 1) != 0) - { - Fail("ERROR: failed to insert string \"%s\" into \"%s\"\n" - "Expected \"%s\" got \"%s\".\n", - param, formatstr, checkstr, buf); - } -} - -void DoWStrTest(char *formatstr, WCHAR* param, char *checkstr) -{ - char buf[256] = { 0 }; - - _snprintf(buf, 256, formatstr, param); - if (memcmp(buf, checkstr, strlen(checkstr) + 1) != 0) - { - Fail("ERROR: failed to insert wide string \"%s\" into \"%s\"\n" - "Expected \"%s\" got \"%s\".\n", - convertC(param), formatstr, checkstr, buf); - } -} - - -void DoPointerTest(char *formatstr, void* param, char* paramstr, char - *checkstr1) -{ - char buf[256] = { 0 }; - - _snprintf(buf, 256, formatstr, param); - if (memcmp(buf, checkstr1, strlen(checkstr1) + 1) != 0) - { - Fail("ERROR: failed to insert %s into \"%s\"\n" - "Expected \"%s\", got \"%s\".\n", - paramstr, formatstr, checkstr1, buf); - } -} - -void DoCountTest(char *formatstr, int param, char *checkstr) -{ - char buf[512] = { 0 }; - int n = -1; - - _snprintf(buf, 512, formatstr, &n); - - if (n != param) - { - Fail("ERROR: Expected count parameter to resolve to %d, got %X\n", - param, n); - } - if (memcmp(buf, checkstr, strlen(checkstr) + 1) != 0) - { - Fail("ERROR: Expected \"%s\" got \"%s\".\n", checkstr, buf); - } -} - -void DoShortCountTest(char *formatstr, int param, char *checkstr) -{ - char buf[256] = { 0 }; - short int n = -1; - - _snprintf(buf, 256, formatstr, &n); - - if (n != param) - { - Fail("ERROR: Expected count parameter to resolve to %d, got %X\n", - param, n); - } - if (memcmp(buf, checkstr, strlen(checkstr) + 1) != 0) - { - Fail("ERROR: Expected \"%s\" got \"%s\".\n", checkstr, buf); - } -} - -void DoCharTest(char *formatstr, char param, char *checkstr) -{ - char buf[256] = { 0 }; - - _snprintf(buf, 256, formatstr, param); - if (memcmp(buf, checkstr, strlen(checkstr) + 1) != 0) - { - Fail("ERROR: failed to insert char \'%c\' (%d) into \"%s\"\n" - "Expected \"%s\" got \"%s\".\n", - param, param, formatstr, checkstr, buf); - } -} - -void DoWCharTest(char *formatstr, WCHAR param, char *checkstr) -{ - char buf[256] = { 0 }; - - _snprintf(buf, 256, formatstr, param); - if (memcmp(buf, checkstr, strlen(checkstr) + 1) != 0) - { - Fail("ERROR: failed to insert wide char \'%c\' (%d) into \"%s\"\n" - "Expected \"%s\" got \"%s\".\n", - (char)param, param, formatstr, checkstr, buf); - } -} - -void DoNumTest(char *formatstr, int value, char *checkstr) -{ - char buf[256] = { 0 }; - - _snprintf(buf, 256, formatstr, value); - if (memcmp(buf, checkstr, strlen(checkstr) + 1) != 0) - { - Fail("ERROR: failed to insert %#x into \"%s\"\n" - "Expected \"%s\" got \"%s\".\n", - value, formatstr, checkstr, buf); - } -} - -void DoI64Test(char *formatstr, INT64 value, char *valuestr, char *checkstr1) -{ - char buf[256] = { 0 }; - - _snprintf(buf, 256, formatstr, value); - if (memcmp(buf, checkstr1, strlen(checkstr1) + 1) != 0) - { - Fail("ERROR: failed to insert %s into \"%s\"\n" - "Expected \"%s\", got \"%s\".\n", - valuestr, formatstr, checkstr1, buf); - } -} - -void DoDoubleTest(char *formatstr, double value, char *checkstr1, char -*checkstr2) -{ - char buf[256] = { 0 }; - - _snprintf(buf, 256, formatstr, value); - if (memcmp(buf, checkstr1, strlen(checkstr1) + 1) != 0 - && memcmp(buf, checkstr2, strlen(checkstr2) + 1) != 0) - { - Fail("ERROR: failed to insert %f into \"%s\"\n" - "Expected \"%s\" or \"%s\", got \"%s\".\n", - value, formatstr, checkstr1, checkstr2, buf); - } -} - -void DoArgumentPrecTest(char *formatstr, int precision, void *param, char -*paramstr, char *checkstr1, char*checkstr2) -{ - char buf[256]; - - _snprintf(buf, 256, formatstr, precision, param); - if (memcmp(buf, checkstr1, strlen(checkstr1) + 1) != 0 && - memcmp(buf, checkstr2, strlen(checkstr2) + 1) != 0) - { - Fail("ERROR: failed to insert %s into \"%s\" with precision %d\n" - "Expected \"%s\" or \"%s\", got \"%s\".\n", - paramstr, formatstr, precision, checkstr1, checkstr2, buf); - } - -} - -void DoArgumentPrecDoubleTest(char *formatstr, int precision, double param, -char *checkstr1, char *checkstr2) -{ - char buf[256]; - - _snprintf(buf, 256, formatstr, precision, param); - if (memcmp(buf, checkstr1, strlen(checkstr1) + 1) != 0 && - memcmp(buf, checkstr2, strlen(checkstr2) + 1) != 0) - { - Fail("ERROR: failed to insert %f into \"%s\" with precision %d\n" - "Expected \"%s\" or \"%s\", got \"%s\".\n", - param, formatstr, precision, checkstr1, checkstr2, buf); - } - -} - -#endif - diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf/test1/CMakeLists.txt deleted file mode 100644 index ab126fc59d..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test1/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test1.c -) - -add_executable(paltest_snprintf_test1 - ${SOURCES} -) - -add_dependencies(paltest_snprintf_test1 coreclrpal) - -target_link_libraries(paltest_snprintf_test1 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_snprintf/test1/test1.c deleted file mode 100644 index eef7406baa..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test1/test1.c +++ /dev/null @@ -1,58 +0,0 @@ -// 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: test1.c -** -** Purpose: General test to see if _snprintf works correctly -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../_snprintf.h" - -/* - * Notes: memcmp is used, as is strlen. - */ - -int __cdecl main(int argc, char *argv[]) -{ - char checkstr[] = "hello world"; - char buf[256] = { 0 }; - int ret; - - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - - _snprintf(buf, 256, "hello world"); - if (memcmp(checkstr, buf, strlen(checkstr)+1) != 0) - { - Fail("ERROR: expected \"%s\" (up to %d chars), got \"%s\"\n", - checkstr, 256, buf); - } - - _snprintf(buf, 256, "xxxxxxxxxxxxxxxxx"); - ret = _snprintf(buf, 8, "hello world"); - - if (ret >= 0) - { - Fail("ERROR: expected negative return value, got %d", ret); - } - if (memcmp(checkstr, buf, 8) != 0 || buf[8] != 'x') - { - Fail("ERROR: expected %s (up to %d chars), got %s\n", - checkstr, 8, buf); - } - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf/test1/testinfo.dat deleted file mode 100644 index c15ce1dcba..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test1/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = _snprintf -Name = Positive Test for _snprintf -TYPE = DEFAULT -EXE1 = test1 -Description -= General test to see if _snprintf works correctly diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test10/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf/test10/CMakeLists.txt deleted file mode 100644 index e8e9308849..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test10/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test10.c -) - -add_executable(paltest_snprintf_test10 - ${SOURCES} -) - -add_dependencies(paltest_snprintf_test10 coreclrpal) - -target_link_libraries(paltest_snprintf_test10 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test10/test10.c b/src/pal/tests/palsuite/c_runtime/_snprintf/test10/test10.c deleted file mode 100644 index 9191ccef27..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test10/test10.c +++ /dev/null @@ -1,55 +0,0 @@ -// 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: test10.c -** -** Purpose: Tests _snprintf with octal numbers -** -** -**==========================================================================*/ - - - - -#include <palsuite.h> -#include "../_snprintf.h" - -/* - * Notes: memcmp is used, as is strlen. - */ - -int __cdecl main(int argc, char *argv[]) -{ - int neg = -42; - int pos = 42; - INT64 l = 42; - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - - DoNumTest("foo %o", pos, "foo 52"); - DoNumTest("foo %lo", 0xFFFF, "foo 177777"); - DoNumTest("foo %ho", 0xFFFF, "foo 177777"); - DoNumTest("foo %Lo", pos, "foo 52"); - DoI64Test("foo %I64o", l, "42", "foo 52"); - DoNumTest("foo %3o", pos, "foo 52"); - DoNumTest("foo %-3o", pos, "foo 52 "); - DoNumTest("foo %.1o", pos, "foo 52"); - DoNumTest("foo %.3o", pos, "foo 052"); - DoNumTest("foo %03o", pos, "foo 052"); - DoNumTest("foo %#o", pos, "foo 052"); - DoNumTest("foo %+o", pos, "foo 52"); - DoNumTest("foo % o", pos, "foo 52"); - DoNumTest("foo %+o", neg, "foo 37777777726"); - DoNumTest("foo % o", neg, "foo 37777777726"); - - PAL_Terminate(); - return PASS; -} - diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test10/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf/test10/testinfo.dat deleted file mode 100644 index 44ff48e030..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test10/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = _snprintf -Name = Positive Test for _snprintf -TYPE = DEFAULT -EXE1 = test10 -Description -= Tests _snprintf with octal numbers diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test11/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf/test11/CMakeLists.txt deleted file mode 100644 index ccf3dc2572..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test11/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test11.c -) - -add_executable(paltest_snprintf_test11 - ${SOURCES} -) - -add_dependencies(paltest_snprintf_test11 coreclrpal) - -target_link_libraries(paltest_snprintf_test11 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test11/test11.c b/src/pal/tests/palsuite/c_runtime/_snprintf/test11/test11.c deleted file mode 100644 index 9d9302dee0..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test11/test11.c +++ /dev/null @@ -1,54 +0,0 @@ -// 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: test11.c -** -** Purpose: Tests _snprintf with unsigned numbers -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../_snprintf.h" - -/* - * Notes: memcmp is used, as is strlen. - */ - -int __cdecl main(int argc, char *argv[]) -{ - int neg = -42; - int pos = 42; - INT64 l = 42; - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - - DoNumTest("foo %u", pos, "foo 42"); - DoNumTest("foo %lu", 0xFFFF, "foo 65535"); - DoNumTest("foo %hu", 0xFFFF, "foo 65535"); - DoNumTest("foo %Lu", pos, "foo 42"); - DoI64Test("foo %I64u", l, "42", "foo 42"); - DoNumTest("foo %3u", pos, "foo 42"); - DoNumTest("foo %-3u", pos, "foo 42 "); - DoNumTest("foo %.1u", pos, "foo 42"); - DoNumTest("foo %.3u", pos, "foo 042"); - DoNumTest("foo %03u", pos, "foo 042"); - DoNumTest("foo %#u", pos, "foo 42"); - DoNumTest("foo %+u", pos, "foo 42"); - DoNumTest("foo % u", pos, "foo 42"); - DoNumTest("foo %+u", neg, "foo 4294967254"); - DoNumTest("foo % u", neg, "foo 4294967254"); - - PAL_Terminate(); - return PASS; -} - diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test11/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf/test11/testinfo.dat deleted file mode 100644 index 1a77077950..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test11/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = _snprintf -Name = Positive Test for _snprintf -TYPE = DEFAULT -EXE1 = test11 -Description -= Tests _snprintf with unsigned numbers diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test12/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf/test12/CMakeLists.txt deleted file mode 100644 index 68b442f1d9..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test12/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test12.c -) - -add_executable(paltest_snprintf_test12 - ${SOURCES} -) - -add_dependencies(paltest_snprintf_test12 coreclrpal) - -target_link_libraries(paltest_snprintf_test12 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test12/test12.c b/src/pal/tests/palsuite/c_runtime/_snprintf/test12/test12.c deleted file mode 100644 index d782fce788..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test12/test12.c +++ /dev/null @@ -1,55 +0,0 @@ -// 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: test12.c -** -** Purpose: Tests _snprintf with hex numbers (lowercase) -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../_snprintf.h" - -/* - * Notes: memcmp is used, as is strlen. - */ - - -int __cdecl main(int argc, char *argv[]) -{ - int neg = -42; - int pos = 0x1234ab; - INT64 l = I64(0x1234567887654321); - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - - DoNumTest("foo %x", pos, "foo 1234ab"); - DoNumTest("foo %lx", pos, "foo 1234ab"); - DoNumTest("foo %hx", pos, "foo 34ab"); - DoNumTest("foo %Lx", pos, "foo 1234ab"); - DoI64Test("foo %I64x", l, "0x1234567887654321", "foo 1234567887654321"); - DoNumTest("foo %7x", pos, "foo 1234ab"); - DoNumTest("foo %-7x", pos, "foo 1234ab "); - DoNumTest("foo %.1x", pos, "foo 1234ab"); - DoNumTest("foo %.7x", pos, "foo 01234ab"); - DoNumTest("foo %07x", pos, "foo 01234ab"); - DoNumTest("foo %#x", pos, "foo 0x1234ab"); - DoNumTest("foo %+x", pos, "foo 1234ab"); - DoNumTest("foo % x", pos, "foo 1234ab"); - DoNumTest("foo %+x", neg, "foo ffffffd6"); - DoNumTest("foo % x", neg, "foo ffffffd6"); - - PAL_Terminate(); - return PASS; -} - diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test12/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf/test12/testinfo.dat deleted file mode 100644 index 6801c7417e..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test12/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = _snprintf -Name = Positive Test for _snprintf -TYPE = DEFAULT -EXE1 = test12 -Description -= Tests _snprintf with hex numbers (lowercase) diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test13/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf/test13/CMakeLists.txt deleted file mode 100644 index 832b3fefbf..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test13/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test13.c -) - -add_executable(paltest_snprintf_test13 - ${SOURCES} -) - -add_dependencies(paltest_snprintf_test13 coreclrpal) - -target_link_libraries(paltest_snprintf_test13 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test13/test13.c b/src/pal/tests/palsuite/c_runtime/_snprintf/test13/test13.c deleted file mode 100644 index 68ba554d93..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test13/test13.c +++ /dev/null @@ -1,55 +0,0 @@ -// 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: test13.c -** -** Purpose: Tests _snprintf with hex numbers (uppercase) -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../_snprintf.h" - -/* - * Notes: memcmp is used, as is strlen. - */ - - -int __cdecl main(int argc, char *argv[]) -{ - int neg = -42; - int pos = 0x1234AB; - INT64 l = I64(0x1234567887654321); - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - - DoNumTest("foo %X", pos, "foo 1234AB"); - DoNumTest("foo %lX", pos, "foo 1234AB"); - DoNumTest("foo %hX", pos, "foo 34AB"); - DoNumTest("foo %LX", pos, "foo 1234AB"); - DoI64Test("foo %I64X", l, "0x1234567887654321", "foo 1234567887654321"); - DoNumTest("foo %7X", pos, "foo 1234AB"); - DoNumTest("foo %-7X", pos, "foo 1234AB "); - DoNumTest("foo %.1X", pos, "foo 1234AB"); - DoNumTest("foo %.7X", pos, "foo 01234AB"); - DoNumTest("foo %07X", pos, "foo 01234AB"); - DoNumTest("foo %#X", pos, "foo 0X1234AB"); - DoNumTest("foo %+X", pos, "foo 1234AB"); - DoNumTest("foo % X", pos, "foo 1234AB"); - DoNumTest("foo %+X", neg, "foo FFFFFFD6"); - DoNumTest("foo % X", neg, "foo FFFFFFD6"); - - PAL_Terminate(); - return PASS; -} - diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test13/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf/test13/testinfo.dat deleted file mode 100644 index 6901589a1b..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test13/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = _snprintf -Name = Positive Test for _snprintf -TYPE = DEFAULT -EXE1 = test13 -Description -= Tests _snprintf with hex numbers (uppercase) diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test14/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf/test14/CMakeLists.txt deleted file mode 100644 index c2e3be148d..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test14/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test14.c -) - -add_executable(paltest_snprintf_test14 - ${SOURCES} -) - -add_dependencies(paltest_snprintf_test14 coreclrpal) - -target_link_libraries(paltest_snprintf_test14 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test14/test14.c b/src/pal/tests/palsuite/c_runtime/_snprintf/test14/test14.c deleted file mode 100644 index d874690ba4..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test14/test14.c +++ /dev/null @@ -1,57 +0,0 @@ -// 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: Tests _snprintf with exponential format doubles (lowercase) -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../_snprintf.h" - -/* - * Notes: memcmp is used, as is strlen. - */ - - -int __cdecl main(int argc, char *argv[]) -{ - double val = 256.0; - double neg = -256.0; - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - - DoDoubleTest("foo %e", val, "foo 2.560000e+002", "foo 2.560000e+02"); - DoDoubleTest("foo %le", val, "foo 2.560000e+002", "foo 2.560000e+02"); - DoDoubleTest("foo %he", val, "foo 2.560000e+002", "foo 2.560000e+02"); - DoDoubleTest("foo %Le", val, "foo 2.560000e+002", "foo 2.560000e+02"); - DoDoubleTest("foo %I64e", val, "foo 2.560000e+002", "foo 2.560000e+02"); - DoDoubleTest("foo %14e", val, "foo 2.560000e+002", - "foo 2.560000e+02"); - DoDoubleTest("foo %-14e", val, "foo 2.560000e+002 ", - "foo 2.560000e+02 "); - DoDoubleTest("foo %.1e", val, "foo 2.6e+002", "foo 2.6e+02"); - DoDoubleTest("foo %.8e", val, "foo 2.56000000e+002", - "foo 2.56000000e+02"); - DoDoubleTest("foo %014e", val, "foo 02.560000e+002", - "foo 002.560000e+02"); - DoDoubleTest("foo %#e", val, "foo 2.560000e+002", "foo 2.560000e+02"); - DoDoubleTest("foo %+e", val, "foo +2.560000e+002", "foo +2.560000e+02"); - DoDoubleTest("foo % e", val, "foo 2.560000e+002", "foo 2.560000e+02"); - DoDoubleTest("foo %+e", neg, "foo -2.560000e+002", "foo -2.560000e+02"); - DoDoubleTest("foo % e", neg, "foo -2.560000e+002", "foo -2.560000e+02"); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test14/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf/test14/testinfo.dat deleted file mode 100644 index 0f32b9b59a..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test14/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = _snprintf -Name = Positive Test for _snprintf -TYPE = DEFAULT -EXE1 = test14 -Description -= Tests _snprintf with exponential format doubles (lowercase) diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test15/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf/test15/CMakeLists.txt deleted file mode 100644 index 1bd24d5ccd..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test15/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test15.c -) - -add_executable(paltest_snprintf_test15 - ${SOURCES} -) - -add_dependencies(paltest_snprintf_test15 coreclrpal) - -target_link_libraries(paltest_snprintf_test15 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test15/test15.c b/src/pal/tests/palsuite/c_runtime/_snprintf/test15/test15.c deleted file mode 100644 index a637a706f5..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test15/test15.c +++ /dev/null @@ -1,56 +0,0 @@ -// 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: test15.c -** -** Purpose: Tests _snprintf with exponential format doubles (uppercase) -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../_snprintf.h" - -/* - * Notes: memcmp is used, as is strlen. - */ - -int __cdecl main(int argc, char *argv[]) -{ - double val = 256.0; - double neg = -256.0; - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - - DoDoubleTest("foo %E", val, "foo 2.560000E+002", "foo 2.560000E+02"); - DoDoubleTest("foo %lE", val, "foo 2.560000E+002", "foo 2.560000E+02"); - DoDoubleTest("foo %hE", val, "foo 2.560000E+002", "foo 2.560000E+02"); - DoDoubleTest("foo %LE", val, "foo 2.560000E+002", "foo 2.560000E+02"); - DoDoubleTest("foo %I64E", val, "foo 2.560000E+002", "foo 2.560000E+02"); - DoDoubleTest("foo %14E", val, "foo 2.560000E+002", - "foo 2.560000E+02"); - DoDoubleTest("foo %-14E", val, "foo 2.560000E+002 ", - "foo 2.560000E+02 "); - DoDoubleTest("foo %.1E", val, "foo 2.6E+002", "foo 2.6E+02"); - DoDoubleTest("foo %.8E", val, "foo 2.56000000E+002", - "foo 2.56000000E+02"); - DoDoubleTest("foo %014E", val, "foo 02.560000E+002", - "foo 002.560000E+02"); - DoDoubleTest("foo %#E", val, "foo 2.560000E+002", "foo 2.560000E+02"); - DoDoubleTest("foo %+E", val, "foo +2.560000E+002", "foo +2.560000E+02"); - DoDoubleTest("foo % E", val, "foo 2.560000E+002", "foo 2.560000E+02"); - DoDoubleTest("foo %+E", neg, "foo -2.560000E+002", "foo -2.560000E+02"); - DoDoubleTest("foo % E", neg, "foo -2.560000E+002", "foo -2.560000E+02"); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test15/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf/test15/testinfo.dat deleted file mode 100644 index 8008cff0b5..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test15/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = _snprintf -Name = Positive Test for _snprintf -TYPE = DEFAULT -EXE1 = test15 -Description -= Tests _snprintf with exponential format doubles (uppercase) diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test16/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf/test16/CMakeLists.txt deleted file mode 100644 index 952192e560..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test16/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test16.c -) - -add_executable(paltest_snprintf_test16 - ${SOURCES} -) - -add_dependencies(paltest_snprintf_test16 coreclrpal) - -target_link_libraries(paltest_snprintf_test16 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test16/test16.c b/src/pal/tests/palsuite/c_runtime/_snprintf/test16/test16.c deleted file mode 100644 index 6793019383..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test16/test16.c +++ /dev/null @@ -1,52 +0,0 @@ -// 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: test16.c -** -** Purpose: Test #15 for the _snprintf function -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../_snprintf.h" - -/* - * Notes: memcmp is used, as is strlen. - */ - -int __cdecl main(int argc, char *argv[]) -{ - double val = 2560.001; - double neg = -2560.001; - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - - DoDoubleTest("foo %f", val, "foo 2560.001000", "foo 2560.001000"); - DoDoubleTest("foo %lf", val, "foo 2560.001000", "foo 2560.001000"); - DoDoubleTest("foo %hf", val, "foo 2560.001000", "foo 2560.001000"); - DoDoubleTest("foo %Lf", val, "foo 2560.001000", "foo 2560.001000"); - DoDoubleTest("foo %I64f", val, "foo 2560.001000", "foo 2560.001000"); - DoDoubleTest("foo %12f", val, "foo 2560.001000", "foo 2560.001000"); - DoDoubleTest("foo %-12f", val, "foo 2560.001000 ", "foo 2560.001000 "); - DoDoubleTest("foo %.1f", val, "foo 2560.0", "foo 2560.0"); - DoDoubleTest("foo %.8f", val, "foo 2560.00100000", "foo 2560.00100000"); - DoDoubleTest("foo %012f", val, "foo 02560.001000", "foo 02560.001000"); - DoDoubleTest("foo %#f", val, "foo 2560.001000", "foo 2560.001000"); - DoDoubleTest("foo %+f", val, "foo +2560.001000", "foo +2560.001000"); - DoDoubleTest("foo % f", val, "foo 2560.001000", "foo 2560.001000"); - DoDoubleTest("foo %+f", neg, "foo -2560.001000", "foo -2560.001000"); - DoDoubleTest("foo % f", neg, "foo -2560.001000", "foo -2560.001000"); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test16/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf/test16/testinfo.dat deleted file mode 100644 index e7a7df8f53..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test16/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = _snprintf -Name = Positive Test for _snprintf -TYPE = DEFAULT -EXE1 = test16 -Description -= Tests _snprintf with decimal point format doubles diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test17/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf/test17/CMakeLists.txt deleted file mode 100644 index ce5cc1623e..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test17/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test17.c -) - -add_executable(paltest_snprintf_test17 - ${SOURCES} -) - -add_dependencies(paltest_snprintf_test17 coreclrpal) - -target_link_libraries(paltest_snprintf_test17 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test17/test17.c b/src/pal/tests/palsuite/c_runtime/_snprintf/test17/test17.c deleted file mode 100644 index 9981b44619..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test17/test17.c +++ /dev/null @@ -1,53 +0,0 @@ -// 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: test17.c -** -** Purpose: Tests _snprintf with compact format doubles (lowercase) -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../_snprintf.h" - -/* - * Notes: memcmp is used, as is strlen. - */ - -int __cdecl main(int argc, char *argv[]) -{ - double val = 2560.001; - double neg = -2560.001; - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - - DoDoubleTest("foo %g", val, "foo 2560", "foo 2560"); - DoDoubleTest("foo %lg", val, "foo 2560", "foo 2560"); - DoDoubleTest("foo %hg", val, "foo 2560", "foo 2560"); - DoDoubleTest("foo %Lg", val, "foo 2560", "foo 2560"); - DoDoubleTest("foo %I64g", val, "foo 2560", "foo 2560"); - DoDoubleTest("foo %5g", val, "foo 2560", "foo 2560"); - DoDoubleTest("foo %-5g", val, "foo 2560 ", "foo 2560 "); - DoDoubleTest("foo %.1g", val, "foo 3e+003", "foo 3e+03"); - DoDoubleTest("foo %.2g", val, "foo 2.6e+003", "foo 2.6e+03"); - DoDoubleTest("foo %.12g", val, "foo 2560.001", "foo 2560.001"); - DoDoubleTest("foo %06g", val, "foo 002560", "foo 002560"); - DoDoubleTest("foo %#g", val, "foo 2560.00", "foo 2560.00"); - DoDoubleTest("foo %+g", val, "foo +2560", "foo +2560"); - DoDoubleTest("foo % g", val, "foo 2560", "foo 2560"); - DoDoubleTest("foo %+g", neg, "foo -2560", "foo -2560"); - DoDoubleTest("foo % g", neg, "foo -2560", "foo -2560"); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test17/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf/test17/testinfo.dat deleted file mode 100644 index 4756bd0d78..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test17/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = _snprintf -Name = Positive Test for _snprintf -TYPE = DEFAULT -EXE1 = test17 -Description -= Tests _snprintf with compact format doubles (lowercase) diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test18/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf/test18/CMakeLists.txt deleted file mode 100644 index bb9c9c37cc..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test18/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test18.c -) - -add_executable(paltest_snprintf_test18 - ${SOURCES} -) - -add_dependencies(paltest_snprintf_test18 coreclrpal) - -target_link_libraries(paltest_snprintf_test18 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test18/test18.c b/src/pal/tests/palsuite/c_runtime/_snprintf/test18/test18.c deleted file mode 100644 index d28aec57d0..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test18/test18.c +++ /dev/null @@ -1,53 +0,0 @@ -// 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: test18.c -** -** Purpose: Tests _snprintf with compact format doubles (uppercase) -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../_snprintf.h" - -/* - * Notes: memcmp is used, as is strlen. - */ - -int __cdecl main(int argc, char *argv[]) -{ - double val = 2560.001; - double neg = -2560.001; - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - - DoDoubleTest("foo %G", val, "foo 2560", "foo 2560"); - DoDoubleTest("foo %lG", val, "foo 2560", "foo 2560"); - DoDoubleTest("foo %hG", val, "foo 2560", "foo 2560"); - DoDoubleTest("foo %LG", val, "foo 2560", "foo 2560"); - DoDoubleTest("foo %I64G", val, "foo 2560", "foo 2560"); - DoDoubleTest("foo %5G", val, "foo 2560", "foo 2560"); - DoDoubleTest("foo %-5G", val, "foo 2560 ", "foo 2560 "); - DoDoubleTest("foo %.1G", val, "foo 3E+003", "foo 3E+03"); - DoDoubleTest("foo %.2G", val, "foo 2.6E+003", "foo 2.6E+03"); - DoDoubleTest("foo %.12G", val, "foo 2560.001", "foo 2560.001"); - DoDoubleTest("foo %06G", val, "foo 002560", "foo 002560"); - DoDoubleTest("foo %#G", val, "foo 2560.00", "foo 2560.00"); - DoDoubleTest("foo %+G", val, "foo +2560", "foo +2560"); - DoDoubleTest("foo % G", val, "foo 2560", "foo 2560"); - DoDoubleTest("foo %+G", neg, "foo -2560", "foo -2560"); - DoDoubleTest("foo % G", neg, "foo -2560", "foo -2560"); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test18/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf/test18/testinfo.dat deleted file mode 100644 index 819d28cec9..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test18/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = _snprintf -Name = Positive Test for _snprintf -TYPE = DEFAULT -EXE1 = test18 -Description -= Tests _snprintf with compact format doubles (uppercase) diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test19/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf/test19/CMakeLists.txt deleted file mode 100644 index f3fbb95013..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test19/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test19.c -) - -add_executable(paltest_snprintf_test19 - ${SOURCES} -) - -add_dependencies(paltest_snprintf_test19 coreclrpal) - -target_link_libraries(paltest_snprintf_test19 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test19/test19.c b/src/pal/tests/palsuite/c_runtime/_snprintf/test19/test19.c deleted file mode 100644 index 26dffd9214..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test19/test19.c +++ /dev/null @@ -1,76 +0,0 @@ -// 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: test19.c -** -** Purpose:Tests _snprintf with argument specified precision -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../_snprintf.h" - -/* - * Notes: memcmp is used, as is strlen. - */ - - -int __cdecl main(int argc, char *argv[]) -{ - int n = -1; - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - DoArgumentPrecTest("%.*s", 2, "bar", "bar", "ba", "ba"); - DoArgumentPrecTest("%.*S", 2, convert("bar"), "bar", "ba", "ba"); - DoArgumentPrecTest("%.*n", 3, &n, "pointer to int", "", ""); - if (n != 0) - { - Fail("ERROR: Expected count parameter to resolve to %d, got %X\n", - 0, n); - } - - DoArgumentPrecTest("%.*c", 0, (void*)'a', "a", "a", "a"); - DoArgumentPrecTest("%.*c", 4, (void*)'a', "a", "a", "a"); - DoArgumentPrecTest("%.*C", 0, (void*)'a', "a", "a", "a"); - DoArgumentPrecTest("%.*C", 4, (void*)'a', "a", "a", "a"); - DoArgumentPrecTest("%.*d", 1, (void*)42, "42", "42", "42"); - DoArgumentPrecTest("%.*d", 3, (void*)42, "42", "042", "042"); - DoArgumentPrecTest("%.*i", 1, (void*)42, "42", "42", "42"); - DoArgumentPrecTest("%.*i", 3, (void*)42, "42", "042", "042"); - DoArgumentPrecTest("%.*o", 1, (void*)42, "42", "52", "52"); - DoArgumentPrecTest("%.*o", 3, (void*)42, "42", "052", "052"); - DoArgumentPrecTest("%.*u", 1, (void*)42, "42", "42", "42"); - DoArgumentPrecTest("%.*u", 3, (void*)42, "42", "042", "042"); - DoArgumentPrecTest("%.*x", 1, (void*)0x42, "0x42", "42", "42"); - DoArgumentPrecTest("%.*x", 3, (void*)0x42, "0x42", "042", "042"); - DoArgumentPrecTest("%.*X", 1, (void*)0x42, "0x42", "42", "42") ; - DoArgumentPrecTest("%.*X", 3, (void*)0x42, "0x42", "042", "042"); - - - DoArgumentPrecDoubleTest("%.*e", 1, 2.01, "2.0e+000", "2.0e+00"); - DoArgumentPrecDoubleTest("%.*e", 3, 2.01, "2.010e+000", "2.010e+00"); - DoArgumentPrecDoubleTest("%.*E", 1, 2.01, "2.0E+000", "2.0E+00"); - DoArgumentPrecDoubleTest("%.*E", 3, 2.01, "2.010E+000", "2.010E+00"); - DoArgumentPrecDoubleTest("%.*f", 1, 2.01, "2.0", "2.0"); - DoArgumentPrecDoubleTest("%.*f", 3, 2.01, "2.010", "2.010"); - DoArgumentPrecDoubleTest("%.*g", 1, 256.01, "3e+002", "3e+02"); - DoArgumentPrecDoubleTest("%.*g", 3, 256.01, "256", "256"); - DoArgumentPrecDoubleTest("%.*g", 4, 256.01, "256", "256"); - DoArgumentPrecDoubleTest("%.*g", 6, 256.01, "256.01", "256.01"); - DoArgumentPrecDoubleTest("%.*G", 1, 256.01, "3E+002", "3E+02"); - DoArgumentPrecDoubleTest("%.*G", 3, 256.01, "256", "256"); - DoArgumentPrecDoubleTest("%.*G", 4, 256.01, "256", "256"); - DoArgumentPrecDoubleTest("%.*G", 6, 256.01, "256.01", "256.01"); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test19/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf/test19/testinfo.dat deleted file mode 100644 index 875abf7071..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test19/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = _snprintf -Name = Positive Test for _snprintf -TYPE = DEFAULT -EXE1 = test19 -Description -= Tests _snprintf with argument specified precision diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf/test2/CMakeLists.txt deleted file mode 100644 index 8c617df108..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test2/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test2.c -) - -add_executable(paltest_snprintf_test2 - ${SOURCES} -) - -add_dependencies(paltest_snprintf_test2 coreclrpal) - -target_link_libraries(paltest_snprintf_test2 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test2/test2.c b/src/pal/tests/palsuite/c_runtime/_snprintf/test2/test2.c deleted file mode 100644 index 3ccb66c23e..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test2/test2.c +++ /dev/null @@ -1,44 +0,0 @@ -// 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: test2.c -** -** Purpose:Tests _snprintf with strings -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../_snprintf.h" -/* - * Notes: memcmp is used, as is strlen. - */ - -int __cdecl main(int argc, char *argv[]) -{ - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - DoStrTest("foo %s", "bar", "foo bar"); - DoStrTest("foo %hs", "bar", "foo bar"); - DoWStrTest("foo %ls", convert("bar"), "foo bar"); - DoWStrTest("foo %ws", convert("bar"), "foo bar"); - DoStrTest("foo %Ls", "bar", "foo bar"); - DoStrTest("foo %I64s", "bar", "foo bar"); - DoStrTest("foo %5s", "bar", "foo bar"); - DoStrTest("foo %.2s", "bar", "foo ba"); - DoStrTest("foo %5.2s", "bar", "foo ba"); - DoStrTest("foo %-5s", "bar", "foo bar "); - DoStrTest("foo %05s", "bar", "foo 00bar"); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf/test2/testinfo.dat deleted file mode 100644 index 40a1ede3d5..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test2/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = _snprintf -Name = Positive Test for _snprintf -TYPE = DEFAULT -EXE1 = test2 -Description -= Tests _snprintf with strings diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf/test3/CMakeLists.txt deleted file mode 100644 index 13330464a7..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test3/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test3.c -) - -add_executable(paltest_snprintf_test3 - ${SOURCES} -) - -add_dependencies(paltest_snprintf_test3 coreclrpal) - -target_link_libraries(paltest_snprintf_test3 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test3/test3.c b/src/pal/tests/palsuite/c_runtime/_snprintf/test3/test3.c deleted file mode 100644 index 496159c51e..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test3/test3.c +++ /dev/null @@ -1,45 +0,0 @@ -// 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: test3.c -** -** Purpose: Tests _snprintf with wide strings -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../_snprintf.h" - -/* - * Notes: memcmp is used, as is strlen. - */ - -int __cdecl main(int argc, char *argv[]) -{ - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - DoWStrTest("foo %S", convert("bar"), "foo bar"); - DoStrTest("foo %hS", "bar", "foo bar"); - DoWStrTest("foo %lS", convert("bar"), "foo bar"); - DoWStrTest("foo %wS", convert("bar"), "foo bar"); - DoWStrTest("foo %LS", convert("bar"), "foo bar"); - DoWStrTest("foo %I64S", convert("bar"), "foo bar"); - DoWStrTest("foo %5S", convert("bar"), "foo bar"); - DoWStrTest("foo %.2S", convert("bar"), "foo ba"); - DoWStrTest("foo %5.2S", convert("bar"), "foo ba"); - DoWStrTest("foo %-5S", convert("bar"), "foo bar "); - DoWStrTest("foo %05S", convert("bar"), "foo 00bar"); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test3/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf/test3/testinfo.dat deleted file mode 100644 index fa53224510..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test3/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = _snprintf -Name = Positive Test for _snprintf -TYPE = DEFAULT -EXE1 = test3 -Description -= Tests _snprintf with wide strings diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test4/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf/test4/CMakeLists.txt deleted file mode 100644 index 5132aa02de..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test4/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test4.c -) - -add_executable(paltest_snprintf_test4 - ${SOURCES} -) - -add_dependencies(paltest_snprintf_test4 coreclrpal) - -target_link_libraries(paltest_snprintf_test4 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test4/test4.c b/src/pal/tests/palsuite/c_runtime/_snprintf/test4/test4.c deleted file mode 100644 index 8c39f222cc..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test4/test4.c +++ /dev/null @@ -1,69 +0,0 @@ -// 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: test4.c -** -** Purpose: Tests _snprintf with pointers -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../_snprintf.h" - -/* - * Notes: memcmp is used, as is strlen. - */ - - -int __cdecl main(int argc, char *argv[]) -{ - void *ptr = (void*) 0x123456; - INT64 lptr = I64(0x1234567887654321); - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - /* - ** Run only on 64 bit platforms - */ - #if defined(BIT64) && defined(PLATFORM_UNIX) - Trace("Testing for 64 Bit Platforms \n"); - DoPointerTest("%p", NULL, "NULL", "0000000000000000"); - DoPointerTest("%p", ptr, "pointer to 0x123456", "0000000000123456"); - DoPointerTest("%17p", ptr, "pointer to 0x123456", " 0000000000123456"); - DoPointerTest("%17p", ptr, "pointer to 0x123456", " 0000000000123456"); - DoPointerTest("%-17p", ptr, "pointer to 0x123456", "0000000000123456 "); - DoPointerTest("%+p", ptr, "pointer to 0x123456", "0000000000123456"); - DoPointerTest("%#p", ptr, "pointer to 0x123456", "0X0000000000123456"); - DoPointerTest("%lp", ptr, "pointer to 0x123456", "00123456"); - DoPointerTest("%hp", ptr, "pointer to 0x123456", "00003456"); - DoPointerTest("%Lp", ptr, "pointer to 0x123456", "00123456"); - DoI64Test("%I64p", lptr, "pointer to 0x1234567887654321", - "1234567887654321"); - #else - Trace("Testing for Non 64 Bit Platforms \n"); - DoPointerTest("%p", NULL, "NULL", "00000000"); - DoPointerTest("%p", ptr, "pointer to 0x123456", "00123456"); - DoPointerTest("%9p", ptr, "pointer to 0x123456", " 00123456"); - DoPointerTest("%09p", ptr, "pointer to 0x123456", " 00123456"); - DoPointerTest("%-9p", ptr, "pointer to 0x123456", "00123456 "); - DoPointerTest("%+p", ptr, "pointer to 0x123456", "00123456"); - DoPointerTest("%#p", ptr, "pointer to 0x123456", "0X00123456"); - DoPointerTest("%lp", ptr, "pointer to 0x123456", "00123456"); - DoPointerTest("%hp", ptr, "pointer to 0x123456", "00003456"); - DoPointerTest("%Lp", ptr, "pointer to 0x123456", "00123456"); - DoI64Test("%I64p", lptr, "pointer to 0x1234567887654321", - "1234567887654321"); - #endif //defined(BIT64) && defined(PLATFORM_UNIX) - - PAL_Terminate(); - return PASS; -} - diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test4/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf/test4/testinfo.dat deleted file mode 100644 index 5d822d160b..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test4/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = _snprintf -Name = Positive Test for _snprintf -TYPE = DEFAULT -EXE1 = test4 -Description -= Tests _snprintf with pointers diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test5/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf/test5/CMakeLists.txt deleted file mode 100644 index 07e441cee0..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test5/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test5.c -) - -add_executable(paltest_snprintf_test5 - ${SOURCES} -) - -add_dependencies(paltest_snprintf_test5 coreclrpal) - -target_link_libraries(paltest_snprintf_test5 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test5/test5.c b/src/pal/tests/palsuite/c_runtime/_snprintf/test5/test5.c deleted file mode 100644 index 46ab1dd35e..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test5/test5.c +++ /dev/null @@ -1,61 +0,0 @@ -// 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: test5.c -** -** Purpose: Tests _snprintf with the count specifier -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../_snprintf.h" - -/* - * Notes: memcmp is used, as is strlen. - */ - - -int __cdecl main(int argc, char *argv[]) -{ - char *longStr = - "really-long-string-that-just-keeps-going-on-and-on-and-on.." - "..................useless-filler.................................." - "..................useless-filler.................................." - "..................useless-filler.................................." - "%n bar"; - char *longResult = - "really-long-string-that-just-keeps-going-on-and-on-and-on.." - "..................useless-filler.................................." - "..................useless-filler.................................." - "..................useless-filler.................................." - " bar"; - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - DoCountTest("foo %n bar", 4, "foo bar"); - DoCountTest(longStr, 257, longResult); - DoCountTest("fo%n bar", 2, "fo bar"); - DoCountTest("%n", 0, ""); - DoCountTest("foo %#n bar", 4, "foo bar"); - DoCountTest("foo % n bar", 4, "foo bar"); - DoCountTest("foo %+n bar", 4, "foo bar"); - DoCountTest("foo %-n bar", 4, "foo bar"); - DoCountTest("foo %0n bar", 4, "foo bar"); - DoShortCountTest("foo %hn bar", 4, "foo bar"); - DoCountTest("foo %ln bar", 4, "foo bar"); - DoCountTest("foo %Ln bar", 4, "foo bar"); - DoCountTest("foo %I64n bar", 4, "foo bar"); - DoCountTest("foo %20.3n bar", 4, "foo bar"); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test5/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf/test5/testinfo.dat deleted file mode 100644 index 33056defd8..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test5/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = _snprintf -Name = Positive Test for _snprintf -TYPE = DEFAULT -EXE1 = test5 -Description -= Tests _snprintf with the count specifier diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test6/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf/test6/CMakeLists.txt deleted file mode 100644 index 9ee5d90544..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test6/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test6.c -) - -add_executable(paltest_snprintf_test6 - ${SOURCES} -) - -add_dependencies(paltest_snprintf_test6 coreclrpal) - -target_link_libraries(paltest_snprintf_test6 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test6/test6.c b/src/pal/tests/palsuite/c_runtime/_snprintf/test6/test6.c deleted file mode 100644 index 32001c2d20..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test6/test6.c +++ /dev/null @@ -1,47 +0,0 @@ -// 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: test6.c -** -** Purpose: Tests _snprintf with characters -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../_snprintf.h" - -/* - * Notes: memcmp is used, as is strlen. - */ - -int __cdecl main(int argc, char *argv[]) -{ - WCHAR wc = (WCHAR) 'c'; - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - - DoCharTest("foo %c", 'b', "foo b"); - DoCharTest("foo %hc", 'b', "foo b"); - DoWCharTest("foo %lc", wc, "foo c"); - DoCharTest("foo %Lc", 'b', "foo b"); - DoCharTest("foo %I64c", 'b', "foo b"); - DoCharTest("foo %5c", 'b', "foo b"); - DoCharTest("foo %.0c", 'b', "foo b"); - DoCharTest("foo %-5c", 'b', "foo b "); - DoCharTest("foo %05c", 'b', "foo 0000b"); - DoCharTest("foo % c", 'b', "foo b"); - DoCharTest("foo %#c", 'b', "foo b"); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test6/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf/test6/testinfo.dat deleted file mode 100644 index ba2ff818aa..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test6/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = _snprintf -Name =Positive Test for _snprintf -TYPE = DEFAULT -EXE1 = test6 -Description -= Tests _snprintf with characters diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test7/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf/test7/CMakeLists.txt deleted file mode 100644 index f7651218e0..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test7/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test7.c -) - -add_executable(paltest_snprintf_test7 - ${SOURCES} -) - -add_dependencies(paltest_snprintf_test7 coreclrpal) - -target_link_libraries(paltest_snprintf_test7 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test7/test7.c b/src/pal/tests/palsuite/c_runtime/_snprintf/test7/test7.c deleted file mode 100644 index bfd5c3f4f1..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test7/test7.c +++ /dev/null @@ -1,47 +0,0 @@ -// 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: test7.c -** -** Purpose: Tests _snprintf with wide characters -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../_snprintf.h" -/* - * Notes: memcmp is used, as is strlen. - */ - - -int __cdecl main(int argc, char *argv[]) -{ - WCHAR wb = (WCHAR) 'b'; - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - - DoWCharTest("foo %C", wb, "foo b"); - DoWCharTest("foo %hC", wb, "foo b"); - DoCharTest("foo %lC", 'c', "foo c"); - DoWCharTest("foo %LC", wb, "foo b"); - DoWCharTest("foo %I64C", wb, "foo b"); - DoWCharTest("foo %5C", wb, "foo b"); - DoWCharTest("foo %.0C", wb, "foo b"); - DoWCharTest("foo %-5C", wb, "foo b "); - DoWCharTest("foo %05C", wb, "foo 0000b"); - DoWCharTest("foo % C", wb, "foo b"); - DoWCharTest("foo %#C", wb, "foo b"); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test7/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf/test7/testinfo.dat deleted file mode 100644 index 5c2406c7b2..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test7/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = _snprintf -Name = Positive Test for _snprintf -TYPE = DEFAULT -EXE1 = test7 -Description -= Tests _snprintf with wide characters diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test8/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf/test8/CMakeLists.txt deleted file mode 100644 index 26af119852..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test8/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test8.c -) - -add_executable(paltest_snprintf_test8 - ${SOURCES} -) - -add_dependencies(paltest_snprintf_test8 coreclrpal) - -target_link_libraries(paltest_snprintf_test8 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test8/test8.c b/src/pal/tests/palsuite/c_runtime/_snprintf/test8/test8.c deleted file mode 100644 index 60ff1b05b8..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test8/test8.c +++ /dev/null @@ -1,56 +0,0 @@ -// 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: test8.c -** -** Purpose: Tests _snprintf with decimal numbers -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../_snprintf.h" - -/* - * Notes: memcmp is used, as is strlen. - */ - - -int __cdecl main(int argc, char *argv[]) -{ - int neg = -42; - int pos = 42; - INT64 l = 42; - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - - DoNumTest("foo %d", pos, "foo 42"); - DoNumTest("foo %ld", 0xFFFF, "foo 65535"); - DoNumTest("foo %hd", 0xFFFF, "foo -1"); - DoNumTest("foo %Ld", pos, "foo 42"); - DoI64Test("foo %I64d", l, "42", "foo 42"); - DoNumTest("foo %3d", pos, "foo 42"); - DoNumTest("foo %-3d", pos, "foo 42 "); - DoNumTest("foo %.1d", pos, "foo 42"); - DoNumTest("foo %.3d", pos, "foo 042"); - DoNumTest("foo %03d", pos, "foo 042"); - DoNumTest("foo %#d", pos, "foo 42"); - DoNumTest("foo %+d", pos, "foo +42"); - DoNumTest("foo % d", pos, "foo 42"); - DoNumTest("foo %+d", neg, "foo -42"); - DoNumTest("foo % d", neg, "foo -42"); - - - PAL_Terminate(); - return PASS; -} - diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test8/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf/test8/testinfo.dat deleted file mode 100644 index f6520d8dde..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test8/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = _snprintf -Name = Positive Test for _snprintf -TYPE = DEFAULT -EXE1 = test8 -Description -= Tests _snprintf with decimal numbers diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test9/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf/test9/CMakeLists.txt deleted file mode 100644 index 484075919e..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test9/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test9.c -) - -add_executable(paltest_snprintf_test9 - ${SOURCES} -) - -add_dependencies(paltest_snprintf_test9 coreclrpal) - -target_link_libraries(paltest_snprintf_test9 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test9/test9.c b/src/pal/tests/palsuite/c_runtime/_snprintf/test9/test9.c deleted file mode 100644 index e836bcaee3..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test9/test9.c +++ /dev/null @@ -1,55 +0,0 @@ -// 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: test9.c -** -** Purpose: Tests _snprintf with integer numbers -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../_snprintf.h" - -/* - * Notes: memcmp is used, as is strlen. - */ - - -int __cdecl main(int argc, char *argv[]) -{ - int neg = -42; - int pos = 42; - INT64 l = 42; - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - - DoNumTest("foo %i", pos, "foo 42"); - DoNumTest("foo %li", 0xFFFF, "foo 65535"); - DoNumTest("foo %hi", 0xFFFF, "foo -1"); - DoNumTest("foo %Li", pos, "foo 42"); - DoI64Test("foo %I64i", l, "42", "foo 42"); - DoNumTest("foo %3i", pos, "foo 42"); - DoNumTest("foo %-3i", pos, "foo 42 "); - DoNumTest("foo %.1i", pos, "foo 42"); - DoNumTest("foo %.3i", pos, "foo 042"); - DoNumTest("foo %03i", pos, "foo 042"); - DoNumTest("foo %#i", pos, "foo 42"); - DoNumTest("foo %+i", pos, "foo +42"); - DoNumTest("foo % i", pos, "foo 42"); - DoNumTest("foo %+i", neg, "foo -42"); - DoNumTest("foo % i", neg, "foo -42"); - - PAL_Terminate(); - return PASS; -} - diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test9/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf/test9/testinfo.dat deleted file mode 100644 index 2a64b26030..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snprintf/test9/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = _snprintf -Name = Positive Test for _snprintf -TYPE = DEFAULT -EXE1 = test9 -Description -= Tests _snprintf with integer numbers diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf_s/CMakeLists.txt new file mode 100644 index 0000000000..8fe1cb60ac --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/CMakeLists.txt @@ -0,0 +1,21 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +add_subdirectory(test1) +add_subdirectory(test10) +add_subdirectory(test11) +add_subdirectory(test12) +add_subdirectory(test13) +add_subdirectory(test14) +add_subdirectory(test15) +add_subdirectory(test16) +add_subdirectory(test17) +add_subdirectory(test18) +add_subdirectory(test19) +add_subdirectory(test2) +add_subdirectory(test3) +add_subdirectory(test4) +add_subdirectory(test6) +add_subdirectory(test7) +add_subdirectory(test8) +add_subdirectory(test9) + diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/_snprintf_s.h b/src/pal/tests/palsuite/c_runtime/_snprintf_s/_snprintf_s.h new file mode 100644 index 0000000000..9ed5209bea --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/_snprintf_s.h @@ -0,0 +1,194 @@ +// 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: sprintf_s.h +** +** Purpose: Containts common testing functions for sprintf_s +** +** +**==========================================================================*/ + +#ifndef __STRINGTEST_H__ +#define __STRINGTEST_H__ + +void DoStrTest(const char *formatstr, char* param, const char *checkstr) +{ + char buf[256] = { 0 }; + + _snprintf_s(buf, 256, _TRUNCATE, formatstr, param); + if (memcmp(buf, checkstr, strlen(checkstr) + 1) != 0) + { + Fail("ERROR: failed to insert string \"%s\" into \"%s\"\n" + "Expected \"%s\" got \"%s\".\n", + param, formatstr, checkstr, buf); + } +} + +void DoWStrTest(const char *formatstr, WCHAR* param, const char *checkstr) +{ + char buf[256] = { 0 }; + + _snprintf_s(buf, 256, _TRUNCATE, formatstr, param); + if (memcmp(buf, checkstr, strlen(checkstr) + 1) != 0) + { + Fail("ERROR: failed to insert wide string \"%s\" into \"%s\"\n" + "Expected \"%s\" got \"%s\".\n", + convertC(param), formatstr, checkstr, buf); + } +} + + +void DoPointerTest(const char *formatstr, void* param, char* paramstr, char + *checkstr1) +{ + char buf[256] = { 0 }; + + _snprintf_s(buf, 256, _TRUNCATE, formatstr, param); + if (memcmp(buf, checkstr1, strlen(checkstr1) + 1) != 0) + { + Fail("ERROR: failed to insert %s into \"%s\"\n" + "Expected \"%s\", got \"%s\".\n", + paramstr, formatstr, checkstr1, buf); + } +} + +void DoCountTest(const char *formatstr, int param, const char *checkstr) +{ + char buf[512] = { 0 }; + int n = -1; + + sprintf_s(buf, 512, formatstr, &n); + + if (n != param) + { + Fail("ERROR: Expected count parameter to resolve to %d, got %X\n", + param, n); + } + if (memcmp(buf, checkstr, strlen(checkstr) + 1) != 0) + { + Fail("ERROR: Expected \"%s\" got \"%s\".\n", checkstr, buf); + } +} + +void DoShortCountTest(const char *formatstr, int param, const char *checkstr) +{ + char buf[256] = { 0 }; + short int n = -1; + + _snprintf_s(buf, 256, _TRUNCATE, formatstr, &n); + + if (n != param) + { + Fail("ERROR: Expected count parameter to resolve to %d, got %X\n", + param, n); + } + if (memcmp(buf, checkstr, strlen(checkstr) + 1) != 0) + { + Fail("ERROR: Expected \"%s\" got \"%s\".\n", checkstr, buf); + } +} + +void DoCharTest(const char *formatstr, char param, const char *checkstr) +{ + char buf[256] = { 0 }; + + _snprintf_s(buf, 256, _TRUNCATE, formatstr, param); + if (memcmp(buf, checkstr, strlen(checkstr) + 1) != 0) + { + Fail("ERROR: failed to insert char \'%c\' (%d) into \"%s\"\n" + "Expected \"%s\" got \"%s\".\n", + param, param, formatstr, checkstr, buf); + } +} + +void DoWCharTest(const char *formatstr, WCHAR param, const char *checkstr) +{ + char buf[256] = { 0 }; + + _snprintf_s(buf, 256, _TRUNCATE, formatstr, param); + if (memcmp(buf, checkstr, strlen(checkstr) + 1) != 0) + { + Fail("ERROR: failed to insert wide char \'%c\' (%d) into \"%s\"\n" + "Expected \"%s\" got \"%s\".\n", + (char)param, param, formatstr, checkstr, buf); + } +} + +void DoNumTest(const char *formatstr, int value, const char *checkstr) +{ + char buf[256] = { 0 }; + + _snprintf_s(buf, 256, _TRUNCATE, formatstr, value); + if (memcmp(buf, checkstr, strlen(checkstr) + 1) != 0) + { + Fail("ERROR: failed to insert %#x into \"%s\"\n" + "Expected \"%s\" got \"%s\".\n", + value, formatstr, checkstr, buf); + } +} + +void DoI64Test(const char *formatstr, INT64 value, char *valuestr, const char *checkstr1) +{ + char buf[256] = { 0 }; + + _snprintf_s(buf, 256, _TRUNCATE, formatstr, value); + if (memcmp(buf, checkstr1, strlen(checkstr1) + 1) != 0) + { + Fail("ERROR: failed to insert %s into \"%s\"\n" + "Expected \"%s\", got \"%s\".\n", + valuestr, formatstr, checkstr1, buf); + } +} + +void DoDoubleTest(const char *formatstr, double value, const char *checkstr1, char +*checkstr2) +{ + char buf[256] = { 0 }; + + _snprintf_s(buf, 256, _TRUNCATE, formatstr, value); + if (memcmp(buf, checkstr1, strlen(checkstr1) + 1) != 0 + && memcmp(buf, checkstr2, strlen(checkstr2) + 1) != 0) + { + Fail("ERROR: failed to insert %f into \"%s\"\n" + "Expected \"%s\" or \"%s\", got \"%s\".\n", + value, formatstr, checkstr1, checkstr2, buf); + } +} + +void DoArgumentPrecTest(const char *formatstr, int precision, void *param, char +*paramstr, const char *checkstr1, const char *checkstr2) +{ + char buf[256]; + + _snprintf_s(buf, 256, _TRUNCATE, formatstr, precision, param); + if (memcmp(buf, checkstr1, strlen(checkstr1) + 1) != 0 && + memcmp(buf, checkstr2, strlen(checkstr2) + 1) != 0) + { + Fail("ERROR: failed to insert %s into \"%s\" with precision %d\n" + "Expected \"%s\" or \"%s\", got \"%s\".\n", + paramstr, formatstr, precision, checkstr1, checkstr2, buf); + } + +} + +void DoArgumentPrecDoubleTest(const char *formatstr, int precision, double param, +const char *checkstr1, const char *checkstr2) +{ + char buf[256]; + + _snprintf_s(buf, 256, _TRUNCATE, formatstr, precision, param); + if (memcmp(buf, checkstr1, strlen(checkstr1) + 1) != 0 && + memcmp(buf, checkstr2, strlen(checkstr2) + 1) != 0) + { + Fail("ERROR: failed to insert %f into \"%s\" with precision %d\n" + "Expected \"%s\" or \"%s\", got \"%s\".\n", + param, formatstr, precision, checkstr1, checkstr2, buf); + } + +} + +#endif + diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test1/CMakeLists.txt new file mode 100644 index 0000000000..9e4c671ec8 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test1/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test1.cpp +) + +add_executable(paltest_snprintf_test1 + ${SOURCES} +) + +add_dependencies(paltest_snprintf_test1 coreclrpal) + +target_link_libraries(paltest_snprintf_test1 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test1/test1.cpp b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test1/test1.cpp new file mode 100644 index 0000000000..d180b05df5 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test1/test1.cpp @@ -0,0 +1,58 @@ +// 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: test1.c +** +** Purpose: General test to see if sprintf_s works correctly +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../_snprintf_s.h" + +/* + * Notes: memcmp is used, as is strlen. + */ + +int __cdecl main(int argc, char *argv[]) +{ + char checkstr[] = "hello world"; + char buf[256] = { 0 }; + int ret; + + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + + _snprintf_s(buf, 256, _TRUNCATE, "hello world"); + if (memcmp(checkstr, buf, strlen(checkstr)+1) != 0) + { + Fail("ERROR: expected \"%s\" (up to %d chars), got \"%s\"\n", + checkstr, 256, buf); + } + + _snprintf_s(buf, 256, _TRUNCATE, "xxxxxxxxxxxxxxxxx"); + ret = _snprintf_s(buf, 8, _TRUNCATE, "hello world"); + + if (ret >= 0) + { + Fail("ERROR: expected negative return value, got %d", ret); + } + if (memcmp(checkstr, buf, 7) != 0 || buf[7] != 0 || buf[8] != 'x') + { + Fail("ERROR: expected %s (up to %d chars), got %s\n", + checkstr, 8, buf); + } + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test1/testinfo.dat new file mode 100644 index 0000000000..255c534cdf --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test1/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sprintf_s +Name = Positive Test for sprintf_s +TYPE = DEFAULT +EXE1 = test1 +Description += General test to see if sprintf_s works correctly diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test10/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test10/CMakeLists.txt new file mode 100644 index 0000000000..57e7fb16d3 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test10/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test10.cpp +) + +add_executable(paltest_snprintf_test10 + ${SOURCES} +) + +add_dependencies(paltest_snprintf_test10 coreclrpal) + +target_link_libraries(paltest_snprintf_test10 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test10/test10.cpp b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test10/test10.cpp new file mode 100644 index 0000000000..7ecb9102e4 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test10/test10.cpp @@ -0,0 +1,55 @@ +// 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: test10.c +** +** Purpose: Tests sprintf_s with octal numbers +** +** +**==========================================================================*/ + + + + +#include <palsuite.h> +#include "../_snprintf_s.h" + +/* + * Notes: memcmp is used, as is strlen. + */ + +int __cdecl main(int argc, char *argv[]) +{ + int neg = -42; + int pos = 42; + INT64 l = 42; + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + + DoNumTest("foo %o", pos, "foo 52"); + DoNumTest("foo %lo", 0xFFFF, "foo 177777"); + DoNumTest("foo %ho", 0xFFFF, "foo 177777"); + DoNumTest("foo %Lo", pos, "foo 52"); + DoI64Test("foo %I64o", l, "42", "foo 52"); + DoNumTest("foo %3o", pos, "foo 52"); + DoNumTest("foo %-3o", pos, "foo 52 "); + DoNumTest("foo %.1o", pos, "foo 52"); + DoNumTest("foo %.3o", pos, "foo 052"); + DoNumTest("foo %03o", pos, "foo 052"); + DoNumTest("foo %#o", pos, "foo 052"); + DoNumTest("foo %+o", pos, "foo 52"); + DoNumTest("foo % o", pos, "foo 52"); + DoNumTest("foo %+o", neg, "foo 37777777726"); + DoNumTest("foo % o", neg, "foo 37777777726"); + + PAL_Terminate(); + return PASS; +} + diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test10/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test10/testinfo.dat new file mode 100644 index 0000000000..25ed554ea3 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test10/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sprintf_s +Name = Positive Test for sprintf_s +TYPE = DEFAULT +EXE1 = test10 +Description += Tests sprintf_s with octal numbers diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test11/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test11/CMakeLists.txt new file mode 100644 index 0000000000..4fc179c5a8 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test11/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test11.cpp +) + +add_executable(paltest_snprintf_test11 + ${SOURCES} +) + +add_dependencies(paltest_snprintf_test11 coreclrpal) + +target_link_libraries(paltest_snprintf_test11 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test11/test11.cpp b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test11/test11.cpp new file mode 100644 index 0000000000..c2ac015698 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test11/test11.cpp @@ -0,0 +1,54 @@ +// 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: test11.c +** +** Purpose: Tests sprintf_s with unsigned numbers +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../_snprintf_s.h" + +/* + * Notes: memcmp is used, as is strlen. + */ + +int __cdecl main(int argc, char *argv[]) +{ + int neg = -42; + int pos = 42; + INT64 l = 42; + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + + DoNumTest("foo %u", pos, "foo 42"); + DoNumTest("foo %lu", 0xFFFF, "foo 65535"); + DoNumTest("foo %hu", 0xFFFF, "foo 65535"); + DoNumTest("foo %Lu", pos, "foo 42"); + DoI64Test("foo %I64u", l, "42", "foo 42"); + DoNumTest("foo %3u", pos, "foo 42"); + DoNumTest("foo %-3u", pos, "foo 42 "); + DoNumTest("foo %.1u", pos, "foo 42"); + DoNumTest("foo %.3u", pos, "foo 042"); + DoNumTest("foo %03u", pos, "foo 042"); + DoNumTest("foo %#u", pos, "foo 42"); + DoNumTest("foo %+u", pos, "foo 42"); + DoNumTest("foo % u", pos, "foo 42"); + DoNumTest("foo %+u", neg, "foo 4294967254"); + DoNumTest("foo % u", neg, "foo 4294967254"); + + PAL_Terminate(); + return PASS; +} + diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test11/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test11/testinfo.dat new file mode 100644 index 0000000000..3144f1290e --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test11/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sprintf_s +Name = Positive Test for sprintf_s +TYPE = DEFAULT +EXE1 = test11 +Description += Tests sprintf_s with unsigned numbers diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test12/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test12/CMakeLists.txt new file mode 100644 index 0000000000..a35609eb57 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test12/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test12.cpp +) + +add_executable(paltest_snprintf_test12 + ${SOURCES} +) + +add_dependencies(paltest_snprintf_test12 coreclrpal) + +target_link_libraries(paltest_snprintf_test12 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test12/test12.cpp b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test12/test12.cpp new file mode 100644 index 0000000000..52171838cc --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test12/test12.cpp @@ -0,0 +1,55 @@ +// 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: test12.c +** +** Purpose: Tests sprintf_s with hex numbers (lowercase) +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../_snprintf_s.h" + +/* + * Notes: memcmp is used, as is strlen. + */ + + +int __cdecl main(int argc, char *argv[]) +{ + int neg = -42; + int pos = 0x1234ab; + INT64 l = I64(0x1234567887654321); + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + + DoNumTest("foo %x", pos, "foo 1234ab"); + DoNumTest("foo %lx", pos, "foo 1234ab"); + DoNumTest("foo %hx", pos, "foo 34ab"); + DoNumTest("foo %Lx", pos, "foo 1234ab"); + DoI64Test("foo %I64x", l, "0x1234567887654321", "foo 1234567887654321"); + DoNumTest("foo %7x", pos, "foo 1234ab"); + DoNumTest("foo %-7x", pos, "foo 1234ab "); + DoNumTest("foo %.1x", pos, "foo 1234ab"); + DoNumTest("foo %.7x", pos, "foo 01234ab"); + DoNumTest("foo %07x", pos, "foo 01234ab"); + DoNumTest("foo %#x", pos, "foo 0x1234ab"); + DoNumTest("foo %+x", pos, "foo 1234ab"); + DoNumTest("foo % x", pos, "foo 1234ab"); + DoNumTest("foo %+x", neg, "foo ffffffd6"); + DoNumTest("foo % x", neg, "foo ffffffd6"); + + PAL_Terminate(); + return PASS; +} + diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test12/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test12/testinfo.dat new file mode 100644 index 0000000000..ed91cecc46 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test12/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sprintf_s +Name = Positive Test for sprintf_s +TYPE = DEFAULT +EXE1 = test12 +Description += Tests sprintf_s with hex numbers (lowercase) diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test13/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test13/CMakeLists.txt new file mode 100644 index 0000000000..3bf986e851 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test13/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test13.cpp +) + +add_executable(paltest_snprintf_test13 + ${SOURCES} +) + +add_dependencies(paltest_snprintf_test13 coreclrpal) + +target_link_libraries(paltest_snprintf_test13 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test13/test13.cpp b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test13/test13.cpp new file mode 100644 index 0000000000..15e47558b0 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test13/test13.cpp @@ -0,0 +1,55 @@ +// 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: test13.c +** +** Purpose: Tests sprintf_s with hex numbers (uppercase) +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../_snprintf_s.h" + +/* + * Notes: memcmp is used, as is strlen. + */ + + +int __cdecl main(int argc, char *argv[]) +{ + int neg = -42; + int pos = 0x1234AB; + INT64 l = I64(0x1234567887654321); + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + + DoNumTest("foo %X", pos, "foo 1234AB"); + DoNumTest("foo %lX", pos, "foo 1234AB"); + DoNumTest("foo %hX", pos, "foo 34AB"); + DoNumTest("foo %LX", pos, "foo 1234AB"); + DoI64Test("foo %I64X", l, "0x1234567887654321", "foo 1234567887654321"); + DoNumTest("foo %7X", pos, "foo 1234AB"); + DoNumTest("foo %-7X", pos, "foo 1234AB "); + DoNumTest("foo %.1X", pos, "foo 1234AB"); + DoNumTest("foo %.7X", pos, "foo 01234AB"); + DoNumTest("foo %07X", pos, "foo 01234AB"); + DoNumTest("foo %#X", pos, "foo 0X1234AB"); + DoNumTest("foo %+X", pos, "foo 1234AB"); + DoNumTest("foo % X", pos, "foo 1234AB"); + DoNumTest("foo %+X", neg, "foo FFFFFFD6"); + DoNumTest("foo % X", neg, "foo FFFFFFD6"); + + PAL_Terminate(); + return PASS; +} + diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test13/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test13/testinfo.dat new file mode 100644 index 0000000000..fd5f53017c --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test13/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sprintf_s +Name = Positive Test for sprintf_s +TYPE = DEFAULT +EXE1 = test13 +Description += Tests sprintf_s with hex numbers (uppercase) diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test14/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test14/CMakeLists.txt new file mode 100644 index 0000000000..985303ecf8 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_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_snprintf_test14 + ${SOURCES} +) + +add_dependencies(paltest_snprintf_test14 coreclrpal) + +target_link_libraries(paltest_snprintf_test14 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test14/test14.cpp b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test14/test14.cpp new file mode 100644 index 0000000000..331475e962 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test14/test14.cpp @@ -0,0 +1,57 @@ +// 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: Tests sprintf_s with exponential format doubles (lowercase) +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../_snprintf_s.h" + +/* + * Notes: memcmp is used, as is strlen. + */ + + +int __cdecl main(int argc, char *argv[]) +{ + double val = 256.0; + double neg = -256.0; + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + + DoDoubleTest("foo %e", val, "foo 2.560000e+002", "foo 2.560000e+02"); + DoDoubleTest("foo %le", val, "foo 2.560000e+002", "foo 2.560000e+02"); + DoDoubleTest("foo %he", val, "foo 2.560000e+002", "foo 2.560000e+02"); + DoDoubleTest("foo %Le", val, "foo 2.560000e+002", "foo 2.560000e+02"); + DoDoubleTest("foo %I64e", val, "foo 2.560000e+002", "foo 2.560000e+02"); + DoDoubleTest("foo %14e", val, "foo 2.560000e+002", + "foo 2.560000e+02"); + DoDoubleTest("foo %-14e", val, "foo 2.560000e+002 ", + "foo 2.560000e+02 "); + DoDoubleTest("foo %.1e", val, "foo 2.6e+002", "foo 2.6e+02"); + DoDoubleTest("foo %.8e", val, "foo 2.56000000e+002", + "foo 2.56000000e+02"); + DoDoubleTest("foo %014e", val, "foo 02.560000e+002", + "foo 002.560000e+02"); + DoDoubleTest("foo %#e", val, "foo 2.560000e+002", "foo 2.560000e+02"); + DoDoubleTest("foo %+e", val, "foo +2.560000e+002", "foo +2.560000e+02"); + DoDoubleTest("foo % e", val, "foo 2.560000e+002", "foo 2.560000e+02"); + DoDoubleTest("foo %+e", neg, "foo -2.560000e+002", "foo -2.560000e+02"); + DoDoubleTest("foo % e", neg, "foo -2.560000e+002", "foo -2.560000e+02"); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test14/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test14/testinfo.dat new file mode 100644 index 0000000000..23cf423354 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test14/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sprintf_s +Name = Positive Test for sprintf_s +TYPE = DEFAULT +EXE1 = test14 +Description += Tests sprintf_s with exponential format doubles (lowercase) diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test15/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test15/CMakeLists.txt new file mode 100644 index 0000000000..c7f5796089 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test15/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test15.cpp +) + +add_executable(paltest_snprintf_test15 + ${SOURCES} +) + +add_dependencies(paltest_snprintf_test15 coreclrpal) + +target_link_libraries(paltest_snprintf_test15 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test15/test15.cpp b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test15/test15.cpp new file mode 100644 index 0000000000..d43613b6cf --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test15/test15.cpp @@ -0,0 +1,56 @@ +// 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: test15.c +** +** Purpose: Tests sprintf_s with exponential format doubles (uppercase) +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../_snprintf_s.h" + +/* + * Notes: memcmp is used, as is strlen. + */ + +int __cdecl main(int argc, char *argv[]) +{ + double val = 256.0; + double neg = -256.0; + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + + DoDoubleTest("foo %E", val, "foo 2.560000E+002", "foo 2.560000E+02"); + DoDoubleTest("foo %lE", val, "foo 2.560000E+002", "foo 2.560000E+02"); + DoDoubleTest("foo %hE", val, "foo 2.560000E+002", "foo 2.560000E+02"); + DoDoubleTest("foo %LE", val, "foo 2.560000E+002", "foo 2.560000E+02"); + DoDoubleTest("foo %I64E", val, "foo 2.560000E+002", "foo 2.560000E+02"); + DoDoubleTest("foo %14E", val, "foo 2.560000E+002", + "foo 2.560000E+02"); + DoDoubleTest("foo %-14E", val, "foo 2.560000E+002 ", + "foo 2.560000E+02 "); + DoDoubleTest("foo %.1E", val, "foo 2.6E+002", "foo 2.6E+02"); + DoDoubleTest("foo %.8E", val, "foo 2.56000000E+002", + "foo 2.56000000E+02"); + DoDoubleTest("foo %014E", val, "foo 02.560000E+002", + "foo 002.560000E+02"); + DoDoubleTest("foo %#E", val, "foo 2.560000E+002", "foo 2.560000E+02"); + DoDoubleTest("foo %+E", val, "foo +2.560000E+002", "foo +2.560000E+02"); + DoDoubleTest("foo % E", val, "foo 2.560000E+002", "foo 2.560000E+02"); + DoDoubleTest("foo %+E", neg, "foo -2.560000E+002", "foo -2.560000E+02"); + DoDoubleTest("foo % E", neg, "foo -2.560000E+002", "foo -2.560000E+02"); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test15/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test15/testinfo.dat new file mode 100644 index 0000000000..537e6d1db2 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test15/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sprintf_s +Name = Positive Test for sprintf_s +TYPE = DEFAULT +EXE1 = test15 +Description += Tests sprintf_s with exponential format doubles (uppercase) diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test16/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test16/CMakeLists.txt new file mode 100644 index 0000000000..9a224bc23b --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test16/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test16.cpp +) + +add_executable(paltest_snprintf_test16 + ${SOURCES} +) + +add_dependencies(paltest_snprintf_test16 coreclrpal) + +target_link_libraries(paltest_snprintf_test16 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test16/test16.cpp b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test16/test16.cpp new file mode 100644 index 0000000000..21cbb1ed30 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test16/test16.cpp @@ -0,0 +1,52 @@ +// 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: test16.c +** +** Purpose: Test #15 for the sprintf_s function +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../_snprintf_s.h" + +/* + * Notes: memcmp is used, as is strlen. + */ + +int __cdecl main(int argc, char *argv[]) +{ + double val = 2560.001; + double neg = -2560.001; + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + + DoDoubleTest("foo %f", val, "foo 2560.001000", "foo 2560.001000"); + DoDoubleTest("foo %lf", val, "foo 2560.001000", "foo 2560.001000"); + DoDoubleTest("foo %hf", val, "foo 2560.001000", "foo 2560.001000"); + DoDoubleTest("foo %Lf", val, "foo 2560.001000", "foo 2560.001000"); + DoDoubleTest("foo %I64f", val, "foo 2560.001000", "foo 2560.001000"); + DoDoubleTest("foo %12f", val, "foo 2560.001000", "foo 2560.001000"); + DoDoubleTest("foo %-12f", val, "foo 2560.001000 ", "foo 2560.001000 "); + DoDoubleTest("foo %.1f", val, "foo 2560.0", "foo 2560.0"); + DoDoubleTest("foo %.8f", val, "foo 2560.00100000", "foo 2560.00100000"); + DoDoubleTest("foo %012f", val, "foo 02560.001000", "foo 02560.001000"); + DoDoubleTest("foo %#f", val, "foo 2560.001000", "foo 2560.001000"); + DoDoubleTest("foo %+f", val, "foo +2560.001000", "foo +2560.001000"); + DoDoubleTest("foo % f", val, "foo 2560.001000", "foo 2560.001000"); + DoDoubleTest("foo %+f", neg, "foo -2560.001000", "foo -2560.001000"); + DoDoubleTest("foo % f", neg, "foo -2560.001000", "foo -2560.001000"); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test16/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test16/testinfo.dat new file mode 100644 index 0000000000..4e98eccac2 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test16/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sprintf_s +Name = Positive Test for sprintf_s +TYPE = DEFAULT +EXE1 = test16 +Description += Tests sprintf_s with decimal point format doubles diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test17/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test17/CMakeLists.txt new file mode 100644 index 0000000000..3a8a349c84 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test17/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test17.cpp +) + +add_executable(paltest_snprintf_test17 + ${SOURCES} +) + +add_dependencies(paltest_snprintf_test17 coreclrpal) + +target_link_libraries(paltest_snprintf_test17 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test17/test17.cpp b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test17/test17.cpp new file mode 100644 index 0000000000..d161270b84 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test17/test17.cpp @@ -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: test17.c +** +** Purpose: Tests sprintf_s with compact format doubles (lowercase) +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../_snprintf_s.h" + +/* + * Notes: memcmp is used, as is strlen. + */ + +int __cdecl main(int argc, char *argv[]) +{ + double val = 2560.001; + double neg = -2560.001; + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + + DoDoubleTest("foo %g", val, "foo 2560", "foo 2560"); + DoDoubleTest("foo %lg", val, "foo 2560", "foo 2560"); + DoDoubleTest("foo %hg", val, "foo 2560", "foo 2560"); + DoDoubleTest("foo %Lg", val, "foo 2560", "foo 2560"); + DoDoubleTest("foo %I64g", val, "foo 2560", "foo 2560"); + DoDoubleTest("foo %5g", val, "foo 2560", "foo 2560"); + DoDoubleTest("foo %-5g", val, "foo 2560 ", "foo 2560 "); + DoDoubleTest("foo %.1g", val, "foo 3e+003", "foo 3e+03"); + DoDoubleTest("foo %.2g", val, "foo 2.6e+003", "foo 2.6e+03"); + DoDoubleTest("foo %.12g", val, "foo 2560.001", "foo 2560.001"); + DoDoubleTest("foo %06g", val, "foo 002560", "foo 002560"); + DoDoubleTest("foo %#g", val, "foo 2560.00", "foo 2560.00"); + DoDoubleTest("foo %+g", val, "foo +2560", "foo +2560"); + DoDoubleTest("foo % g", val, "foo 2560", "foo 2560"); + DoDoubleTest("foo %+g", neg, "foo -2560", "foo -2560"); + DoDoubleTest("foo % g", neg, "foo -2560", "foo -2560"); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test17/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test17/testinfo.dat new file mode 100644 index 0000000000..5e41e20d44 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test17/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sprintf_s +Name = Positive Test for sprintf_s +TYPE = DEFAULT +EXE1 = test17 +Description += Tests sprintf_s with compact format doubles (lowercase) diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test18/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test18/CMakeLists.txt new file mode 100644 index 0000000000..96e39e8f41 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test18/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test18.cpp +) + +add_executable(paltest_snprintf_test18 + ${SOURCES} +) + +add_dependencies(paltest_snprintf_test18 coreclrpal) + +target_link_libraries(paltest_snprintf_test18 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test18/test18.cpp b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test18/test18.cpp new file mode 100644 index 0000000000..46ec287cc1 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test18/test18.cpp @@ -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: test18.c +** +** Purpose: Tests sprintf_s with compact format doubles (uppercase) +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../_snprintf_s.h" + +/* + * Notes: memcmp is used, as is strlen. + */ + +int __cdecl main(int argc, char *argv[]) +{ + double val = 2560.001; + double neg = -2560.001; + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + + DoDoubleTest("foo %G", val, "foo 2560", "foo 2560"); + DoDoubleTest("foo %lG", val, "foo 2560", "foo 2560"); + DoDoubleTest("foo %hG", val, "foo 2560", "foo 2560"); + DoDoubleTest("foo %LG", val, "foo 2560", "foo 2560"); + DoDoubleTest("foo %I64G", val, "foo 2560", "foo 2560"); + DoDoubleTest("foo %5G", val, "foo 2560", "foo 2560"); + DoDoubleTest("foo %-5G", val, "foo 2560 ", "foo 2560 "); + DoDoubleTest("foo %.1G", val, "foo 3E+003", "foo 3E+03"); + DoDoubleTest("foo %.2G", val, "foo 2.6E+003", "foo 2.6E+03"); + DoDoubleTest("foo %.12G", val, "foo 2560.001", "foo 2560.001"); + DoDoubleTest("foo %06G", val, "foo 002560", "foo 002560"); + DoDoubleTest("foo %#G", val, "foo 2560.00", "foo 2560.00"); + DoDoubleTest("foo %+G", val, "foo +2560", "foo +2560"); + DoDoubleTest("foo % G", val, "foo 2560", "foo 2560"); + DoDoubleTest("foo %+G", neg, "foo -2560", "foo -2560"); + DoDoubleTest("foo % G", neg, "foo -2560", "foo -2560"); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test18/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test18/testinfo.dat new file mode 100644 index 0000000000..06ae3a632e --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test18/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sprintf_s +Name = Positive Test for sprintf_s +TYPE = DEFAULT +EXE1 = test18 +Description += Tests sprintf_s with compact format doubles (uppercase) diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test19/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test19/CMakeLists.txt new file mode 100644 index 0000000000..be3570f163 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test19/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test19.cpp +) + +add_executable(paltest_snprintf_test19 + ${SOURCES} +) + +add_dependencies(paltest_snprintf_test19 coreclrpal) + +target_link_libraries(paltest_snprintf_test19 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test19/test19.cpp b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test19/test19.cpp new file mode 100644 index 0000000000..91b1dae583 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test19/test19.cpp @@ -0,0 +1,70 @@ +// 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: test19.c +** +** Purpose:Tests sprintf_s with argument specified precision +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../_snprintf_s.h" + +/* + * Notes: memcmp is used, as is strlen. + */ + + +int __cdecl main(int argc, char *argv[]) +{ + int n = -1; + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + DoArgumentPrecTest("%.*s", 2, (void*)"bar", "bar", "ba", "ba"); + DoArgumentPrecTest("%.*S", 2, (void*)convert("bar"), "bar", "ba", "ba"); + + DoArgumentPrecTest("%.*c", 0, (void*)'a', "a", "a", "a"); + DoArgumentPrecTest("%.*c", 4, (void*)'a', "a", "a", "a"); + DoArgumentPrecTest("%.*C", 0, (void*)'a', "a", "a", "a"); + DoArgumentPrecTest("%.*C", 4, (void*)'a', "a", "a", "a"); + DoArgumentPrecTest("%.*d", 1, (void*)42, "42", "42", "42"); + DoArgumentPrecTest("%.*d", 3, (void*)42, "42", "042", "042"); + DoArgumentPrecTest("%.*i", 1, (void*)42, "42", "42", "42"); + DoArgumentPrecTest("%.*i", 3, (void*)42, "42", "042", "042"); + DoArgumentPrecTest("%.*o", 1, (void*)42, "42", "52", "52"); + DoArgumentPrecTest("%.*o", 3, (void*)42, "42", "052", "052"); + DoArgumentPrecTest("%.*u", 1, (void*)42, "42", "42", "42"); + DoArgumentPrecTest("%.*u", 3, (void*)42, "42", "042", "042"); + DoArgumentPrecTest("%.*x", 1, (void*)0x42, "0x42", "42", "42"); + DoArgumentPrecTest("%.*x", 3, (void*)0x42, "0x42", "042", "042"); + DoArgumentPrecTest("%.*X", 1, (void*)0x42, "0x42", "42", "42") ; + DoArgumentPrecTest("%.*X", 3, (void*)0x42, "0x42", "042", "042"); + + + DoArgumentPrecDoubleTest("%.*e", 1, 2.01, "2.0e+000", "2.0e+00"); + DoArgumentPrecDoubleTest("%.*e", 3, 2.01, "2.010e+000", "2.010e+00"); + DoArgumentPrecDoubleTest("%.*E", 1, 2.01, "2.0E+000", "2.0E+00"); + DoArgumentPrecDoubleTest("%.*E", 3, 2.01, "2.010E+000", "2.010E+00"); + DoArgumentPrecDoubleTest("%.*f", 1, 2.01, "2.0", "2.0"); + DoArgumentPrecDoubleTest("%.*f", 3, 2.01, "2.010", "2.010"); + DoArgumentPrecDoubleTest("%.*g", 1, 256.01, "3e+002", "3e+02"); + DoArgumentPrecDoubleTest("%.*g", 3, 256.01, "256", "256"); + DoArgumentPrecDoubleTest("%.*g", 4, 256.01, "256", "256"); + DoArgumentPrecDoubleTest("%.*g", 6, 256.01, "256.01", "256.01"); + DoArgumentPrecDoubleTest("%.*G", 1, 256.01, "3E+002", "3E+02"); + DoArgumentPrecDoubleTest("%.*G", 3, 256.01, "256", "256"); + DoArgumentPrecDoubleTest("%.*G", 4, 256.01, "256", "256"); + DoArgumentPrecDoubleTest("%.*G", 6, 256.01, "256.01", "256.01"); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test19/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test19/testinfo.dat new file mode 100644 index 0000000000..7064c01771 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test19/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sprintf_s +Name = Positive Test for sprintf_s +TYPE = DEFAULT +EXE1 = test19 +Description += Tests sprintf_s with argument specified precision diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test2/CMakeLists.txt new file mode 100644 index 0000000000..11d18e61c3 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test2/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test2.cpp +) + +add_executable(paltest_snprintf_test2 + ${SOURCES} +) + +add_dependencies(paltest_snprintf_test2 coreclrpal) + +target_link_libraries(paltest_snprintf_test2 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test2/test2.cpp b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test2/test2.cpp new file mode 100644 index 0000000000..e58669466f --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test2/test2.cpp @@ -0,0 +1,44 @@ +// 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: test2.c +** +** Purpose:Tests sprintf_s with strings +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../_snprintf_s.h" +/* + * Notes: memcmp is used, as is strlen. + */ + +int __cdecl main(int argc, char *argv[]) +{ + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + DoStrTest("foo %s", "bar", "foo bar"); + DoStrTest("foo %hs", "bar", "foo bar"); + DoWStrTest("foo %ls", convert("bar"), "foo bar"); + DoWStrTest("foo %ws", convert("bar"), "foo bar"); + DoStrTest("foo %Ls", "bar", "foo bar"); + DoStrTest("foo %I64s", "bar", "foo bar"); + DoStrTest("foo %5s", "bar", "foo bar"); + DoStrTest("foo %.2s", "bar", "foo ba"); + DoStrTest("foo %5.2s", "bar", "foo ba"); + DoStrTest("foo %-5s", "bar", "foo bar "); + DoStrTest("foo %05s", "bar", "foo 00bar"); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test2/testinfo.dat new file mode 100644 index 0000000000..cce2dc67e7 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test2/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sprintf_s +Name = Positive Test for sprintf_s +TYPE = DEFAULT +EXE1 = test2 +Description += Tests sprintf_s with strings diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test3/CMakeLists.txt new file mode 100644 index 0000000000..b8d4178962 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test3/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test3.cpp +) + +add_executable(paltest_snprintf_test3 + ${SOURCES} +) + +add_dependencies(paltest_snprintf_test3 coreclrpal) + +target_link_libraries(paltest_snprintf_test3 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test3/test3.cpp b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test3/test3.cpp new file mode 100644 index 0000000000..3c52b44246 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test3/test3.cpp @@ -0,0 +1,45 @@ +// 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: test3.c +** +** Purpose: Tests sprintf_s with wide strings +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../_snprintf_s.h" + +/* + * Notes: memcmp is used, as is strlen. + */ + +int __cdecl main(int argc, char *argv[]) +{ + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + DoWStrTest("foo %S", convert("bar"), "foo bar"); + DoStrTest("foo %hS", "bar", "foo bar"); + DoWStrTest("foo %lS", convert("bar"), "foo bar"); + DoWStrTest("foo %wS", convert("bar"), "foo bar"); + DoWStrTest("foo %LS", convert("bar"), "foo bar"); + DoWStrTest("foo %I64S", convert("bar"), "foo bar"); + DoWStrTest("foo %5S", convert("bar"), "foo bar"); + DoWStrTest("foo %.2S", convert("bar"), "foo ba"); + DoWStrTest("foo %5.2S", convert("bar"), "foo ba"); + DoWStrTest("foo %-5S", convert("bar"), "foo bar "); + DoWStrTest("foo %05S", convert("bar"), "foo 00bar"); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test3/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test3/testinfo.dat new file mode 100644 index 0000000000..cc8de0eae5 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test3/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sprintf_s +Name = Positive Test for sprintf_s +TYPE = DEFAULT +EXE1 = test3 +Description += Tests sprintf_s with wide strings diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test4/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test4/CMakeLists.txt new file mode 100644 index 0000000000..568b7122de --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test4/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test4.cpp +) + +add_executable(paltest_snprintf_test4 + ${SOURCES} +) + +add_dependencies(paltest_snprintf_test4 coreclrpal) + +target_link_libraries(paltest_snprintf_test4 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test4/test4.cpp b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test4/test4.cpp new file mode 100644 index 0000000000..216557f10a --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test4/test4.cpp @@ -0,0 +1,69 @@ +// 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: test4.c +** +** Purpose: Tests sprintf_s with pointers +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../_snprintf_s.h" + +/* + * Notes: memcmp is used, as is strlen. + */ + + +int __cdecl main(int argc, char *argv[]) +{ + void *ptr = (void*) 0x123456; + INT64 lptr = I64(0x1234567887654321); + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + /* + ** Run only on 64 bit platforms + */ + #if defined(BIT64) && defined(PLATFORM_UNIX) + Trace("Testing for 64 Bit Platforms \n"); + DoPointerTest("%p", NULL, "NULL", "0000000000000000"); + DoPointerTest("%p", ptr, "pointer to 0x123456", "0000000000123456"); + DoPointerTest("%17p", ptr, "pointer to 0x123456", " 0000000000123456"); + DoPointerTest("%17p", ptr, "pointer to 0x123456", " 0000000000123456"); + DoPointerTest("%-17p", ptr, "pointer to 0x123456", "0000000000123456 "); + DoPointerTest("%+p", ptr, "pointer to 0x123456", "0000000000123456"); + DoPointerTest("%#p", ptr, "pointer to 0x123456", "0X0000000000123456"); + DoPointerTest("%lp", ptr, "pointer to 0x123456", "00123456"); + DoPointerTest("%hp", ptr, "pointer to 0x123456", "00003456"); + DoPointerTest("%Lp", ptr, "pointer to 0x123456", "00123456"); + DoI64Test("%I64p", lptr, "pointer to 0x1234567887654321", + "1234567887654321"); + #else + Trace("Testing for Non 64 Bit Platforms \n"); + DoPointerTest("%p", NULL, "NULL", "00000000"); + DoPointerTest("%p", ptr, "pointer to 0x123456", "00123456"); + DoPointerTest("%9p", ptr, "pointer to 0x123456", " 00123456"); + DoPointerTest("%09p", ptr, "pointer to 0x123456", " 00123456"); + DoPointerTest("%-9p", ptr, "pointer to 0x123456", "00123456 "); + DoPointerTest("%+p", ptr, "pointer to 0x123456", "00123456"); + DoPointerTest("%#p", ptr, "pointer to 0x123456", "0X00123456"); + DoPointerTest("%lp", ptr, "pointer to 0x123456", "00123456"); + DoPointerTest("%hp", ptr, "pointer to 0x123456", "00003456"); + DoPointerTest("%Lp", ptr, "pointer to 0x123456", "00123456"); + DoI64Test("%I64p", lptr, "pointer to 0x1234567887654321", + "1234567887654321"); + #endif //defined(BIT64) && defined(PLATFORM_UNIX) + + PAL_Terminate(); + return PASS; +} + diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test4/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test4/testinfo.dat new file mode 100644 index 0000000000..f53f784991 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test4/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sprintf_s +Name = Positive Test for sprintf_s +TYPE = DEFAULT +EXE1 = test4 +Description += Tests sprintf_s with pointers diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test6/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test6/CMakeLists.txt new file mode 100644 index 0000000000..820cc66d55 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test6/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test6.cpp +) + +add_executable(paltest_snprintf_test6 + ${SOURCES} +) + +add_dependencies(paltest_snprintf_test6 coreclrpal) + +target_link_libraries(paltest_snprintf_test6 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test6/test6.cpp b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test6/test6.cpp new file mode 100644 index 0000000000..45c9e2b79b --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test6/test6.cpp @@ -0,0 +1,47 @@ +// 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: test6.c +** +** Purpose: Tests sprintf_s with characters +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../_snprintf_s.h" + +/* + * Notes: memcmp is used, as is strlen. + */ + +int __cdecl main(int argc, char *argv[]) +{ + WCHAR wc = (WCHAR) 'c'; + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + + DoCharTest("foo %c", 'b', "foo b"); + DoCharTest("foo %hc", 'b', "foo b"); + DoWCharTest("foo %lc", wc, "foo c"); + DoCharTest("foo %Lc", 'b', "foo b"); + DoCharTest("foo %I64c", 'b', "foo b"); + DoCharTest("foo %5c", 'b', "foo b"); + DoCharTest("foo %.0c", 'b', "foo b"); + DoCharTest("foo %-5c", 'b', "foo b "); + DoCharTest("foo %05c", 'b', "foo 0000b"); + DoCharTest("foo % c", 'b', "foo b"); + DoCharTest("foo %#c", 'b', "foo b"); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test6/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test6/testinfo.dat new file mode 100644 index 0000000000..06e31e85d6 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test6/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sprintf_s +Name =Positive Test for sprintf_s +TYPE = DEFAULT +EXE1 = test6 +Description += Tests sprintf_s with characters diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test7/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test7/CMakeLists.txt new file mode 100644 index 0000000000..a2af7c4a8c --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test7/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test7.cpp +) + +add_executable(paltest_snprintf_test7 + ${SOURCES} +) + +add_dependencies(paltest_snprintf_test7 coreclrpal) + +target_link_libraries(paltest_snprintf_test7 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test7/test7.cpp b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test7/test7.cpp new file mode 100644 index 0000000000..5c10fc8ea7 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test7/test7.cpp @@ -0,0 +1,47 @@ +// 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: test7.c +** +** Purpose: Tests sprintf_s with wide characters +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../_snprintf_s.h" +/* + * Notes: memcmp is used, as is strlen. + */ + + +int __cdecl main(int argc, char *argv[]) +{ + WCHAR wb = (WCHAR) 'b'; + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + + DoWCharTest("foo %C", wb, "foo b"); + DoWCharTest("foo %hC", wb, "foo b"); + DoCharTest("foo %lC", 'c', "foo c"); + DoWCharTest("foo %LC", wb, "foo b"); + DoWCharTest("foo %I64C", wb, "foo b"); + DoWCharTest("foo %5C", wb, "foo b"); + DoWCharTest("foo %.0C", wb, "foo b"); + DoWCharTest("foo %-5C", wb, "foo b "); + DoWCharTest("foo %05C", wb, "foo 0000b"); + DoWCharTest("foo % C", wb, "foo b"); + DoWCharTest("foo %#C", wb, "foo b"); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test7/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test7/testinfo.dat new file mode 100644 index 0000000000..647c9d80fd --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test7/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sprintf_s +Name = Positive Test for sprintf_s +TYPE = DEFAULT +EXE1 = test7 +Description += Tests sprintf_s with wide characters diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test8/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test8/CMakeLists.txt new file mode 100644 index 0000000000..53545c5dbf --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test8/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test8.cpp +) + +add_executable(paltest_snprintf_test8 + ${SOURCES} +) + +add_dependencies(paltest_snprintf_test8 coreclrpal) + +target_link_libraries(paltest_snprintf_test8 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test8/test8.cpp b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test8/test8.cpp new file mode 100644 index 0000000000..416e357e1e --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test8/test8.cpp @@ -0,0 +1,56 @@ +// 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: test8.c +** +** Purpose: Tests sprintf_s with decimal numbers +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../_snprintf_s.h" + +/* + * Notes: memcmp is used, as is strlen. + */ + + +int __cdecl main(int argc, char *argv[]) +{ + int neg = -42; + int pos = 42; + INT64 l = 42; + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + + DoNumTest("foo %d", pos, "foo 42"); + DoNumTest("foo %ld", 0xFFFF, "foo 65535"); + DoNumTest("foo %hd", 0xFFFF, "foo -1"); + DoNumTest("foo %Ld", pos, "foo 42"); + DoI64Test("foo %I64d", l, "42", "foo 42"); + DoNumTest("foo %3d", pos, "foo 42"); + DoNumTest("foo %-3d", pos, "foo 42 "); + DoNumTest("foo %.1d", pos, "foo 42"); + DoNumTest("foo %.3d", pos, "foo 042"); + DoNumTest("foo %03d", pos, "foo 042"); + DoNumTest("foo %#d", pos, "foo 42"); + DoNumTest("foo %+d", pos, "foo +42"); + DoNumTest("foo % d", pos, "foo 42"); + DoNumTest("foo %+d", neg, "foo -42"); + DoNumTest("foo % d", neg, "foo -42"); + + + PAL_Terminate(); + return PASS; +} + diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test8/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test8/testinfo.dat new file mode 100644 index 0000000000..524834e53e --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test8/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sprintf_s +Name = Positive Test for sprintf_s +TYPE = DEFAULT +EXE1 = test8 +Description += Tests sprintf_s with decimal numbers diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test9/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test9/CMakeLists.txt new file mode 100644 index 0000000000..33ca9db7a8 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test9/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test9.cpp +) + +add_executable(paltest_snprintf_test9 + ${SOURCES} +) + +add_dependencies(paltest_snprintf_test9 coreclrpal) + +target_link_libraries(paltest_snprintf_test9 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test9/test9.cpp b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test9/test9.cpp new file mode 100644 index 0000000000..18b1cb7830 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test9/test9.cpp @@ -0,0 +1,55 @@ +// 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: test9.c +** +** Purpose: Tests sprintf_s with integer numbers +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../_snprintf_s.h" + +/* + * Notes: memcmp is used, as is strlen. + */ + + +int __cdecl main(int argc, char *argv[]) +{ + int neg = -42; + int pos = 42; + INT64 l = 42; + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + + DoNumTest("foo %i", pos, "foo 42"); + DoNumTest("foo %li", 0xFFFF, "foo 65535"); + DoNumTest("foo %hi", 0xFFFF, "foo -1"); + DoNumTest("foo %Li", pos, "foo 42"); + DoI64Test("foo %I64i", l, "42", "foo 42"); + DoNumTest("foo %3i", pos, "foo 42"); + DoNumTest("foo %-3i", pos, "foo 42 "); + DoNumTest("foo %.1i", pos, "foo 42"); + DoNumTest("foo %.3i", pos, "foo 042"); + DoNumTest("foo %03i", pos, "foo 042"); + DoNumTest("foo %#i", pos, "foo 42"); + DoNumTest("foo %+i", pos, "foo +42"); + DoNumTest("foo % i", pos, "foo 42"); + DoNumTest("foo %+i", neg, "foo -42"); + DoNumTest("foo % i", neg, "foo -42"); + + PAL_Terminate(); + return PASS; +} + diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test9/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test9/testinfo.dat new file mode 100644 index 0000000000..7c51443a3d --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test9/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sprintf_s +Name = Positive Test for sprintf_s +TYPE = DEFAULT +EXE1 = test9 +Description += Tests sprintf_s with integer numbers diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf/CMakeLists.txt deleted file mode 100644 index cafb9536b0..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -add_subdirectory(test1) -add_subdirectory(test10) -add_subdirectory(test11) -add_subdirectory(test12) -add_subdirectory(test13) -add_subdirectory(test14) -add_subdirectory(test15) -add_subdirectory(test16) -add_subdirectory(test17) -add_subdirectory(test18) -add_subdirectory(test19) -add_subdirectory(test2) -add_subdirectory(test3) -add_subdirectory(test4) -add_subdirectory(test5) -add_subdirectory(test6) -add_subdirectory(test7) -add_subdirectory(test8) -add_subdirectory(test9) - diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/_snwprintf.h b/src/pal/tests/palsuite/c_runtime/_snwprintf/_snwprintf.h deleted file mode 100644 index 73bf4d6c12..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/_snwprintf.h +++ /dev/null @@ -1,199 +0,0 @@ -// 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: _snwprintf.h -** -** Purpose: Containts common testing functions for _snwprintf -** -** -**==========================================================================*/ - -#ifndef ___SNWPRINTF_H__ -#define ___SNWPRINTF_H__ - -void DoWStrTest(WCHAR *formatstr, WCHAR *param, WCHAR *checkstr) -{ - WCHAR buf[256] = { 0 }; - - _snwprintf(buf, 256, formatstr, param); - - if (memcmp(buf, checkstr, wcslen(checkstr) * 2 + 2) != 0) - { - Fail("ERROR: failed to insert wide string \"%s\" into \"%s\".\n" - "Expected \"%s\", got \"%s\".\n", convertC(param), - convertC(formatstr), convertC(checkstr), convertC(buf)); - } -} - -void DoStrTest(WCHAR *formatstr, char *param, WCHAR *checkstr) -{ - WCHAR buf[256] = { 0 }; - - _snwprintf(buf, 256, formatstr, param); - - if (memcmp(buf, checkstr, wcslen(checkstr) * 2 + 2) != 0) - { - Fail("ERROR: failed to insert wide string \"%s\" into \"%s\".\n" - "Expected \"%s\", got \"%s\".\n", - param, convertC(formatstr), convertC(checkstr), convertC(buf)); - } -} - -void DoPointerTest(WCHAR *formatstr, void* param, WCHAR *checkstr1) -{ - WCHAR buf[256] = { 0 }; - - _snwprintf(buf, 256, formatstr, param); - if (memcmp(buf, checkstr1, wcslen(checkstr1)*2 + 2) != 0) - { - Fail("ERROR: failed to insert pointer to %#p into \"%s\"\n" - "Expected \"%s\", got \"%s\".\n", param, convertC(formatstr), - convertC(checkstr1), convertC(buf)); - } -} - -void DoCountTest(WCHAR *formatstr, int param, WCHAR *checkstr) -{ - WCHAR buf[512] = { 0 }; - int n = -1; - - _snwprintf(buf, 512, formatstr, &n); - - if (n != param) - { - Fail("ERROR: Expected count parameter to resolve to %d, got %d\n", - param, n); - } - - if (memcmp(buf, checkstr, wcslen(checkstr)*2 + 2) != 0) - { - Fail("ERROR: Expected \"%s\" got \"%s\".\n", - convertC(checkstr), convertC(buf)); - } -} - -void DoShortCountTest(WCHAR *formatstr, int param, WCHAR *checkstr) -{ - WCHAR buf[256] = { 0 }; - short int n = -1; - - _snwprintf(buf, 256, formatstr, &n); - - if (n != param) - { - Fail("ERROR: Expected count parameter to resolve to %d, got %d\n", - param, n); - } - - if (memcmp(buf, checkstr, wcslen(checkstr)*2 + 2) != 0) - { - Fail("ERROR: Expected \"%s\" got \"%s\".\n", - convertC(checkstr), convertC(buf)); - } -} - -void DoCharTest(WCHAR *formatstr, char param, WCHAR *checkstr) -{ - WCHAR buf[256] = { 0 }; - - _snwprintf(buf, 256, formatstr, param); - if (memcmp(buf, checkstr, wcslen(checkstr)*2 + 2) != 0) - { - Fail("ERROR: failed to insert char \'%c\' (%d) into \"%s\"\n" - "Expected \"%s\" got \"%s\".\n", param, param, - convertC(formatstr), convertC(checkstr), convertC(buf)); - } -} - -void DoWCharTest(WCHAR *formatstr, WCHAR param, WCHAR *checkstr) -{ - WCHAR buf[256] = { 0 }; - - _snwprintf(buf, 256, formatstr, param); - if (memcmp(buf, checkstr, wcslen(checkstr)*2 + 2) != 0) - { - Fail("ERROR: failed to insert wide char \'%c\' (%d) into \"%s\"\n" - "Expected \"%s\" got \"%s\".\n", (char) param, param, - convertC(formatstr), convertC(checkstr), convertC(buf)); - } -} - -void DoNumTest(WCHAR *formatstr, int value, WCHAR*checkstr) -{ - WCHAR buf[256] = { 0 }; - - _snwprintf(buf, 256, formatstr, value); - if (memcmp(buf, checkstr, wcslen(checkstr)* 2 + 2) != 0) - { - Fail("ERROR: failed to insert %#x into \"%s\"\n" - "Expected \"%s\" got \"%s\".\n", value, convertC(formatstr), - convertC(checkstr), convertC(buf)); - } -} - - -void DoI64Test(WCHAR *formatstr, INT64 param, char *paramdesc, - WCHAR *checkstr1) -{ - WCHAR buf[256] = { 0 }; - - _snwprintf(buf, 256, formatstr, param); - if (memcmp(buf, checkstr1, wcslen(checkstr1)*2 + 2) != 0) - { - Fail("ERROR: failed to insert %s into \"%s\"\n" - "Expected \"%s\", got \"%s\".\n", paramdesc, - convertC(formatstr), convertC(checkstr1), convertC(buf)); - } -} - -void DoDoubleTest(WCHAR *formatstr, double value, WCHAR *checkstr1, - WCHAR *checkstr2) -{ - WCHAR buf[256] = { 0 }; - - _snwprintf(buf, 256, formatstr, value); - if (memcmp(buf, checkstr1, wcslen(checkstr1)*2 + 2) != 0 && - memcmp(buf, checkstr2, wcslen(checkstr2)*2 + 2) != 0) - { - Fail("ERROR: failed to insert %f into \"%s\"\n" - "Expected \"%s\" or \"%s\", got \"%s\".\n", - value, convertC(formatstr), convertC(checkstr1), - convertC(checkstr2), convertC(buf)); - } -} - -void DoArgumentPrecTest(WCHAR *formatstr, int precision, void *param, - char *paramstr, WCHAR *checkstr1, WCHAR *checkstr2) -{ - WCHAR buf[256]; - - _snwprintf(buf, 256, formatstr, precision, param); - if (memcmp(buf, checkstr1, wcslen(checkstr1) + 2) != 0 && - memcmp(buf, checkstr2, wcslen(checkstr2) + 2) != 0) - { - Fail("ERROR: failed to insert %s into \"%s\" with precision %d\n" - "Expected \"%s\" or \"%s\", got \"%s\".\n", - paramstr, convertC(formatstr), precision, - convertC(checkstr1), convertC(checkstr2) ,convertC(buf)); - } -} - -void DoArgumentPrecDoubleTest(WCHAR *formatstr, int precision, double param, - WCHAR *checkstr) -{ - WCHAR buf[256]; - - _snwprintf(buf, 256, formatstr, precision, param); - if (memcmp(buf, checkstr, wcslen(checkstr) + 2) != 0) - { - Fail("ERROR: failed to insert %f into \"%s\" with precision %d\n" - "Expected \"%s\", got \"%s\".\n", param, convertC(formatstr), - precision, convertC(checkstr), convertC(buf)); - } -} - -#endif - diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf/test1/CMakeLists.txt deleted file mode 100644 index b4ab6d5161..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test1/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test1.c -) - -add_executable(paltest_snwprintf_test1 - ${SOURCES} -) - -add_dependencies(paltest_snwprintf_test1 coreclrpal) - -target_link_libraries(paltest_snwprintf_test1 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_snwprintf/test1/test1.c deleted file mode 100644 index 5d13aaf05d..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test1/test1.c +++ /dev/null @@ -1,62 +0,0 @@ -// 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: test1.c -** -** Purpose: General test to see if _snwprintf works correctly -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../_snwprintf.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[]) -{ - WCHAR *checkstr; - WCHAR buf[256] = { 0 }; - int ret; - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - checkstr = convert("hello world"); - _snwprintf(buf, 256, checkstr); - if (memcmp(checkstr, buf, wcslen(checkstr)*2+2) != 0) - { - Fail("ERROR: Expected \"%s\", got \"%s\"\n", - convertC(checkstr), convertC(buf)); - } - - _snwprintf(buf, 256, convert("xxxxxxxxxxxxxxxxx")); - ret = _snwprintf(buf, 8, checkstr); - if (memcmp(checkstr, buf, 16) != 0) - { - Fail("ERROR: Expected \"%8s\", got \"%8s\"\n", - convertC(checkstr), convertC(buf)); - } - if (ret >= 0) - { - Fail("ERROR: Expected negative return value, got %d.\n", ret); - } - if (buf[8] != (WCHAR) 'x') - { - Fail("ERROR: buffer overflow using \"%s\" with length 8.\n", - convertC(checkstr)); - } - - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf/test1/testinfo.dat deleted file mode 100644 index 079a3b3989..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test1/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = _snwprintf -Name = Positive Test for _snwprintf -TYPE = DEFAULT -EXE1 = test1 -Description -= General test to see if _snwprintf works correctly diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test10/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf/test10/CMakeLists.txt deleted file mode 100644 index 27aaca3bb9..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test10/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test10.c -) - -add_executable(paltest_snwprintf_test10 - ${SOURCES} -) - -add_dependencies(paltest_snwprintf_test10 coreclrpal) - -target_link_libraries(paltest_snwprintf_test10 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test10/test10.c b/src/pal/tests/palsuite/c_runtime/_snwprintf/test10/test10.c deleted file mode 100644 index e8a6d93ea3..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test10/test10.c +++ /dev/null @@ -1,54 +0,0 @@ -// 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: test10.c -** -** Purpose: Tests _snwprintf with octal numbers -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../_snwprintf.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[]) -{ - int neg = -42; - int pos = 42; - INT64 l = 42; - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - - DoNumTest(convert("foo %o"), pos, convert("foo 52")); - DoNumTest(convert("foo %lo"), 0xFFFF, convert("foo 177777")); - DoNumTest(convert("foo %ho"), 0xFFFF, convert("foo 177777")); - DoNumTest(convert("foo %Lo"), pos, convert("foo 52")); - DoI64Test(convert("foo %I64o"), l, "42", convert("foo 52")); - DoNumTest(convert("foo %3o"), pos, convert("foo 52")); - DoNumTest(convert("foo %-3o"), pos, convert("foo 52 ")); - DoNumTest(convert("foo %.1o"), pos, convert("foo 52")); - DoNumTest(convert("foo %.3o"), pos, convert("foo 052")); - DoNumTest(convert("foo %03o"), pos, convert("foo 052")); - DoNumTest(convert("foo %#o"), pos, convert("foo 052")); - DoNumTest(convert("foo %+o"), pos, convert("foo 52")); - DoNumTest(convert("foo % o"), pos, convert("foo 52")); - DoNumTest(convert("foo %+o"), neg, convert("foo 37777777726")); - DoNumTest(convert("foo % o"), neg, convert("foo 37777777726")); - - - PAL_Terminate(); - return PASS; -} - diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test10/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf/test10/testinfo.dat deleted file mode 100644 index 2c07cc6e45..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test10/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = _snwprintf -Name = Positive Test for _snwprintf -TYPE = DEFAULT -EXE1 = test10 -Description -= Tests _snwprintf with octal numbers diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test11/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf/test11/CMakeLists.txt deleted file mode 100644 index e18ad4a31b..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test11/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test11.c -) - -add_executable(paltest_snwprintf_test11 - ${SOURCES} -) - -add_dependencies(paltest_snwprintf_test11 coreclrpal) - -target_link_libraries(paltest_snwprintf_test11 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test11/test11.c b/src/pal/tests/palsuite/c_runtime/_snwprintf/test11/test11.c deleted file mode 100644 index 95f7f53210..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test11/test11.c +++ /dev/null @@ -1,54 +0,0 @@ -// 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: test11.c -** -** Purpose: Tests _snwprintf with unsigned numbers -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../_snwprintf.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[]) -{ - int neg = -42; - int pos = 42; - INT64 l = 42; - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - - DoNumTest(convert("foo %u"), pos, convert("foo 42")); - DoNumTest(convert("foo %lu"), 0xFFFF, convert("foo 65535")); - DoNumTest(convert("foo %hu"), 0xFFFF, convert("foo 65535")); - DoNumTest(convert("foo %Lu"), pos, convert("foo 42")); - DoI64Test(convert("foo %I64u"), l, "42", convert("foo 42")); - DoNumTest(convert("foo %3u"), pos, convert("foo 42")); - DoNumTest(convert("foo %-3u"), pos, convert("foo 42 ")); - DoNumTest(convert("foo %.1u"), pos, convert("foo 42")); - DoNumTest(convert("foo %.3u"), pos, convert("foo 042")); - DoNumTest(convert("foo %03u"), pos, convert("foo 042")); - DoNumTest(convert("foo %#u"), pos, convert("foo 42")); - DoNumTest(convert("foo %+u"), pos, convert("foo 42")); - DoNumTest(convert("foo % u"), pos, convert("foo 42")); - DoNumTest(convert("foo %+u"), neg, convert("foo 4294967254")); - DoNumTest(convert("foo % u"), neg, convert("foo 4294967254")); - - - PAL_Terminate(); - return PASS; -} - diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test11/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf/test11/testinfo.dat deleted file mode 100644 index f81a7861bf..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test11/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = _snwprintf -Name = Positive Test for _snwprintf -TYPE = DEFAULT -EXE1 = test11 -Description -= Tests _snwprintf with unsigned numbers diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test12/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf/test12/CMakeLists.txt deleted file mode 100644 index f2ae07c1b0..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test12/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test12.c -) - -add_executable(paltest_snwprintf_test12 - ${SOURCES} -) - -add_dependencies(paltest_snwprintf_test12 coreclrpal) - -target_link_libraries(paltest_snwprintf_test12 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test12/test12.c b/src/pal/tests/palsuite/c_runtime/_snwprintf/test12/test12.c deleted file mode 100644 index ab58fa345f..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test12/test12.c +++ /dev/null @@ -1,54 +0,0 @@ -// 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: test12.c -** -** Purpose: Tests _snwprintf with hex numbers (lowercase) -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../_snwprintf.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[]) -{ - int neg = -42; - int pos = 0x1234ab; - INT64 l = I64(0x1234567887654321); - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - - DoNumTest(convert("foo %x"), pos, convert("foo 1234ab")); - DoNumTest(convert("foo %lx"), pos, convert("foo 1234ab")); - DoNumTest(convert("foo %hx"), pos, convert("foo 34ab")); - DoNumTest(convert("foo %Lx"), pos, convert("foo 1234ab")); - DoI64Test(convert("foo %I64x"), l, "0x1234567887654321", - convert("foo 1234567887654321")); - DoNumTest(convert("foo %7x"), pos, convert("foo 1234ab")); - DoNumTest(convert("foo %-7x"), pos, convert("foo 1234ab ")); - DoNumTest(convert("foo %.1x"), pos, convert("foo 1234ab")); - DoNumTest(convert("foo %.7x"), pos, convert("foo 01234ab")); - DoNumTest(convert("foo %07x"), pos, convert("foo 01234ab")); - DoNumTest(convert("foo %#x"), pos, convert("foo 0x1234ab")); - DoNumTest(convert("foo %+x"), pos, convert("foo 1234ab")); - DoNumTest(convert("foo % x"), pos, convert("foo 1234ab")); - DoNumTest(convert("foo %+x"), neg, convert("foo ffffffd6")); - DoNumTest(convert("foo % x"), neg, convert("foo ffffffd6")); - - PAL_Terminate(); - return PASS; -} - diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test12/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf/test12/testinfo.dat deleted file mode 100644 index 653babae84..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test12/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = _snwprintf -Name = Positive Test for _snwprintf -TYPE = DEFAULT -EXE1 = test12 -Description -= Tests _snwprintf with hex numbers (lowercase) diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test13/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf/test13/CMakeLists.txt deleted file mode 100644 index 42847b6bcd..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test13/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test13.c -) - -add_executable(paltest_snwprintf_test13 - ${SOURCES} -) - -add_dependencies(paltest_snwprintf_test13 coreclrpal) - -target_link_libraries(paltest_snwprintf_test13 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test13/test13.c b/src/pal/tests/palsuite/c_runtime/_snwprintf/test13/test13.c deleted file mode 100644 index 5a3e22802d..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test13/test13.c +++ /dev/null @@ -1,54 +0,0 @@ -// 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: test13.c -** -** Purpose: Tests _snwprintf with hex numbers (uppercase) -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../_snwprintf.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[]) -{ - int neg = -42; - int pos = 0x1234ab; - INT64 l = I64(0x1234567887654321); - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - - DoNumTest(convert("foo %X"), pos, convert("foo 1234AB")); - DoNumTest(convert("foo %lX"), pos, convert("foo 1234AB")); - DoNumTest(convert("foo %hX"), pos, convert("foo 34AB")); - DoNumTest(convert("foo %LX"), pos, convert("foo 1234AB")); - DoI64Test(convert("foo %I64X"), l, "0x1234567887654321", - convert("foo 1234567887654321")); - DoNumTest(convert("foo %7X"), pos, convert("foo 1234AB")); - DoNumTest(convert("foo %-7X"), pos, convert("foo 1234AB ")); - DoNumTest(convert("foo %.1X"), pos, convert("foo 1234AB")); - DoNumTest(convert("foo %.7X"), pos, convert("foo 01234AB")); - DoNumTest(convert("foo %07X"), pos, convert("foo 01234AB")); - DoNumTest(convert("foo %#X"), pos, convert("foo 0X1234AB")); - DoNumTest(convert("foo %+X"), pos, convert("foo 1234AB")); - DoNumTest(convert("foo % X"), pos, convert("foo 1234AB")); - DoNumTest(convert("foo %+X"), neg, convert("foo FFFFFFD6")); - DoNumTest(convert("foo % X"), neg, convert("foo FFFFFFD6")); - - PAL_Terminate(); - return PASS; -} - diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test13/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf/test13/testinfo.dat deleted file mode 100644 index cdeced6654..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test13/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = _snwprintf -Name = Positive Test for _snwprintf -TYPE = DEFAULT -EXE1 = test13 -Description -= Tests _snwprintf with hex numbers (uppercase) diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test14/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf/test14/CMakeLists.txt deleted file mode 100644 index e5cdbfad87..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test14/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test14.c -) - -add_executable(paltest_snwprintf_test14 - ${SOURCES} -) - -add_dependencies(paltest_snwprintf_test14 coreclrpal) - -target_link_libraries(paltest_snwprintf_test14 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test14/test14.c b/src/pal/tests/palsuite/c_runtime/_snwprintf/test14/test14.c deleted file mode 100644 index c34875246d..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test14/test14.c +++ /dev/null @@ -1,66 +0,0 @@ -// 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: Tests _snwprintf with exponential format doubles (lowercase) -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../_snwprintf.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/_snwprintf/test14/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf/test14/testinfo.dat deleted file mode 100644 index b47611aa44..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test14/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = _snwprintf -Name = Positive Test for _snwprintf -TYPE = DEFAULT -EXE1 = test14 -Description -= Tests _snwprintf with exponential format doubles (lowercase) diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test15/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf/test15/CMakeLists.txt deleted file mode 100644 index dc7b4d66e9..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test15/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test15.c -) - -add_executable(paltest_snwprintf_test15 - ${SOURCES} -) - -add_dependencies(paltest_snwprintf_test15 coreclrpal) - -target_link_libraries(paltest_snwprintf_test15 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test15/test15.c b/src/pal/tests/palsuite/c_runtime/_snwprintf/test15/test15.c deleted file mode 100644 index f45005b758..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test15/test15.c +++ /dev/null @@ -1,67 +0,0 @@ -// 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: test15.c -** -** Purpose: Tests _snwprintf with exponential format doubles (uppercase) -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../_snwprintf.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/_snwprintf/test15/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf/test15/testinfo.dat deleted file mode 100644 index 2c81391689..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test15/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = _snwprintf -Name = Positive Test for _snwprintf -TYPE = DEFAULT -EXE1 = test15 -Description -= Tests _snwprintf with exponential format doubles (uppercase) diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test16/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf/test16/CMakeLists.txt deleted file mode 100644 index f147ad7e67..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test16/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test16.c -) - -add_executable(paltest_snwprintf_test16 - ${SOURCES} -) - -add_dependencies(paltest_snwprintf_test16 coreclrpal) - -target_link_libraries(paltest_snwprintf_test16 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test16/test16.c b/src/pal/tests/palsuite/c_runtime/_snwprintf/test16/test16.c deleted file mode 100644 index 88f55bdc10..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test16/test16.c +++ /dev/null @@ -1,65 +0,0 @@ -// 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: test16.c -** -** Purpose: Tests _snwprintf with decimal point format doubles -** -** -**==========================================================================*/ - - -#include <palsuite.h> -#include "../_snwprintf.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 = 2560.001; - double neg = -2560.001; - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - - DoDoubleTest(convert("foo %f"), val, convert("foo 2560.001000"), - convert("foo 2560.001000")); - DoDoubleTest(convert("foo %lf"), val, convert("foo 2560.001000"), - convert("foo 2560.001000")); - DoDoubleTest(convert("foo %hf"), val, convert("foo 2560.001000"), - convert("foo 2560.001000")); - DoDoubleTest(convert("foo %Lf"), val, convert("foo 2560.001000"), - convert("foo 2560.001000")); - DoDoubleTest(convert("foo %I64f"), val, convert("foo 2560.001000"), - convert("foo 2560.001000")); - DoDoubleTest(convert("foo %12f"), val, convert("foo 2560.001000"), - convert("foo 2560.001000")); - DoDoubleTest(convert("foo %-12f"), val, convert("foo 2560.001000 "), - convert("foo 2560.001000 ")); - DoDoubleTest(convert("foo %.1f"), val, convert("foo 2560.0"), - convert("foo 2560.0")); - DoDoubleTest(convert("foo %.8f"), val, convert("foo 2560.00100000"), - convert("foo 2560.00100000")); - DoDoubleTest(convert("foo %012f"), val, convert("foo 02560.001000"), - convert("foo 02560.001000")); - DoDoubleTest(convert("foo %#f"), val, convert("foo 2560.001000"), - convert("foo 2560.001000")); - DoDoubleTest(convert("foo %+f"), val, convert("foo +2560.001000"), - convert("foo +2560.001000")); - DoDoubleTest(convert("foo % f"), val, convert("foo 2560.001000"), - convert("foo 2560.001000")); - DoDoubleTest(convert("foo %+f"), neg, convert("foo -2560.001000"), - convert("foo -2560.001000")); - DoDoubleTest(convert("foo % f"), neg, convert("foo -2560.001000"), - convert("foo -2560.001000")); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test16/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf/test16/testinfo.dat deleted file mode 100644 index 8d844e0b18..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test16/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = _snwprintf -Name = Positive Test for _snwprintf -TYPE = DEFAULT -EXE1 = test16 -Description -= Tests _snwprintf with decimal point format doubles diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test17/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf/test17/CMakeLists.txt deleted file mode 100644 index e40d3f4106..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test17/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test17.c -) - -add_executable(paltest_snwprintf_test17 - ${SOURCES} -) - -add_dependencies(paltest_snwprintf_test17 coreclrpal) - -target_link_libraries(paltest_snwprintf_test17 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test17/test17.c b/src/pal/tests/palsuite/c_runtime/_snwprintf/test17/test17.c deleted file mode 100644 index 82f2330b48..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test17/test17.c +++ /dev/null @@ -1,68 +0,0 @@ -// 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: test17.c -** -** Purpose: Tests _snwprintf with compact format doubles (lowercase) -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../_snwprintf.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 = 2560.001; - double neg = -2560.001; - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - - DoDoubleTest(convert("foo %g"), val, convert("foo 2560"), - convert("foo 2560")); - DoDoubleTest(convert("foo %lg"), val, convert("foo 2560"), - convert("foo 2560")); - DoDoubleTest(convert("foo %hg"), val, convert("foo 2560"), - convert("foo 2560")); - DoDoubleTest(convert("foo %Lg"), val, convert("foo 2560"), - convert("foo 2560")); - DoDoubleTest(convert("foo %I64g"), val, convert("foo 2560"), - convert("foo 2560")); - DoDoubleTest(convert("foo %5g"), val, convert("foo 2560"), - convert("foo 2560")); - DoDoubleTest(convert("foo %-5g"), val, convert("foo 2560 "), - convert("foo 2560 ")); - DoDoubleTest(convert("foo %.1g"), val, convert("foo 3e+003"), - convert("foo 3e+03")); - DoDoubleTest(convert("foo %.2g"), val, convert("foo 2.6e+003"), - convert("foo 2.6e+03")); - DoDoubleTest(convert("foo %.12g"), val, convert("foo 2560.001"), - convert("foo 2560.001")); - DoDoubleTest(convert("foo %06g"), val, convert("foo 002560"), - convert("foo 002560")); - DoDoubleTest(convert("foo %#g"), val, convert("foo 2560.00"), - convert("foo 2560.00")); - DoDoubleTest(convert("foo %+g"), val, convert("foo +2560"), - convert("foo +2560")); - DoDoubleTest(convert("foo % g"), val, convert("foo 2560"), - convert("foo 2560")); - DoDoubleTest(convert("foo %+g"), neg, convert("foo -2560"), - convert("foo -2560")); - DoDoubleTest(convert("foo % g"), neg, convert("foo -2560"), - convert("foo -2560")); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test17/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf/test17/testinfo.dat deleted file mode 100644 index 6b01fb3d7d..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test17/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = _snwprintf -Name = Positive Test for _snwprintf -TYPE = DEFAULT -EXE1 = test17 -Description -= Tests _snwprintf with compact format doubles (lowercase) diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test18/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf/test18/CMakeLists.txt deleted file mode 100644 index 68a014cb66..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test18/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test18.c -) - -add_executable(paltest_snwprintf_test18 - ${SOURCES} -) - -add_dependencies(paltest_snwprintf_test18 coreclrpal) - -target_link_libraries(paltest_snwprintf_test18 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test18/test18.c b/src/pal/tests/palsuite/c_runtime/_snwprintf/test18/test18.c deleted file mode 100644 index dbb6233061..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test18/test18.c +++ /dev/null @@ -1,69 +0,0 @@ -// 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: test18.c -** -** Purpose: Tests _snwprintf with compact format doubles (uppercase) -** -** -**==========================================================================*/ - - - - -#include <palsuite.h> -#include "../_snwprintf.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 = 2560.001; - double neg = -2560.001; - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - - DoDoubleTest(convert("foo %G"), val, convert("foo 2560"), - convert("foo 2560")); - DoDoubleTest(convert("foo %lG"), val, convert("foo 2560"), - convert("foo 2560")); - DoDoubleTest(convert("foo %hG"), val, convert("foo 2560"), - convert("foo 2560")); - DoDoubleTest(convert("foo %LG"), val, convert("foo 2560"), - convert("foo 2560")); - DoDoubleTest(convert("foo %I64G"), val, convert("foo 2560"), - convert("foo 2560")); - DoDoubleTest(convert("foo %5G"), val, convert("foo 2560"), - convert("foo 2560")); - DoDoubleTest(convert("foo %-5G"), val, convert("foo 2560 "), - convert("foo 2560 ")); - DoDoubleTest(convert("foo %.1G"), val, convert("foo 3E+003"), - convert("foo 3E+03")); - DoDoubleTest(convert("foo %.2G"), val, convert("foo 2.6E+003"), - convert("foo 2.6E+03")); - DoDoubleTest(convert("foo %.12G"), val, convert("foo 2560.001"), - convert("foo 2560.001")); - DoDoubleTest(convert("foo %06G"), val, convert("foo 002560"), - convert("foo 002560")); - DoDoubleTest(convert("foo %#G"), val, convert("foo 2560.00"), - convert("foo 2560.00")); - DoDoubleTest(convert("foo %+G"), val, convert("foo +2560"), - convert("foo +2560")); - DoDoubleTest(convert("foo % G"), val, convert("foo 2560"), - convert("foo 2560")); - DoDoubleTest(convert("foo %+G"), neg, convert("foo -2560"), - convert("foo -2560")); - DoDoubleTest(convert("foo % G"), neg, convert("foo -2560"), - convert("foo -2560")); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test18/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf/test18/testinfo.dat deleted file mode 100644 index 480087f560..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test18/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = _snwprintf -Name = Positive Test for _snwprintf -TYPE = DEFAULT -EXE1 = test18 -Description -= Tests _snwprintf with compact format doubles (uppercase) diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test19/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf/test19/CMakeLists.txt deleted file mode 100644 index 6dc30b4d33..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test19/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test19.c -) - -add_executable(paltest_snwprintf_test19 - ${SOURCES} -) - -add_dependencies(paltest_snwprintf_test19 coreclrpal) - -target_link_libraries(paltest_snwprintf_test19 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test19/test19.c b/src/pal/tests/palsuite/c_runtime/_snwprintf/test19/test19.c deleted file mode 100644 index efb222c6ba..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test19/test19.c +++ /dev/null @@ -1,90 +0,0 @@ -// 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: test19.c -** -** Purpose: Tests _snwprintf with argument specified precision -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../_snwprintf.h" - -int __cdecl main(int argc, char *argv[]) -{ - int n = -1; - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - DoArgumentPrecTest(convert("%.*s"), 2, convert("bar"), "bar", - convert("ba"), convert("ba")); - DoArgumentPrecTest(convert("%.*S"), 2, "bar", "bar", - convert("ba"), convert("ba")); - DoArgumentPrecTest(convert("%.*n"), 3, &n, "pointer to int", - convert(""), convert("")); - if (n != 0) - { - Fail("ERROR: Expected count parameter to resolve to %d, got %X\n", - 0, n); - } - - DoArgumentPrecTest(convert("%.*c"), 0, (void*)'a', "a", - convert("a"), convert("a")); - DoArgumentPrecTest(convert("%.*c"), 4, (void*)'a', "a", - convert("a"), convert("a")); - DoArgumentPrecTest(convert("%.*C"), 0, (void*)'a', "a", - convert("a"), convert("a")); - DoArgumentPrecTest(convert("%.*C"), 4, (void*)'a', "a", - convert("a"), convert("a")); - DoArgumentPrecTest(convert("%.*d"), 1, (void*)42, "42", - convert("42"), convert("42")); - DoArgumentPrecTest(convert("%.*d"), 3, (void*)42, "42", - convert("042"), convert("042")); - DoArgumentPrecTest(convert("%.*i"), 1, (void*)42, "42", - convert("42"), convert("42")); - DoArgumentPrecTest(convert("%.*i"), 3, (void*)42, "42", - convert("042"), convert("042")); - DoArgumentPrecTest(convert("%.*o"), 1, (void*)42, "42", - convert("52"), convert("52")); - DoArgumentPrecTest(convert("%.*o"), 3, (void*)42, "42", - convert("052"), convert("052")); - DoArgumentPrecTest(convert("%.*u"), 1, (void*)42, "42", - convert("42"), convert("42")); - DoArgumentPrecTest(convert("%.*u"), 3, (void*)42, "42", - convert("042"), convert("042")); - DoArgumentPrecTest(convert("%.*x"), 1, (void*)0x42, "0x42", - convert("42"), convert("42")); - DoArgumentPrecTest(convert("%.*x"), 3, (void*)0x42, "0x42", - convert("042"), convert("042")); - DoArgumentPrecTest(convert("%.*X"), 1, (void*)0x42, "0x42", - convert("42"), convert("42")); - DoArgumentPrecTest(convert("%.*X"), 3, (void*)0x42, "0x42", - convert("042"), convert("042")); - DoArgumentPrecDoubleTest(convert("%.*e"), 1, 2.01, convert("2.0e+000")); - DoArgumentPrecDoubleTest(convert("%.*e"), 3, 2.01, convert("2.010e+000")); - DoArgumentPrecDoubleTest(convert("%.*E"), 1, 2.01, convert("2.0E+000")); - DoArgumentPrecDoubleTest(convert("%.*E"), 3, 2.01, convert("2.010E+000")); - DoArgumentPrecDoubleTest(convert("%.*f"), 1, 2.01, convert("2.0")); - DoArgumentPrecDoubleTest(convert("%.*f"), 3, 2.01, convert("2.010")); - DoArgumentPrecDoubleTest(convert("%.*g"), 1, 256.01, convert("3e+002")); - DoArgumentPrecDoubleTest(convert("%.*g"), 3, 256.01, convert("256")); - DoArgumentPrecDoubleTest(convert("%.*g"), 4, 256.01, convert("256")); - DoArgumentPrecDoubleTest(convert("%.*g"), 6, 256.01, convert("256.01")); - DoArgumentPrecDoubleTest(convert("%.*G"), 1, 256.01, convert("3E+002")); - DoArgumentPrecDoubleTest(convert("%.*G"), 3, 256.01, convert("256")); - DoArgumentPrecDoubleTest(convert("%.*G"), 4, 256.01, convert("256")); - DoArgumentPrecDoubleTest(convert("%.*G"), 6, 256.01, convert("256.01")); - - PAL_Terminate(); - return PASS; - -} diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test19/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf/test19/testinfo.dat deleted file mode 100644 index 376cbc84d1..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test19/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = _snwprintf -Name = Positive Test for _snwprintf -TYPE = DEFAULT -EXE1 = test19 -Description -= Tests _snwprintf with argument specified precision diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf/test2/CMakeLists.txt deleted file mode 100644 index 9e0d950885..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test2/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test2.c -) - -add_executable(paltest_snwprintf_test2 - ${SOURCES} -) - -add_dependencies(paltest_snwprintf_test2 coreclrpal) - -target_link_libraries(paltest_snwprintf_test2 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test2/test2.c b/src/pal/tests/palsuite/c_runtime/_snwprintf/test2/test2.c deleted file mode 100644 index 974b7967f2..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test2/test2.c +++ /dev/null @@ -1,44 +0,0 @@ -// 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: test2.c -** -** Purpose:Tests _snwprintf with strings -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../_snwprintf.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[]) -{ - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - DoWStrTest(convert("foo %s"), convert("bar"), convert("foo bar")); - DoStrTest(convert("foo %hs"), "bar", convert("foo bar")); - DoWStrTest(convert("foo %ls"), convert("bar"), convert("foo bar")); - DoWStrTest(convert("foo %ws"), convert("bar"), convert("foo bar")); - DoWStrTest(convert("foo %Ls"), convert("bar"), convert("foo bar")); - DoWStrTest(convert("foo %I64s"), convert("bar"), convert("foo bar")); - DoWStrTest(convert("foo %5s"), convert("bar"), convert("foo bar")); - DoWStrTest(convert("foo %.2s"), convert("bar"), convert("foo ba")); - DoWStrTest(convert("foo %5.2s"), convert("bar"), convert("foo ba")); - DoWStrTest(convert("foo %-5s"), convert("bar"), convert("foo bar ")); - DoWStrTest(convert("foo %05s"), convert("bar"), convert("foo 00bar")); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf/test2/testinfo.dat deleted file mode 100644 index 9c65c93e5a..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test2/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = _snwprintf -Name = Positive Test for _snwprintf -TYPE = DEFAULT -EXE1 = test2 -Description -= Tests _snwprintf with strings diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf/test3/CMakeLists.txt deleted file mode 100644 index 4d5a28b0fe..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test3/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test3.c -) - -add_executable(paltest_snwprintf_test3 - ${SOURCES} -) - -add_dependencies(paltest_snwprintf_test3 coreclrpal) - -target_link_libraries(paltest_snwprintf_test3 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test3/test3.c b/src/pal/tests/palsuite/c_runtime/_snwprintf/test3/test3.c deleted file mode 100644 index bfb75ce323..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test3/test3.c +++ /dev/null @@ -1,44 +0,0 @@ -// 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: test3.c -** -** Purpose: Tests _snwprintf with wide strings -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../_snwprintf.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[]) -{ - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - DoStrTest(convert("foo %S"), "bar", convert("foo bar")); - DoStrTest(convert("foo %hS"), "bar", convert("foo bar")); - DoWStrTest(convert("foo %lS"), convert("bar"), convert("foo bar")); - DoWStrTest(convert("foo %wS"), convert("bar"), convert("foo bar")); - DoStrTest(convert("foo %LS"), "bar", convert("foo bar")); - DoStrTest(convert("foo %I64S"), "bar", convert("foo bar")); - DoStrTest(convert("foo %5S"), "bar", convert("foo bar")); - DoStrTest(convert("foo %.2S"), "bar", convert("foo ba")); - DoStrTest(convert("foo %5.2S"), "bar", convert("foo ba")); - DoStrTest(convert("foo %-5S"), "bar", convert("foo bar ")); - DoStrTest(convert("foo %05S"), "bar", convert("foo 00bar")); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test3/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf/test3/testinfo.dat deleted file mode 100644 index b39f4f56b7..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test3/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = _snwprintf -Name = Positive Test for _snwprintf -TYPE = DEFAULT -EXE1 = test3 -Description -= Tests _snwprintf with wide strings diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test4/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf/test4/CMakeLists.txt deleted file mode 100644 index 0102b0acea..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test4/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test4.c -) - -add_executable(paltest_snwprintf_test4 - ${SOURCES} -) - -add_dependencies(paltest_snwprintf_test4 coreclrpal) - -target_link_libraries(paltest_snwprintf_test4 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test4/test4.c b/src/pal/tests/palsuite/c_runtime/_snwprintf/test4/test4.c deleted file mode 100644 index 28f7998591..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test4/test4.c +++ /dev/null @@ -1,71 +0,0 @@ -// 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: test4.c -** -** Purpose: Tests _snwprintf with pointers -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../_snwprintf.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[]) -{ - void *ptr = (void*) 0x123456; - INT64 lptr = I64(0x1234567887654321); - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - -/* -** Run only on 64 bit platforms -*/ -#if defined(BIT64) && defined(PLATFORM_UNIX) - Trace("Testing for 64 Bit Platforms \n"); - DoPointerTest(convert("%p"), NULL, convert("0000000000000000")); - DoPointerTest(convert("%p"), ptr, convert("0000000000123456")); - DoPointerTest(convert("%17p"), ptr, convert(" 0000000000123456")); - DoPointerTest(convert("%17p"), ptr, convert(" 0000000000123456")); - DoPointerTest(convert("%-17p"), ptr, convert("0000000000123456 ")); - DoPointerTest(convert("%+p"), ptr, convert("0000000000123456")); - DoPointerTest(convert("% p"), ptr, convert("0000000000123456")); - DoPointerTest(convert("%#p"), ptr, convert("0X0000000000123456")); - DoPointerTest(convert("%lp"), ptr, convert("00123456")); - DoPointerTest(convert("%hp"), ptr, convert("00003456")); - DoPointerTest(convert("%Lp"), ptr, convert("00123456")); - DoI64Test(convert("%I64p"), lptr, "1234567887654321", - convert("1234567887654321")); -#else - Trace("Testing for Non 64 Bit Platforms \n"); - DoPointerTest(convert("%p"), NULL, convert("00000000")); - DoPointerTest(convert("%p"), ptr, convert("00123456")); - DoPointerTest(convert("%9p"), ptr, convert(" 00123456")); - DoPointerTest(convert("%09p"), ptr, convert(" 00123456")); - DoPointerTest(convert("%-9p"), ptr, convert("00123456 ")); - DoPointerTest(convert("%+p"), ptr, convert("00123456")); - DoPointerTest(convert("% p"), ptr, convert("00123456")); - DoPointerTest(convert("%#p"), ptr, convert("0X00123456")); - DoPointerTest(convert("%lp"), ptr, convert("00123456")); - DoPointerTest(convert("%hp"), ptr, convert("00003456")); - DoPointerTest(convert("%Lp"), ptr, convert("00123456")); - DoI64Test(convert("%I64p"), lptr, "1234567887654321", - convert("1234567887654321")); -#endif - - PAL_Terminate(); - return PASS; -} - diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test4/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf/test4/testinfo.dat deleted file mode 100644 index 3f3600160f..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test4/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = _snwprintf -Name = Positive Test for _snwprintf -TYPE = DEFAULT -EXE1 = test4 -Description -= Tests _snwprintf with pointers diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test5/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf/test5/CMakeLists.txt deleted file mode 100644 index c835c94845..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test5/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test5.c -) - -add_executable(paltest_snwprintf_test5 - ${SOURCES} -) - -add_dependencies(paltest_snwprintf_test5 coreclrpal) - -target_link_libraries(paltest_snwprintf_test5 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test5/test5.c b/src/pal/tests/palsuite/c_runtime/_snwprintf/test5/test5.c deleted file mode 100644 index bbe459751b..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test5/test5.c +++ /dev/null @@ -1,63 +0,0 @@ -// 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: test5.c -** -** Purpose: Tests _snwprintf with the count specifier -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../_snwprintf.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[]) -{ - WCHAR *longStr; - WCHAR *longResult; - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - longStr = convert("really-long-string-that-just-keeps-going-on-and-on-and-on.." - "..................useless-filler.................................." - "..................useless-filler.................................." - "..................useless-filler.................................." - "%n bar"); - longResult = convert("really-long-string-that-just-keeps-going-on-and-on-and-on.." - "..................useless-filler.................................." - "..................useless-filler.................................." - "..................useless-filler.................................." - " bar"); - DoCountTest(convert("foo %n bar"), 4, convert("foo bar")); - DoCountTest(longStr, 257, longResult); - DoCountTest(convert("fo%n bar"), 2, convert("fo bar")); - DoCountTest(convert("%n"), 0, convert("")); - DoCountTest(convert("foo %#n bar"), 4, convert("foo bar")); - DoCountTest(convert("foo % n bar"), 4, convert("foo bar")); - DoCountTest(convert("foo %+n bar"), 4, convert("foo bar")); - DoCountTest(convert("foo %-n bar"), 4, convert("foo bar")); - DoCountTest(convert("foo %0n bar"), 4, convert("foo bar")); - DoShortCountTest(convert("foo %hn bar"), 4, convert("foo bar")); - DoCountTest(convert("foo %ln bar"), 4, convert("foo bar")); - DoCountTest(convert("foo %Ln bar"), 4, convert("foo bar")); - DoCountTest(convert("foo %I64n bar"), 4, convert("foo bar")); - DoCountTest(convert("foo %20.3n bar"), 4, convert("foo bar")); - - free(longStr); - free(longResult); - - PAL_Terminate(); - - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test5/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf/test5/testinfo.dat deleted file mode 100644 index 2180b81cf5..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test5/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = _snwprintf -Name = Positive Test for _snwprintf -TYPE = DEFAULT -EXE1 = test5 -Description -= Tests _snwprintf with the count specifier diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test6/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf/test6/CMakeLists.txt deleted file mode 100644 index 37a415ed86..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test6/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test6.c -) - -add_executable(paltest_snwprintf_test6 - ${SOURCES} -) - -add_dependencies(paltest_snwprintf_test6 coreclrpal) - -target_link_libraries(paltest_snwprintf_test6 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test6/test6.c b/src/pal/tests/palsuite/c_runtime/_snwprintf/test6/test6.c deleted file mode 100644 index 3d4ed3f882..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test6/test6.c +++ /dev/null @@ -1,46 +0,0 @@ -// 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: test6.c -** -** Purpose: Tests _snwprintf with characters -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../_snwprintf.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[]) -{ - WCHAR wc = (WCHAR) 'c'; - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - - DoWCharTest(convert("foo %c"), wc, convert("foo c")); - DoCharTest(convert("foo %hc"), 'b', convert("foo b")); - DoWCharTest(convert("foo %lc"), wc, convert("foo c")); - DoWCharTest(convert("foo %Lc"), wc, convert("foo c")); - DoWCharTest(convert("foo %I64c"), wc, convert("foo c")); - DoWCharTest(convert("foo %5c"), wc, convert("foo c")); - DoWCharTest(convert("foo %.0c"), wc, convert("foo c")); - DoWCharTest(convert("foo %-5c"), wc, convert("foo c ")); - DoWCharTest(convert("foo %05c"), wc, convert("foo 0000c")); - DoWCharTest(convert("foo % c"), wc, convert("foo c")); - DoWCharTest(convert("foo %#c"), wc, convert("foo c")); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test6/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf/test6/testinfo.dat deleted file mode 100644 index 6a170cd549..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test6/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = _snwprintf -Name = Positive Test for _snwprintf -TYPE = DEFAULT -EXE1 = test6 -Description -= Tests _snwprintf with characters diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test7/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf/test7/CMakeLists.txt deleted file mode 100644 index b1a07eeaa4..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test7/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test7.c -) - -add_executable(paltest_snwprintf_test7 - ${SOURCES} -) - -add_dependencies(paltest_snwprintf_test7 coreclrpal) - -target_link_libraries(paltest_snwprintf_test7 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test7/test7.c b/src/pal/tests/palsuite/c_runtime/_snwprintf/test7/test7.c deleted file mode 100644 index 7954ff71ca..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test7/test7.c +++ /dev/null @@ -1,46 +0,0 @@ -// 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: test7.c -** -** Purpose: Tests _snwprintf with wide characters -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../_snwprintf.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[]) -{ - WCHAR wc = (WCHAR) 'c'; - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - - DoCharTest(convert("foo %C"), 'b', convert("foo b")); - DoWCharTest(convert("foo %hC"), wc, convert("foo c")); - DoCharTest(convert("foo %lC"), 'b', convert("foo b")); - DoCharTest(convert("foo %LC"), 'b', convert("foo b")); - DoCharTest(convert("foo %I64C"), 'b', convert("foo b")); - DoCharTest(convert("foo %5C"), 'b', convert("foo b")); - DoCharTest(convert("foo %.0C"), 'b', convert("foo b")); - DoCharTest(convert("foo %-5C"), 'b', convert("foo b ")); - DoCharTest(convert("foo %05C"), 'b', convert("foo 0000b")); - DoCharTest(convert("foo % C"), 'b', convert("foo b")); - DoCharTest(convert("foo %#C"), 'b', convert("foo b")); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test7/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf/test7/testinfo.dat deleted file mode 100644 index 5749539e3f..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test7/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = _snwprintf -Name = Positive Test for _snwprintf -TYPE = DEFAULT -EXE1 = test7 -Description -= Tests _snwprintf with wide characters diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test8/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf/test8/CMakeLists.txt deleted file mode 100644 index 063ee2b9b6..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test8/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test8.c -) - -add_executable(paltest_snwprintf_test8 - ${SOURCES} -) - -add_dependencies(paltest_snwprintf_test8 coreclrpal) - -target_link_libraries(paltest_snwprintf_test8 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test8/test8.c b/src/pal/tests/palsuite/c_runtime/_snwprintf/test8/test8.c deleted file mode 100644 index 91c2820076..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test8/test8.c +++ /dev/null @@ -1,53 +0,0 @@ -// 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: test8.c -** -** Purpose: Tests _snwprintf with decimal numbers -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../_snwprintf.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[]) -{ - int neg = -42; - int pos = 42; - INT64 l = 42; - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - - DoNumTest(convert("foo %d"), pos, convert("foo 42")); - DoNumTest(convert("foo %ld"), 0xFFFF, convert("foo 65535")); - DoNumTest(convert("foo %hd"), 0xFFFF, convert("foo -1")); - DoNumTest(convert("foo %Ld"), pos, convert("foo 42")); - DoI64Test(convert("foo %I64d"), l, "42", convert("foo 42")); - DoNumTest(convert("foo %3d"), pos, convert("foo 42")); - DoNumTest(convert("foo %-3d"), pos, convert("foo 42 ")); - DoNumTest(convert("foo %.1d"), pos, convert("foo 42")); - DoNumTest(convert("foo %.3d"), pos, convert("foo 042")); - DoNumTest(convert("foo %03d"), pos, convert("foo 042")); - DoNumTest(convert("foo %#d"), pos, convert("foo 42")); - DoNumTest(convert("foo %+d"), pos, convert("foo +42")); - DoNumTest(convert("foo % d"), pos, convert("foo 42")); - DoNumTest(convert("foo %+d"), neg, convert("foo -42")); - DoNumTest(convert("foo % d"), neg, convert("foo -42")); - - PAL_Terminate(); - return PASS; -} - diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test8/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf/test8/testinfo.dat deleted file mode 100644 index 6398f60183..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test8/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = _snwprintf -Name = Positive Test for _snwprintf -TYPE = DEFAULT -EXE1 = test8 -Description -= Tests _snwprintf with decimal numbers diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test9/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf/test9/CMakeLists.txt deleted file mode 100644 index 8d5e41131d..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test9/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test9.c -) - -add_executable(paltest_snwprintf_test9 - ${SOURCES} -) - -add_dependencies(paltest_snwprintf_test9 coreclrpal) - -target_link_libraries(paltest_snwprintf_test9 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test9/test9.c b/src/pal/tests/palsuite/c_runtime/_snwprintf/test9/test9.c deleted file mode 100644 index f8f994fdcc..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test9/test9.c +++ /dev/null @@ -1,53 +0,0 @@ -// 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: test9.c -** -** Purpose: Tests _snwprintf with integer numbers -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../_snwprintf.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[]) -{ - int neg = -42; - int pos = 42; - INT64 l = 42; - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - - DoNumTest(convert("foo %i"), pos, convert("foo 42")); - DoNumTest(convert("foo %li"), 0xFFFF, convert("foo 65535")); - DoNumTest(convert("foo %hi"), 0xFFFF, convert("foo -1")); - DoNumTest(convert("foo %Li"), pos, convert("foo 42")); - DoI64Test(convert("foo %I64i"), l, "42", convert("foo 42")); - DoNumTest(convert("foo %3i"), pos, convert("foo 42")); - DoNumTest(convert("foo %-3i"), pos, convert("foo 42 ")); - DoNumTest(convert("foo %.1i"), pos, convert("foo 42")); - DoNumTest(convert("foo %.3i"), pos, convert("foo 042")); - DoNumTest(convert("foo %03i"), pos, convert("foo 042")); - DoNumTest(convert("foo %#i"), pos, convert("foo 42")); - DoNumTest(convert("foo %+i"), pos, convert("foo +42")); - DoNumTest(convert("foo % i"), pos, convert("foo 42")); - DoNumTest(convert("foo %+i"), neg, convert("foo -42")); - DoNumTest(convert("foo % i"), neg, convert("foo -42")); - - PAL_Terminate(); - return PASS; -} - diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test9/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf/test9/testinfo.dat deleted file mode 100644 index 287de4a9e9..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test9/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = _snwprintf -Name = Positive Test for _snwprintf -TYPE = DEFAULT -EXE1 = test9 -Description -= Tests _snwprintf with integer numbers diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/CMakeLists.txt new file mode 100644 index 0000000000..8fe1cb60ac --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/CMakeLists.txt @@ -0,0 +1,21 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +add_subdirectory(test1) +add_subdirectory(test10) +add_subdirectory(test11) +add_subdirectory(test12) +add_subdirectory(test13) +add_subdirectory(test14) +add_subdirectory(test15) +add_subdirectory(test16) +add_subdirectory(test17) +add_subdirectory(test18) +add_subdirectory(test19) +add_subdirectory(test2) +add_subdirectory(test3) +add_subdirectory(test4) +add_subdirectory(test6) +add_subdirectory(test7) +add_subdirectory(test8) +add_subdirectory(test9) + diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/_snwprintf_s.h b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/_snwprintf_s.h new file mode 100644 index 0000000000..19d192114b --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/_snwprintf_s.h @@ -0,0 +1,199 @@ +// 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: swprintf_s.h +** +** Purpose: Containts common testing functions for swprintf_s +** +** +**==========================================================================*/ + +#ifndef ___SNWPRINTF_H__ +#define ___SNWPRINTF_H__ + +void DoWStrTest(const WCHAR *formatstr, WCHAR *param, const WCHAR *checkstr) +{ + WCHAR buf[256] = { 0 }; + + _snwprintf_s(buf, 256, _TRUNCATE, formatstr, param); + + if (memcmp(buf, checkstr, wcslen(checkstr) * 2 + 2) != 0) + { + Fail("ERROR: failed to insert wide string \"%s\" into \"%s\".\n" + "Expected \"%s\", got \"%s\".\n", convertC(param), + convertC(formatstr), convertC(checkstr), convertC(buf)); + } +} + +void DoStrTest(const WCHAR *formatstr, char *param, const WCHAR *checkstr) +{ + WCHAR buf[256] = { 0 }; + + _snwprintf_s(buf, 256, _TRUNCATE, formatstr, param); + + if (memcmp(buf, checkstr, wcslen(checkstr) * 2 + 2) != 0) + { + Fail("ERROR: failed to insert wide string \"%s\" into \"%s\".\n" + "Expected \"%s\", got \"%s\".\n", + param, convertC(formatstr), convertC(checkstr), convertC(buf)); + } +} + +void DoPointerTest(const WCHAR *formatstr, void* param, const WCHAR *checkstr1) +{ + WCHAR buf[256] = { 0 }; + + _snwprintf_s(buf, 256, _TRUNCATE, formatstr, param); + if (memcmp(buf, checkstr1, wcslen(checkstr1)*2 + 2) != 0) + { + Fail("ERROR: failed to insert pointer to %#p into \"%s\"\n" + "Expected \"%s\", got \"%s\".\n", param, convertC(formatstr), + convertC(checkstr1), convertC(buf)); + } +} + +void DoCountTest(const WCHAR *formatstr, int param, const WCHAR *checkstr) +{ + WCHAR buf[512] = { 0 }; + int n = -1; + + swprintf_s(buf, 512, formatstr, &n); + + if (n != param) + { + Fail("ERROR: Expected count parameter to resolve to %d, got %d\n", + param, n); + } + + if (memcmp(buf, checkstr, wcslen(checkstr)*2 + 2) != 0) + { + Fail("ERROR: Expected \"%s\" got \"%s\".\n", + convertC(checkstr), convertC(buf)); + } +} + +void DoShortCountTest(const WCHAR *formatstr, int param, const WCHAR *checkstr) +{ + WCHAR buf[256] = { 0 }; + short int n = -1; + + _snwprintf_s(buf, 256, _TRUNCATE, formatstr, &n); + + if (n != param) + { + Fail("ERROR: Expected count parameter to resolve to %d, got %d\n", + param, n); + } + + if (memcmp(buf, checkstr, wcslen(checkstr)*2 + 2) != 0) + { + Fail("ERROR: Expected \"%s\" got \"%s\".\n", + convertC(checkstr), convertC(buf)); + } +} + +void DoCharTest(const WCHAR *formatstr, char param, const WCHAR *checkstr) +{ + WCHAR buf[256] = { 0 }; + + _snwprintf_s(buf, 256, _TRUNCATE, formatstr, param); + if (memcmp(buf, checkstr, wcslen(checkstr)*2 + 2) != 0) + { + Fail("ERROR: failed to insert char \'%c\' (%d) into \"%s\"\n" + "Expected \"%s\" got \"%s\".\n", param, param, + convertC(formatstr), convertC(checkstr), convertC(buf)); + } +} + +void DoWCharTest(const WCHAR *formatstr, WCHAR param, const WCHAR *checkstr) +{ + WCHAR buf[256] = { 0 }; + + _snwprintf_s(buf, 256, _TRUNCATE, formatstr, param); + if (memcmp(buf, checkstr, wcslen(checkstr)*2 + 2) != 0) + { + Fail("ERROR: failed to insert wide char \'%c\' (%d) into \"%s\"\n" + "Expected \"%s\" got \"%s\".\n", (char) param, param, + convertC(formatstr), convertC(checkstr), convertC(buf)); + } +} + +void DoNumTest(const WCHAR *formatstr, int value, const WCHAR *checkstr) +{ + WCHAR buf[256] = { 0 }; + + _snwprintf_s(buf, 256, _TRUNCATE, formatstr, value); + if (memcmp(buf, checkstr, wcslen(checkstr)* 2 + 2) != 0) + { + Fail("ERROR: failed to insert %#x into \"%s\"\n" + "Expected \"%s\" got \"%s\".\n", value, convertC(formatstr), + convertC(checkstr), convertC(buf)); + } +} + + +void DoI64Test(const WCHAR *formatstr, INT64 param, char *paramdesc, + const WCHAR *checkstr1) +{ + WCHAR buf[256] = { 0 }; + + _snwprintf_s(buf, 256, _TRUNCATE, formatstr, param); + if (memcmp(buf, checkstr1, wcslen(checkstr1)*2 + 2) != 0) + { + Fail("ERROR: failed to insert %s into \"%s\"\n" + "Expected \"%s\", got \"%s\".\n", paramdesc, + convertC(formatstr), convertC(checkstr1), convertC(buf)); + } +} + +void DoDoubleTest(const WCHAR *formatstr, double value, const WCHAR *checkstr1, + const WCHAR *checkstr2) +{ + WCHAR buf[256] = { 0 }; + + _snwprintf_s(buf, 256, _TRUNCATE, formatstr, value); + if (memcmp(buf, checkstr1, wcslen(checkstr1)*2 + 2) != 0 && + memcmp(buf, checkstr2, wcslen(checkstr2)*2 + 2) != 0) + { + Fail("ERROR: failed to insert %f into \"%s\"\n" + "Expected \"%s\" or \"%s\", got \"%s\".\n", + value, convertC(formatstr), convertC(checkstr1), + convertC(checkstr2), convertC(buf)); + } +} + +void DoArgumentPrecTest(const WCHAR *formatstr, int precision, void *param, + char *paramstr, const WCHAR *checkstr1, const WCHAR *checkstr2) +{ + WCHAR buf[256]; + + _snwprintf_s(buf, 256, _TRUNCATE, formatstr, precision, param); + if (memcmp(buf, checkstr1, wcslen(checkstr1) + 2) != 0 && + memcmp(buf, checkstr2, wcslen(checkstr2) + 2) != 0) + { + Fail("ERROR: failed to insert %s into \"%s\" with precision %d\n" + "Expected \"%s\" or \"%s\", got \"%s\".\n", + paramstr, convertC(formatstr), precision, + convertC(checkstr1), convertC(checkstr2) ,convertC(buf)); + } +} + +void DoArgumentPrecDoubleTest(const WCHAR *formatstr, int precision, double param, + const WCHAR *checkstr) +{ + WCHAR buf[256]; + + _snwprintf_s(buf, 256, _TRUNCATE, formatstr, precision, param); + if (memcmp(buf, checkstr, wcslen(checkstr) + 2) != 0) + { + Fail("ERROR: failed to insert %f into \"%s\" with precision %d\n" + "Expected \"%s\", got \"%s\".\n", param, convertC(formatstr), + precision, convertC(checkstr), convertC(buf)); + } +} + +#endif + diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test1/CMakeLists.txt new file mode 100644 index 0000000000..eac86f30e4 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test1/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test1.cpp +) + +add_executable(paltest_snwprintf_test1 + ${SOURCES} +) + +add_dependencies(paltest_snwprintf_test1 coreclrpal) + +target_link_libraries(paltest_snwprintf_test1 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test1/test1.cpp b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test1/test1.cpp new file mode 100644 index 0000000000..ba85103cb1 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test1/test1.cpp @@ -0,0 +1,62 @@ +// 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: test1.c +** +** Purpose: General test to see if swprintf_s works correctly +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../_snwprintf_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[]) +{ + WCHAR *checkstr; + WCHAR buf[256] = { 0 }; + int ret; + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + checkstr = convert("hello world"); + _snwprintf_s(buf, 256, _TRUNCATE, checkstr); + if (memcmp(checkstr, buf, wcslen(checkstr)*2+2) != 0) + { + Fail("ERROR: Expected \"%s\", got \"%s\"\n", + convertC(checkstr), convertC(buf)); + } + + _snwprintf_s(buf, 256, _TRUNCATE, convert("xxxxxxxxxxxxxxxxx")); + ret = _snwprintf_s(buf, 8, _TRUNCATE, checkstr); + if ((memcmp(checkstr, buf, 14) != 0) || (buf[7] != 0)) + { + Fail("ERROR: Expected \"%8s\", got \"%8s\"\n", + convertC(checkstr), convertC(buf)); + } + if (ret >= 0) + { + Fail("ERROR: Expected negative return value, got %d.\n", ret); + } + if (buf[8] != (WCHAR) 'x') + { + Fail("ERROR: buffer overflow using \"%s\" with length 8.\n", + convertC(checkstr)); + } + + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test1/testinfo.dat new file mode 100644 index 0000000000..96d7914ce0 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test1/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = swprintf_s +Name = Positive Test for swprintf_s +TYPE = DEFAULT +EXE1 = test1 +Description += General test to see if swprintf_s works correctly diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test10/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test10/CMakeLists.txt new file mode 100644 index 0000000000..82ee739587 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test10/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test10.cpp +) + +add_executable(paltest_snwprintf_test10 + ${SOURCES} +) + +add_dependencies(paltest_snwprintf_test10 coreclrpal) + +target_link_libraries(paltest_snwprintf_test10 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test10/test10.cpp b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test10/test10.cpp new file mode 100644 index 0000000000..298f82b002 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test10/test10.cpp @@ -0,0 +1,54 @@ +// 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: test10.c +** +** Purpose: Tests swprintf_s with octal numbers +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../_snwprintf_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[]) +{ + int neg = -42; + int pos = 42; + INT64 l = 42; + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + + DoNumTest(convert("foo %o"), pos, convert("foo 52")); + DoNumTest(convert("foo %lo"), 0xFFFF, convert("foo 177777")); + DoNumTest(convert("foo %ho"), 0xFFFF, convert("foo 177777")); + DoNumTest(convert("foo %Lo"), pos, convert("foo 52")); + DoI64Test(convert("foo %I64o"), l, "42", convert("foo 52")); + DoNumTest(convert("foo %3o"), pos, convert("foo 52")); + DoNumTest(convert("foo %-3o"), pos, convert("foo 52 ")); + DoNumTest(convert("foo %.1o"), pos, convert("foo 52")); + DoNumTest(convert("foo %.3o"), pos, convert("foo 052")); + DoNumTest(convert("foo %03o"), pos, convert("foo 052")); + DoNumTest(convert("foo %#o"), pos, convert("foo 052")); + DoNumTest(convert("foo %+o"), pos, convert("foo 52")); + DoNumTest(convert("foo % o"), pos, convert("foo 52")); + DoNumTest(convert("foo %+o"), neg, convert("foo 37777777726")); + DoNumTest(convert("foo % o"), neg, convert("foo 37777777726")); + + + PAL_Terminate(); + return PASS; +} + diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test10/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test10/testinfo.dat new file mode 100644 index 0000000000..887bbf76c8 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test10/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = swprintf_s +Name = Positive Test for swprintf_s +TYPE = DEFAULT +EXE1 = test10 +Description += Tests swprintf_s with octal numbers diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test11/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test11/CMakeLists.txt new file mode 100644 index 0000000000..f7d7845571 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test11/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test11.cpp +) + +add_executable(paltest_snwprintf_test11 + ${SOURCES} +) + +add_dependencies(paltest_snwprintf_test11 coreclrpal) + +target_link_libraries(paltest_snwprintf_test11 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test11/test11.cpp b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test11/test11.cpp new file mode 100644 index 0000000000..519668791b --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test11/test11.cpp @@ -0,0 +1,54 @@ +// 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: test11.c +** +** Purpose: Tests swprintf_s with unsigned numbers +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../_snwprintf_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[]) +{ + int neg = -42; + int pos = 42; + INT64 l = 42; + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + + DoNumTest(convert("foo %u"), pos, convert("foo 42")); + DoNumTest(convert("foo %lu"), 0xFFFF, convert("foo 65535")); + DoNumTest(convert("foo %hu"), 0xFFFF, convert("foo 65535")); + DoNumTest(convert("foo %Lu"), pos, convert("foo 42")); + DoI64Test(convert("foo %I64u"), l, "42", convert("foo 42")); + DoNumTest(convert("foo %3u"), pos, convert("foo 42")); + DoNumTest(convert("foo %-3u"), pos, convert("foo 42 ")); + DoNumTest(convert("foo %.1u"), pos, convert("foo 42")); + DoNumTest(convert("foo %.3u"), pos, convert("foo 042")); + DoNumTest(convert("foo %03u"), pos, convert("foo 042")); + DoNumTest(convert("foo %#u"), pos, convert("foo 42")); + DoNumTest(convert("foo %+u"), pos, convert("foo 42")); + DoNumTest(convert("foo % u"), pos, convert("foo 42")); + DoNumTest(convert("foo %+u"), neg, convert("foo 4294967254")); + DoNumTest(convert("foo % u"), neg, convert("foo 4294967254")); + + + PAL_Terminate(); + return PASS; +} + diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test11/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test11/testinfo.dat new file mode 100644 index 0000000000..3bda85e335 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test11/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = swprintf_s +Name = Positive Test for swprintf_s +TYPE = DEFAULT +EXE1 = test11 +Description += Tests swprintf_s with unsigned numbers diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test12/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test12/CMakeLists.txt new file mode 100644 index 0000000000..5b926fb548 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test12/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test12.cpp +) + +add_executable(paltest_snwprintf_test12 + ${SOURCES} +) + +add_dependencies(paltest_snwprintf_test12 coreclrpal) + +target_link_libraries(paltest_snwprintf_test12 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test12/test12.cpp b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test12/test12.cpp new file mode 100644 index 0000000000..52780aff0a --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test12/test12.cpp @@ -0,0 +1,54 @@ +// 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: test12.c +** +** Purpose: Tests swprintf_s with hex numbers (lowercase) +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../_snwprintf_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[]) +{ + int neg = -42; + int pos = 0x1234ab; + INT64 l = I64(0x1234567887654321); + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + + DoNumTest(convert("foo %x"), pos, convert("foo 1234ab")); + DoNumTest(convert("foo %lx"), pos, convert("foo 1234ab")); + DoNumTest(convert("foo %hx"), pos, convert("foo 34ab")); + DoNumTest(convert("foo %Lx"), pos, convert("foo 1234ab")); + DoI64Test(convert("foo %I64x"), l, "0x1234567887654321", + convert("foo 1234567887654321")); + DoNumTest(convert("foo %7x"), pos, convert("foo 1234ab")); + DoNumTest(convert("foo %-7x"), pos, convert("foo 1234ab ")); + DoNumTest(convert("foo %.1x"), pos, convert("foo 1234ab")); + DoNumTest(convert("foo %.7x"), pos, convert("foo 01234ab")); + DoNumTest(convert("foo %07x"), pos, convert("foo 01234ab")); + DoNumTest(convert("foo %#x"), pos, convert("foo 0x1234ab")); + DoNumTest(convert("foo %+x"), pos, convert("foo 1234ab")); + DoNumTest(convert("foo % x"), pos, convert("foo 1234ab")); + DoNumTest(convert("foo %+x"), neg, convert("foo ffffffd6")); + DoNumTest(convert("foo % x"), neg, convert("foo ffffffd6")); + + PAL_Terminate(); + return PASS; +} + diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test12/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test12/testinfo.dat new file mode 100644 index 0000000000..d808a3b8f4 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test12/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = swprintf_s +Name = Positive Test for swprintf_s +TYPE = DEFAULT +EXE1 = test12 +Description += Tests swprintf_s with hex numbers (lowercase) diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test13/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test13/CMakeLists.txt new file mode 100644 index 0000000000..52a3c75a15 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test13/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test13.cpp +) + +add_executable(paltest_snwprintf_test13 + ${SOURCES} +) + +add_dependencies(paltest_snwprintf_test13 coreclrpal) + +target_link_libraries(paltest_snwprintf_test13 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test13/test13.cpp b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test13/test13.cpp new file mode 100644 index 0000000000..fa948b3a1b --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test13/test13.cpp @@ -0,0 +1,54 @@ +// 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: test13.c +** +** Purpose: Tests swprintf_s with hex numbers (uppercase) +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../_snwprintf_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[]) +{ + int neg = -42; + int pos = 0x1234ab; + INT64 l = I64(0x1234567887654321); + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + + DoNumTest(convert("foo %X"), pos, convert("foo 1234AB")); + DoNumTest(convert("foo %lX"), pos, convert("foo 1234AB")); + DoNumTest(convert("foo %hX"), pos, convert("foo 34AB")); + DoNumTest(convert("foo %LX"), pos, convert("foo 1234AB")); + DoI64Test(convert("foo %I64X"), l, "0x1234567887654321", + convert("foo 1234567887654321")); + DoNumTest(convert("foo %7X"), pos, convert("foo 1234AB")); + DoNumTest(convert("foo %-7X"), pos, convert("foo 1234AB ")); + DoNumTest(convert("foo %.1X"), pos, convert("foo 1234AB")); + DoNumTest(convert("foo %.7X"), pos, convert("foo 01234AB")); + DoNumTest(convert("foo %07X"), pos, convert("foo 01234AB")); + DoNumTest(convert("foo %#X"), pos, convert("foo 0X1234AB")); + DoNumTest(convert("foo %+X"), pos, convert("foo 1234AB")); + DoNumTest(convert("foo % X"), pos, convert("foo 1234AB")); + DoNumTest(convert("foo %+X"), neg, convert("foo FFFFFFD6")); + DoNumTest(convert("foo % X"), neg, convert("foo FFFFFFD6")); + + PAL_Terminate(); + return PASS; +} + diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test13/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test13/testinfo.dat new file mode 100644 index 0000000000..2e5800ec31 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test13/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = swprintf_s +Name = Positive Test for swprintf_s +TYPE = DEFAULT +EXE1 = test13 +Description += Tests swprintf_s with hex numbers (uppercase) diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test14/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test14/CMakeLists.txt new file mode 100644 index 0000000000..d557a30b42 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_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_snwprintf_test14 + ${SOURCES} +) + +add_dependencies(paltest_snwprintf_test14 coreclrpal) + +target_link_libraries(paltest_snwprintf_test14 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test14/test14.cpp b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test14/test14.cpp new file mode 100644 index 0000000000..aea289d1a1 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test14/test14.cpp @@ -0,0 +1,66 @@ +// 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: Tests swprintf_s with exponential format doubles (lowercase) +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../_snwprintf_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/_snwprintf_s/test14/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test14/testinfo.dat new file mode 100644 index 0000000000..25bd5099c9 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test14/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = swprintf_s +Name = Positive Test for swprintf_s +TYPE = DEFAULT +EXE1 = test14 +Description += Tests swprintf_s with exponential format doubles (lowercase) diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test15/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test15/CMakeLists.txt new file mode 100644 index 0000000000..2e5ee362fc --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test15/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test15.cpp +) + +add_executable(paltest_snwprintf_test15 + ${SOURCES} +) + +add_dependencies(paltest_snwprintf_test15 coreclrpal) + +target_link_libraries(paltest_snwprintf_test15 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test15/test15.cpp b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test15/test15.cpp new file mode 100644 index 0000000000..14db14b498 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test15/test15.cpp @@ -0,0 +1,67 @@ +// 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: test15.c +** +** Purpose: Tests swprintf_s with exponential format doubles (uppercase) +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../_snwprintf_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/_snwprintf_s/test15/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test15/testinfo.dat new file mode 100644 index 0000000000..95d90e82e7 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test15/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = swprintf_s +Name = Positive Test for swprintf_s +TYPE = DEFAULT +EXE1 = test15 +Description += Tests swprintf_s with exponential format doubles (uppercase) diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test16/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test16/CMakeLists.txt new file mode 100644 index 0000000000..f4ce409dcb --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test16/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test16.cpp +) + +add_executable(paltest_snwprintf_test16 + ${SOURCES} +) + +add_dependencies(paltest_snwprintf_test16 coreclrpal) + +target_link_libraries(paltest_snwprintf_test16 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test16/test16.cpp b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test16/test16.cpp new file mode 100644 index 0000000000..4d9a717f24 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test16/test16.cpp @@ -0,0 +1,65 @@ +// 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: test16.c +** +** Purpose: Tests swprintf_s with decimal point format doubles +** +** +**==========================================================================*/ + + +#include <palsuite.h> +#include "../_snwprintf_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 = 2560.001; + double neg = -2560.001; + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + + DoDoubleTest(convert("foo %f"), val, convert("foo 2560.001000"), + convert("foo 2560.001000")); + DoDoubleTest(convert("foo %lf"), val, convert("foo 2560.001000"), + convert("foo 2560.001000")); + DoDoubleTest(convert("foo %hf"), val, convert("foo 2560.001000"), + convert("foo 2560.001000")); + DoDoubleTest(convert("foo %Lf"), val, convert("foo 2560.001000"), + convert("foo 2560.001000")); + DoDoubleTest(convert("foo %I64f"), val, convert("foo 2560.001000"), + convert("foo 2560.001000")); + DoDoubleTest(convert("foo %12f"), val, convert("foo 2560.001000"), + convert("foo 2560.001000")); + DoDoubleTest(convert("foo %-12f"), val, convert("foo 2560.001000 "), + convert("foo 2560.001000 ")); + DoDoubleTest(convert("foo %.1f"), val, convert("foo 2560.0"), + convert("foo 2560.0")); + DoDoubleTest(convert("foo %.8f"), val, convert("foo 2560.00100000"), + convert("foo 2560.00100000")); + DoDoubleTest(convert("foo %012f"), val, convert("foo 02560.001000"), + convert("foo 02560.001000")); + DoDoubleTest(convert("foo %#f"), val, convert("foo 2560.001000"), + convert("foo 2560.001000")); + DoDoubleTest(convert("foo %+f"), val, convert("foo +2560.001000"), + convert("foo +2560.001000")); + DoDoubleTest(convert("foo % f"), val, convert("foo 2560.001000"), + convert("foo 2560.001000")); + DoDoubleTest(convert("foo %+f"), neg, convert("foo -2560.001000"), + convert("foo -2560.001000")); + DoDoubleTest(convert("foo % f"), neg, convert("foo -2560.001000"), + convert("foo -2560.001000")); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test16/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test16/testinfo.dat new file mode 100644 index 0000000000..b81c847c69 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test16/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = swprintf_s +Name = Positive Test for swprintf_s +TYPE = DEFAULT +EXE1 = test16 +Description += Tests swprintf_s with decimal point format doubles diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test17/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test17/CMakeLists.txt new file mode 100644 index 0000000000..159e15dafe --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test17/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test17.cpp +) + +add_executable(paltest_snwprintf_test17 + ${SOURCES} +) + +add_dependencies(paltest_snwprintf_test17 coreclrpal) + +target_link_libraries(paltest_snwprintf_test17 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test17/test17.cpp b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test17/test17.cpp new file mode 100644 index 0000000000..6af1815b85 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test17/test17.cpp @@ -0,0 +1,68 @@ +// 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: test17.c +** +** Purpose: Tests swprintf_s with compact format doubles (lowercase) +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../_snwprintf_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 = 2560.001; + double neg = -2560.001; + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + + DoDoubleTest(convert("foo %g"), val, convert("foo 2560"), + convert("foo 2560")); + DoDoubleTest(convert("foo %lg"), val, convert("foo 2560"), + convert("foo 2560")); + DoDoubleTest(convert("foo %hg"), val, convert("foo 2560"), + convert("foo 2560")); + DoDoubleTest(convert("foo %Lg"), val, convert("foo 2560"), + convert("foo 2560")); + DoDoubleTest(convert("foo %I64g"), val, convert("foo 2560"), + convert("foo 2560")); + DoDoubleTest(convert("foo %5g"), val, convert("foo 2560"), + convert("foo 2560")); + DoDoubleTest(convert("foo %-5g"), val, convert("foo 2560 "), + convert("foo 2560 ")); + DoDoubleTest(convert("foo %.1g"), val, convert("foo 3e+003"), + convert("foo 3e+03")); + DoDoubleTest(convert("foo %.2g"), val, convert("foo 2.6e+003"), + convert("foo 2.6e+03")); + DoDoubleTest(convert("foo %.12g"), val, convert("foo 2560.001"), + convert("foo 2560.001")); + DoDoubleTest(convert("foo %06g"), val, convert("foo 002560"), + convert("foo 002560")); + DoDoubleTest(convert("foo %#g"), val, convert("foo 2560.00"), + convert("foo 2560.00")); + DoDoubleTest(convert("foo %+g"), val, convert("foo +2560"), + convert("foo +2560")); + DoDoubleTest(convert("foo % g"), val, convert("foo 2560"), + convert("foo 2560")); + DoDoubleTest(convert("foo %+g"), neg, convert("foo -2560"), + convert("foo -2560")); + DoDoubleTest(convert("foo % g"), neg, convert("foo -2560"), + convert("foo -2560")); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test17/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test17/testinfo.dat new file mode 100644 index 0000000000..d64366702a --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test17/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = swprintf_s +Name = Positive Test for swprintf_s +TYPE = DEFAULT +EXE1 = test17 +Description += Tests swprintf_s with compact format doubles (lowercase) diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test18/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test18/CMakeLists.txt new file mode 100644 index 0000000000..5964e849a4 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test18/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test18.cpp +) + +add_executable(paltest_snwprintf_test18 + ${SOURCES} +) + +add_dependencies(paltest_snwprintf_test18 coreclrpal) + +target_link_libraries(paltest_snwprintf_test18 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test18/test18.cpp b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test18/test18.cpp new file mode 100644 index 0000000000..020a885090 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test18/test18.cpp @@ -0,0 +1,69 @@ +// 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: test18.c +** +** Purpose: Tests swprintf_s with compact format doubles (uppercase) +** +** +**==========================================================================*/ + + + + +#include <palsuite.h> +#include "../_snwprintf_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 = 2560.001; + double neg = -2560.001; + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + + DoDoubleTest(convert("foo %G"), val, convert("foo 2560"), + convert("foo 2560")); + DoDoubleTest(convert("foo %lG"), val, convert("foo 2560"), + convert("foo 2560")); + DoDoubleTest(convert("foo %hG"), val, convert("foo 2560"), + convert("foo 2560")); + DoDoubleTest(convert("foo %LG"), val, convert("foo 2560"), + convert("foo 2560")); + DoDoubleTest(convert("foo %I64G"), val, convert("foo 2560"), + convert("foo 2560")); + DoDoubleTest(convert("foo %5G"), val, convert("foo 2560"), + convert("foo 2560")); + DoDoubleTest(convert("foo %-5G"), val, convert("foo 2560 "), + convert("foo 2560 ")); + DoDoubleTest(convert("foo %.1G"), val, convert("foo 3E+003"), + convert("foo 3E+03")); + DoDoubleTest(convert("foo %.2G"), val, convert("foo 2.6E+003"), + convert("foo 2.6E+03")); + DoDoubleTest(convert("foo %.12G"), val, convert("foo 2560.001"), + convert("foo 2560.001")); + DoDoubleTest(convert("foo %06G"), val, convert("foo 002560"), + convert("foo 002560")); + DoDoubleTest(convert("foo %#G"), val, convert("foo 2560.00"), + convert("foo 2560.00")); + DoDoubleTest(convert("foo %+G"), val, convert("foo +2560"), + convert("foo +2560")); + DoDoubleTest(convert("foo % G"), val, convert("foo 2560"), + convert("foo 2560")); + DoDoubleTest(convert("foo %+G"), neg, convert("foo -2560"), + convert("foo -2560")); + DoDoubleTest(convert("foo % G"), neg, convert("foo -2560"), + convert("foo -2560")); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test18/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test18/testinfo.dat new file mode 100644 index 0000000000..dfc2cd5f43 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test18/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = swprintf_s +Name = Positive Test for swprintf_s +TYPE = DEFAULT +EXE1 = test18 +Description += Tests swprintf_s with compact format doubles (uppercase) diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test19/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test19/CMakeLists.txt new file mode 100644 index 0000000000..5d84847ec1 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test19/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test19.cpp +) + +add_executable(paltest_snwprintf_test19 + ${SOURCES} +) + +add_dependencies(paltest_snwprintf_test19 coreclrpal) + +target_link_libraries(paltest_snwprintf_test19 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test19/test19.cpp b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test19/test19.cpp new file mode 100644 index 0000000000..d335d1d10c --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test19/test19.cpp @@ -0,0 +1,82 @@ +// 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: test19.c +** +** Purpose: Tests swprintf_s with argument specified precision +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../_snwprintf_s.h" + +int __cdecl main(int argc, char *argv[]) +{ + int n = -1; + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + DoArgumentPrecTest(convert("%.*s"), 2, (void*)convert("bar"), "bar", + convert("ba"), convert("ba")); + DoArgumentPrecTest(convert("%.*S"), 2, (void*)"bar", "bar", + convert("ba"), convert("ba")); + DoArgumentPrecTest(convert("%.*c"), 0, (void*)'a', "a", + convert("a"), convert("a")); + DoArgumentPrecTest(convert("%.*c"), 4, (void*)'a', "a", + convert("a"), convert("a")); + DoArgumentPrecTest(convert("%.*C"), 0, (void*)'a', "a", + convert("a"), convert("a")); + DoArgumentPrecTest(convert("%.*C"), 4, (void*)'a', "a", + convert("a"), convert("a")); + DoArgumentPrecTest(convert("%.*d"), 1, (void*)42, "42", + convert("42"), convert("42")); + DoArgumentPrecTest(convert("%.*d"), 3, (void*)42, "42", + convert("042"), convert("042")); + DoArgumentPrecTest(convert("%.*i"), 1, (void*)42, "42", + convert("42"), convert("42")); + DoArgumentPrecTest(convert("%.*i"), 3, (void*)42, "42", + convert("042"), convert("042")); + DoArgumentPrecTest(convert("%.*o"), 1, (void*)42, "42", + convert("52"), convert("52")); + DoArgumentPrecTest(convert("%.*o"), 3, (void*)42, "42", + convert("052"), convert("052")); + DoArgumentPrecTest(convert("%.*u"), 1, (void*)42, "42", + convert("42"), convert("42")); + DoArgumentPrecTest(convert("%.*u"), 3, (void*)42, "42", + convert("042"), convert("042")); + DoArgumentPrecTest(convert("%.*x"), 1, (void*)0x42, "0x42", + convert("42"), convert("42")); + DoArgumentPrecTest(convert("%.*x"), 3, (void*)0x42, "0x42", + convert("042"), convert("042")); + DoArgumentPrecTest(convert("%.*X"), 1, (void*)0x42, "0x42", + convert("42"), convert("42")); + DoArgumentPrecTest(convert("%.*X"), 3, (void*)0x42, "0x42", + convert("042"), convert("042")); + DoArgumentPrecDoubleTest(convert("%.*e"), 1, 2.01, convert("2.0e+000")); + DoArgumentPrecDoubleTest(convert("%.*e"), 3, 2.01, convert("2.010e+000")); + DoArgumentPrecDoubleTest(convert("%.*E"), 1, 2.01, convert("2.0E+000")); + DoArgumentPrecDoubleTest(convert("%.*E"), 3, 2.01, convert("2.010E+000")); + DoArgumentPrecDoubleTest(convert("%.*f"), 1, 2.01, convert("2.0")); + DoArgumentPrecDoubleTest(convert("%.*f"), 3, 2.01, convert("2.010")); + DoArgumentPrecDoubleTest(convert("%.*g"), 1, 256.01, convert("3e+002")); + DoArgumentPrecDoubleTest(convert("%.*g"), 3, 256.01, convert("256")); + DoArgumentPrecDoubleTest(convert("%.*g"), 4, 256.01, convert("256")); + DoArgumentPrecDoubleTest(convert("%.*g"), 6, 256.01, convert("256.01")); + DoArgumentPrecDoubleTest(convert("%.*G"), 1, 256.01, convert("3E+002")); + DoArgumentPrecDoubleTest(convert("%.*G"), 3, 256.01, convert("256")); + DoArgumentPrecDoubleTest(convert("%.*G"), 4, 256.01, convert("256")); + DoArgumentPrecDoubleTest(convert("%.*G"), 6, 256.01, convert("256.01")); + + PAL_Terminate(); + return PASS; + +} diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test19/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test19/testinfo.dat new file mode 100644 index 0000000000..95269cdd39 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test19/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = swprintf_s +Name = Positive Test for swprintf_s +TYPE = DEFAULT +EXE1 = test19 +Description += Tests swprintf_s with argument specified precision diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test2/CMakeLists.txt new file mode 100644 index 0000000000..ea33d48bd5 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test2/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test2.cpp +) + +add_executable(paltest_snwprintf_test2 + ${SOURCES} +) + +add_dependencies(paltest_snwprintf_test2 coreclrpal) + +target_link_libraries(paltest_snwprintf_test2 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test2/test2.cpp b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test2/test2.cpp new file mode 100644 index 0000000000..86bfdc9839 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test2/test2.cpp @@ -0,0 +1,44 @@ +// 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: test2.c +** +** Purpose:Tests swprintf_s with strings +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../_snwprintf_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[]) +{ + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + DoWStrTest(convert("foo %s"), convert("bar"), convert("foo bar")); + DoStrTest(convert("foo %hs"), "bar", convert("foo bar")); + DoWStrTest(convert("foo %ls"), convert("bar"), convert("foo bar")); + DoWStrTest(convert("foo %ws"), convert("bar"), convert("foo bar")); + DoWStrTest(convert("foo %Ls"), convert("bar"), convert("foo bar")); + DoWStrTest(convert("foo %I64s"), convert("bar"), convert("foo bar")); + DoWStrTest(convert("foo %5s"), convert("bar"), convert("foo bar")); + DoWStrTest(convert("foo %.2s"), convert("bar"), convert("foo ba")); + DoWStrTest(convert("foo %5.2s"), convert("bar"), convert("foo ba")); + DoWStrTest(convert("foo %-5s"), convert("bar"), convert("foo bar ")); + DoWStrTest(convert("foo %05s"), convert("bar"), convert("foo 00bar")); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test2/testinfo.dat new file mode 100644 index 0000000000..88f1981609 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test2/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = swprintf_s +Name = Positive Test for swprintf_s +TYPE = DEFAULT +EXE1 = test2 +Description += Tests swprintf_s with strings diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test3/CMakeLists.txt new file mode 100644 index 0000000000..5095b1a12e --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test3/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test3.cpp +) + +add_executable(paltest_snwprintf_test3 + ${SOURCES} +) + +add_dependencies(paltest_snwprintf_test3 coreclrpal) + +target_link_libraries(paltest_snwprintf_test3 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test3/test3.cpp b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test3/test3.cpp new file mode 100644 index 0000000000..f6db6f265d --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test3/test3.cpp @@ -0,0 +1,44 @@ +// 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: test3.c +** +** Purpose: Tests swprintf_s with wide strings +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../_snwprintf_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[]) +{ + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + DoStrTest(convert("foo %S"), "bar", convert("foo bar")); + DoStrTest(convert("foo %hS"), "bar", convert("foo bar")); + DoWStrTest(convert("foo %lS"), convert("bar"), convert("foo bar")); + DoWStrTest(convert("foo %wS"), convert("bar"), convert("foo bar")); + DoStrTest(convert("foo %LS"), "bar", convert("foo bar")); + DoStrTest(convert("foo %I64S"), "bar", convert("foo bar")); + DoStrTest(convert("foo %5S"), "bar", convert("foo bar")); + DoStrTest(convert("foo %.2S"), "bar", convert("foo ba")); + DoStrTest(convert("foo %5.2S"), "bar", convert("foo ba")); + DoStrTest(convert("foo %-5S"), "bar", convert("foo bar ")); + DoStrTest(convert("foo %05S"), "bar", convert("foo 00bar")); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test3/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test3/testinfo.dat new file mode 100644 index 0000000000..5ed59e61ac --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test3/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = swprintf_s +Name = Positive Test for swprintf_s +TYPE = DEFAULT +EXE1 = test3 +Description += Tests swprintf_s with wide strings diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test4/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test4/CMakeLists.txt new file mode 100644 index 0000000000..9cf81ea1bd --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test4/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test4.cpp +) + +add_executable(paltest_snwprintf_test4 + ${SOURCES} +) + +add_dependencies(paltest_snwprintf_test4 coreclrpal) + +target_link_libraries(paltest_snwprintf_test4 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test4/test4.cpp b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test4/test4.cpp new file mode 100644 index 0000000000..02d4781bd3 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test4/test4.cpp @@ -0,0 +1,71 @@ +// 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: test4.c +** +** Purpose: Tests swprintf_s with pointers +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../_snwprintf_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[]) +{ + void *ptr = (void*) 0x123456; + INT64 lptr = I64(0x1234567887654321); + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + +/* +** Run only on 64 bit platforms +*/ +#if defined(BIT64) && defined(PLATFORM_UNIX) + Trace("Testing for 64 Bit Platforms \n"); + DoPointerTest(convert("%p"), NULL, convert("0000000000000000")); + DoPointerTest(convert("%p"), ptr, convert("0000000000123456")); + DoPointerTest(convert("%17p"), ptr, convert(" 0000000000123456")); + DoPointerTest(convert("%17p"), ptr, convert(" 0000000000123456")); + DoPointerTest(convert("%-17p"), ptr, convert("0000000000123456 ")); + DoPointerTest(convert("%+p"), ptr, convert("0000000000123456")); + DoPointerTest(convert("% p"), ptr, convert("0000000000123456")); + DoPointerTest(convert("%#p"), ptr, convert("0X0000000000123456")); + DoPointerTest(convert("%lp"), ptr, convert("00123456")); + DoPointerTest(convert("%hp"), ptr, convert("00003456")); + DoPointerTest(convert("%Lp"), ptr, convert("00123456")); + DoI64Test(convert("%I64p"), lptr, "1234567887654321", + convert("1234567887654321")); +#else + Trace("Testing for Non 64 Bit Platforms \n"); + DoPointerTest(convert("%p"), NULL, convert("00000000")); + DoPointerTest(convert("%p"), ptr, convert("00123456")); + DoPointerTest(convert("%9p"), ptr, convert(" 00123456")); + DoPointerTest(convert("%09p"), ptr, convert(" 00123456")); + DoPointerTest(convert("%-9p"), ptr, convert("00123456 ")); + DoPointerTest(convert("%+p"), ptr, convert("00123456")); + DoPointerTest(convert("% p"), ptr, convert("00123456")); + DoPointerTest(convert("%#p"), ptr, convert("0X00123456")); + DoPointerTest(convert("%lp"), ptr, convert("00123456")); + DoPointerTest(convert("%hp"), ptr, convert("00003456")); + DoPointerTest(convert("%Lp"), ptr, convert("00123456")); + DoI64Test(convert("%I64p"), lptr, "1234567887654321", + convert("1234567887654321")); +#endif + + PAL_Terminate(); + return PASS; +} + diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test4/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test4/testinfo.dat new file mode 100644 index 0000000000..2b35f2d0d3 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test4/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = swprintf_s +Name = Positive Test for swprintf_s +TYPE = DEFAULT +EXE1 = test4 +Description += Tests swprintf_s with pointers diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test6/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test6/CMakeLists.txt new file mode 100644 index 0000000000..4996c7716f --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test6/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test6.cpp +) + +add_executable(paltest_snwprintf_test6 + ${SOURCES} +) + +add_dependencies(paltest_snwprintf_test6 coreclrpal) + +target_link_libraries(paltest_snwprintf_test6 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test6/test6.cpp b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test6/test6.cpp new file mode 100644 index 0000000000..576e061acd --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test6/test6.cpp @@ -0,0 +1,46 @@ +// 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: test6.c +** +** Purpose: Tests swprintf_s with characters +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../_snwprintf_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[]) +{ + WCHAR wc = (WCHAR) 'c'; + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + + DoWCharTest(convert("foo %c"), wc, convert("foo c")); + DoCharTest(convert("foo %hc"), 'b', convert("foo b")); + DoWCharTest(convert("foo %lc"), wc, convert("foo c")); + DoWCharTest(convert("foo %Lc"), wc, convert("foo c")); + DoWCharTest(convert("foo %I64c"), wc, convert("foo c")); + DoWCharTest(convert("foo %5c"), wc, convert("foo c")); + DoWCharTest(convert("foo %.0c"), wc, convert("foo c")); + DoWCharTest(convert("foo %-5c"), wc, convert("foo c ")); + DoWCharTest(convert("foo %05c"), wc, convert("foo 0000c")); + DoWCharTest(convert("foo % c"), wc, convert("foo c")); + DoWCharTest(convert("foo %#c"), wc, convert("foo c")); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test6/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test6/testinfo.dat new file mode 100644 index 0000000000..d8db7f8335 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test6/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = swprintf_s +Name = Positive Test for swprintf_s +TYPE = DEFAULT +EXE1 = test6 +Description += Tests swprintf_s with characters diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test7/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test7/CMakeLists.txt new file mode 100644 index 0000000000..0e55fbf4d7 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test7/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test7.cpp +) + +add_executable(paltest_snwprintf_test7 + ${SOURCES} +) + +add_dependencies(paltest_snwprintf_test7 coreclrpal) + +target_link_libraries(paltest_snwprintf_test7 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test7/test7.cpp b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test7/test7.cpp new file mode 100644 index 0000000000..54dd32b433 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test7/test7.cpp @@ -0,0 +1,46 @@ +// 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: test7.c +** +** Purpose: Tests swprintf_s with wide characters +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../_snwprintf_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[]) +{ + WCHAR wc = (WCHAR) 'c'; + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + + DoCharTest(convert("foo %C"), 'b', convert("foo b")); + DoWCharTest(convert("foo %hC"), wc, convert("foo c")); + DoCharTest(convert("foo %lC"), 'b', convert("foo b")); + DoCharTest(convert("foo %LC"), 'b', convert("foo b")); + DoCharTest(convert("foo %I64C"), 'b', convert("foo b")); + DoCharTest(convert("foo %5C"), 'b', convert("foo b")); + DoCharTest(convert("foo %.0C"), 'b', convert("foo b")); + DoCharTest(convert("foo %-5C"), 'b', convert("foo b ")); + DoCharTest(convert("foo %05C"), 'b', convert("foo 0000b")); + DoCharTest(convert("foo % C"), 'b', convert("foo b")); + DoCharTest(convert("foo %#C"), 'b', convert("foo b")); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test7/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test7/testinfo.dat new file mode 100644 index 0000000000..fa5bd30008 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test7/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = swprintf_s +Name = Positive Test for swprintf_s +TYPE = DEFAULT +EXE1 = test7 +Description += Tests swprintf_s with wide characters diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test8/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test8/CMakeLists.txt new file mode 100644 index 0000000000..8f7fbda5a0 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test8/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test8.cpp +) + +add_executable(paltest_snwprintf_test8 + ${SOURCES} +) + +add_dependencies(paltest_snwprintf_test8 coreclrpal) + +target_link_libraries(paltest_snwprintf_test8 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test8/test8.cpp b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test8/test8.cpp new file mode 100644 index 0000000000..9f1b555e3c --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test8/test8.cpp @@ -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: test8.c +** +** Purpose: Tests swprintf_s with decimal numbers +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../_snwprintf_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[]) +{ + int neg = -42; + int pos = 42; + INT64 l = 42; + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + + DoNumTest(convert("foo %d"), pos, convert("foo 42")); + DoNumTest(convert("foo %ld"), 0xFFFF, convert("foo 65535")); + DoNumTest(convert("foo %hd"), 0xFFFF, convert("foo -1")); + DoNumTest(convert("foo %Ld"), pos, convert("foo 42")); + DoI64Test(convert("foo %I64d"), l, "42", convert("foo 42")); + DoNumTest(convert("foo %3d"), pos, convert("foo 42")); + DoNumTest(convert("foo %-3d"), pos, convert("foo 42 ")); + DoNumTest(convert("foo %.1d"), pos, convert("foo 42")); + DoNumTest(convert("foo %.3d"), pos, convert("foo 042")); + DoNumTest(convert("foo %03d"), pos, convert("foo 042")); + DoNumTest(convert("foo %#d"), pos, convert("foo 42")); + DoNumTest(convert("foo %+d"), pos, convert("foo +42")); + DoNumTest(convert("foo % d"), pos, convert("foo 42")); + DoNumTest(convert("foo %+d"), neg, convert("foo -42")); + DoNumTest(convert("foo % d"), neg, convert("foo -42")); + + PAL_Terminate(); + return PASS; +} + diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test8/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test8/testinfo.dat new file mode 100644 index 0000000000..d76a421ea3 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test8/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = swprintf_s +Name = Positive Test for swprintf_s +TYPE = DEFAULT +EXE1 = test8 +Description += Tests swprintf_s with decimal numbers diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test9/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test9/CMakeLists.txt new file mode 100644 index 0000000000..f769c9eaa5 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test9/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test9.cpp +) + +add_executable(paltest_snwprintf_test9 + ${SOURCES} +) + +add_dependencies(paltest_snwprintf_test9 coreclrpal) + +target_link_libraries(paltest_snwprintf_test9 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test9/test9.cpp b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test9/test9.cpp new file mode 100644 index 0000000000..76d60631a2 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test9/test9.cpp @@ -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: test9.c +** +** Purpose: Tests swprintf_s with integer numbers +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../_snwprintf_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[]) +{ + int neg = -42; + int pos = 42; + INT64 l = 42; + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + + DoNumTest(convert("foo %i"), pos, convert("foo 42")); + DoNumTest(convert("foo %li"), 0xFFFF, convert("foo 65535")); + DoNumTest(convert("foo %hi"), 0xFFFF, convert("foo -1")); + DoNumTest(convert("foo %Li"), pos, convert("foo 42")); + DoI64Test(convert("foo %I64i"), l, "42", convert("foo 42")); + DoNumTest(convert("foo %3i"), pos, convert("foo 42")); + DoNumTest(convert("foo %-3i"), pos, convert("foo 42 ")); + DoNumTest(convert("foo %.1i"), pos, convert("foo 42")); + DoNumTest(convert("foo %.3i"), pos, convert("foo 042")); + DoNumTest(convert("foo %03i"), pos, convert("foo 042")); + DoNumTest(convert("foo %#i"), pos, convert("foo 42")); + DoNumTest(convert("foo %+i"), pos, convert("foo +42")); + DoNumTest(convert("foo % i"), pos, convert("foo 42")); + DoNumTest(convert("foo %+i"), neg, convert("foo -42")); + DoNumTest(convert("foo % i"), neg, convert("foo -42")); + + PAL_Terminate(); + return PASS; +} + diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test9/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test9/testinfo.dat new file mode 100644 index 0000000000..b2a038df62 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test9/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = swprintf_s +Name = Positive Test for swprintf_s +TYPE = DEFAULT +EXE1 = test9 +Description += Tests swprintf_s with integer numbers diff --git a/src/pal/tests/palsuite/c_runtime/_splitpath/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_splitpath/CMakeLists.txt deleted file mode 100644 index f6aa0cb2d9..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_splitpath/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -add_subdirectory(test1) - diff --git a/src/pal/tests/palsuite/c_runtime/_splitpath/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_splitpath/test1/CMakeLists.txt deleted file mode 100644 index 361b9084d7..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_splitpath/test1/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test1.c -) - -add_executable(paltest_splitpath_test1 - ${SOURCES} -) - -add_dependencies(paltest_splitpath_test1 coreclrpal) - -target_link_libraries(paltest_splitpath_test1 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_splitpath/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_splitpath/test1/test1.c deleted file mode 100644 index e98354c2ee..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_splitpath/test1/test1.c +++ /dev/null @@ -1,108 +0,0 @@ -// 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: test1.c -** -** Purpose: Passes _splitpath() a series of sample paths and checks that it -** parses them as expected. -** -** -**==========================================================================*/ - - -#include <palsuite.h> - -struct testCase -{ - const char path[_MAX_PATH]; /* The path to parse. */ - const char drive[_MAX_DRIVE]; /* The expected values... */ - const char dir[_MAX_DIR]; - const char fname[_MAX_FNAME]; - const char ext[_MAX_EXT]; -}; - - -int __cdecl main(int argc, char **argv) -{ - struct testCase testCases[] = - { -#if WIN32 - {"c:\\foo\\bar\\foo.bar", "c:", "\\foo\\bar\\", "foo", ".bar"}, - {"c:/foo/bar/foo.bar", "c:", "/foo/bar/", "foo", ".bar"}, - {"c:/foo/bar/foo", "c:", "/foo/bar/", "foo", ""}, - {"c:/foo/bar/.bar", "c:", "/foo/bar/", "", ".bar"}, - {"c:/foo/bar/", "c:", "/foo/bar/", "", ""}, - {"/foo/bar/foo.bar", "", "/foo/bar/", "foo", ".bar"}, - {"c:foo.bar", "c:", "", "foo", ".bar"} -#else - {"c:\\foo\\bar\\foo.bar", "","c:/foo/bar/", "foo", ".bar"}, - {"c:/foo/bar/foo.bar", "", "c:/foo/bar/", "foo", ".bar"}, - {"c:/foo/bar/foo", "", "c:/foo/bar/", "foo", ""}, - {"c:/foo/bar/.bar", "", "c:/foo/bar/", ".bar", ""}, - {"c:/foo/bar/", "", "c:/foo/bar/", "", ""}, - {"/foo/bar/foo.bar", "", "/foo/bar/", "foo", ".bar"}, - {"c:foo.bar", "", "", "c:foo", ".bar"} -#endif - }; - char drive[_MAX_DRIVE]; - char dir[_MAX_DIR]; - char fname[_MAX_FNAME]; - char ext[_MAX_EXT]; - - int i=0; - - /* - * Initialize the PAL and return FAIL if this fails - */ - if (0 != (PAL_Initialize(argc, argv))) - { - return FAIL; - } - - for (i = 0; i < sizeof(testCases)/sizeof(struct testCase); i++) - { - _splitpath(testCases[i].path, drive, dir, fname, ext); - - - /*on platforms that don't support drive letters, the drive - returned should always be "" */ - if (strcmp(drive, testCases[i].drive) != 0) - { - Fail("_splitpath read the path \"%s\" and thought the drive was " - "\"%s\" instead of \"%s\"\n" - , testCases[i].path, drive, testCases[i].drive); - } - - if (strcmp(dir, testCases[i].dir) != 0) - { - Fail("_splitpath read the path \"%s\" and thought the directory " - "was \"%s\" instead of \"%s\"\n" - , testCases[i].path, dir, testCases[i].dir); - } - - if (strcmp(fname, testCases[i].fname) != 0) - { - Fail("_splitpath read the path \"%s\" and thought the filename " - "was \"%s\" instead of \"%s\"\n" - , testCases[i].path, fname, testCases[i].fname); - } - - if (strcmp(ext, testCases[i].ext) != 0) - { - Fail("_splitpath read the path \"%s\" and thought the file " - "extension was \"%s\" instead of \"%s\"\n" - , testCases[i].path, ext, testCases[i].ext); - } - } - PAL_Terminate(); - return PASS; -} - - - - - - diff --git a/src/pal/tests/palsuite/c_runtime/_splitpath/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_splitpath/test1/testinfo.dat deleted file mode 100644 index 0a93e27456..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_splitpath/test1/testinfo.dat +++ /dev/null @@ -1,15 +0,0 @@ -# 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 = _splitpath -Name = Positive Test for _splitpath -TYPE = DEFAULT -EXE1 = test1 -Description -= Passes _splitpath() a series of sample paths and checks that it -= parses them as expected. - - diff --git a/src/pal/tests/palsuite/c_runtime/_stricmp/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_stricmp/test1/CMakeLists.txt index 766660ccfc..03aa3a523e 100644 --- a/src/pal/tests/palsuite/c_runtime/_stricmp/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_stricmp/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_stricmp_test1 diff --git a/src/pal/tests/palsuite/c_runtime/_stricmp/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_stricmp/test1/test1.cpp index 60e2f9eb8b..60e2f9eb8b 100644 --- a/src/pal/tests/palsuite/c_runtime/_stricmp/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/_stricmp/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_strlwr/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_strlwr/test1/CMakeLists.txt index 3a9394ca60..ca26961b3c 100644 --- a/src/pal/tests/palsuite/c_runtime/_strlwr/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_strlwr/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_strlwr_test1 diff --git a/src/pal/tests/palsuite/c_runtime/_strlwr/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_strlwr/test1/test1.cpp index 1c4015e3e2..1c4015e3e2 100644 --- a/src/pal/tests/palsuite/c_runtime/_strlwr/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/_strlwr/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_strnicmp/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_strnicmp/test1/CMakeLists.txt index 6a38747592..03f9992198 100644 --- a/src/pal/tests/palsuite/c_runtime/_strnicmp/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_strnicmp/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_strnicmp_test1 diff --git a/src/pal/tests/palsuite/c_runtime/_strnicmp/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_strnicmp/test1/test1.cpp index 3c915dc621..3c915dc621 100644 --- a/src/pal/tests/palsuite/c_runtime/_strnicmp/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/_strnicmp/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_swab/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_swab/CMakeLists.txt deleted file mode 100644 index f6aa0cb2d9..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_swab/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -add_subdirectory(test1) - diff --git a/src/pal/tests/palsuite/c_runtime/_swab/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_swab/test1/CMakeLists.txt deleted file mode 100644 index fc7fbef8b4..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_swab/test1/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test1.c -) - -add_executable(paltest_swab_test1 - ${SOURCES} -) - -add_dependencies(paltest_swab_test1 coreclrpal) - -target_link_libraries(paltest_swab_test1 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_swab/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_swab/test1/test1.c deleted file mode 100644 index 203e3b3a06..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_swab/test1/test1.c +++ /dev/null @@ -1,45 +0,0 @@ -// 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: test1.c -** -** Purpose: Calls _swab on a buffer, and checks that it has correctly -** swapped adjacent bytes -** -** -**==========================================================================*/ - -#include <palsuite.h> - -int __cdecl main(int argc, char **argv) -{ - char before[] = "abcdefghijklmn"; - char after[] = "--------------"; - const char check[] = "badcfehgjilknm"; - - /* - * Initialize the PAL and return FAIL if this fails - */ - if (0 != (PAL_Initialize(argc, argv))) - { - return FAIL; - } - - _swab(before, after, sizeof(before)); - if (memcmp(after, check, sizeof(after)) != 0) - { - Fail ("_swab did not correctly swap adjacent bytes in a buffer.\n"); - } - - PAL_Terminate(); - return PASS; - -} - - - - - diff --git a/src/pal/tests/palsuite/c_runtime/_swab/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_swab/test1/testinfo.dat deleted file mode 100644 index c59b017762..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_swab/test1/testinfo.dat +++ /dev/null @@ -1,14 +0,0 @@ -# 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 = _swab -Name = Positive Test for _swab -TYPE = DEFAULT -EXE1 = test1 -Description -= Calls _swab on a buffer, and checks that it has correctly swapped -= adjacent bytes - diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/_vsnprintf.h b/src/pal/tests/palsuite/c_runtime/_vsnprintf/_vsnprintf.h index 240a72f017..30e70648c3 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/_vsnprintf.h +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/_vsnprintf.h @@ -28,7 +28,7 @@ int Testvsnprintf(char* buf, size_t count, const char* format, ...) } -void DoStrTest(char *formatstr, char* param, char *checkstr) +void DoStrTest(const char *formatstr, char* param, const char *checkstr) { char buf[256] = { 0 }; @@ -41,7 +41,7 @@ void DoStrTest(char *formatstr, char* param, char *checkstr) } } -void DoWStrTest(char *formatstr, WCHAR* param, char *checkstr) +void DoWStrTest(const char *formatstr, WCHAR* param, const char *checkstr) { char buf[256] = { 0 }; @@ -55,7 +55,7 @@ void DoWStrTest(char *formatstr, WCHAR* param, char *checkstr) } -void DoCharTest(char *formatstr, char param, char *checkstr) +void DoCharTest(const char *formatstr, char param, const char *checkstr) { char buf[256] = { 0 }; @@ -68,7 +68,7 @@ void DoCharTest(char *formatstr, char param, char *checkstr) } } -void DoWCharTest(char *formatstr, WCHAR param, char *checkstr) +void DoWCharTest(const char *formatstr, WCHAR param, const char *checkstr) { char buf[256] = { 0 }; @@ -81,7 +81,7 @@ void DoWCharTest(char *formatstr, WCHAR param, char *checkstr) } } -void DoNumTest(char *formatstr, int value, char *checkstr) +void DoNumTest(const char *formatstr, int value, const char *checkstr) { char buf[256] = { 0 }; @@ -94,7 +94,7 @@ void DoNumTest(char *formatstr, int value, char *checkstr) } } -void DoI64Test(char *formatstr, INT64 value, char *valuestr, char *checkstr) +void DoI64Test(const char *formatstr, INT64 value, char *valuestr, const char *checkstr) { char buf[256] = { 0 }; @@ -106,7 +106,7 @@ void DoI64Test(char *formatstr, INT64 value, char *valuestr, char *checkstr) valuestr, formatstr, checkstr, buf); } } -void DoDoubleTest(char *formatstr, double value, char *checkstr1, char +void DoDoubleTest(const char *formatstr, double value, const char *checkstr1, char *checkstr2) { char buf[256] = { 0 }; diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test1/CMakeLists.txt index 7c346a4638..489b7bf566 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_vsnprintf_test1 diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test1/test1.cpp index 88aeec27a5..88aeec27a5 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test1/testinfo.dat index 0e97856927..f96bf084f2 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test1/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test1/testinfo.dat @@ -10,4 +10,4 @@ TYPE = DEFAULT EXE1 = test1 Description = Tests the PAL implementation of the _vsnprintf function. -= This test is modeled after _snprintf. += This test is modeled after sprintf_s. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test10/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test10/CMakeLists.txt index 00dccc260d..bc35dbd0c2 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test10/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test10/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test10.c + test10.cpp ) add_executable(paltest_vsnprintf_test10 diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test10/test10.c b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test10/test10.cpp index 3099957ab7..3099957ab7 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test10/test10.c +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test10/test10.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test10/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test10/testinfo.dat index 1399afae05..a3d8eca54e 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test10/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test10/testinfo.dat @@ -11,4 +11,4 @@ EXE1 = test10 Description = Tests the PAL implementation of the _vsnprintf function. = Tests _vsnprintf with octal numbers. -= This test is modeled after _snprintf. += This test is modeled after sprintf_s. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test11/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test11/CMakeLists.txt index fd709f2a31..bf3dd9a534 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test11/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test11/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test11.c + test11.cpp ) add_executable(paltest_vsnprintf_test11 diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test11/test11.c b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test11/test11.cpp index 74b0435c6d..74b0435c6d 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test11/test11.c +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test11/test11.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test11/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test11/testinfo.dat index faa7428eff..17e9f04946 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test11/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test11/testinfo.dat @@ -11,4 +11,4 @@ EXE1 = test11 Description = Tests the PAL implementation of the _vsnprintf function. = Tests _vsnprintf with unsigned numbers. -= This test is modeled after _snprintf. += This test is modeled after sprintf_s. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test12/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test12/CMakeLists.txt index 02dac0cb91..9fceeaf7a5 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test12/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test12/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test12.c + test12.cpp ) add_executable(paltest_vsnprintf_test12 diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test12/test12.c b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test12/test12.cpp index 3718620971..3718620971 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test12/test12.c +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test12/test12.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test12/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test12/testinfo.dat index d48a5cc60d..82f58e4371 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test12/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test12/testinfo.dat @@ -11,4 +11,4 @@ EXE1 = test12 Description = Tests the PAL implementation of the _vsnprintf function. = Tests _vsnprintf with hex numbers (lowercase). -= This test is modeled after _snprintf. += This test is modeled after sprintf_s. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test13/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test13/CMakeLists.txt index 52562c99f8..7e805f6ad4 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test13/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test13/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test13.c + test13.cpp ) add_executable(paltest_vsnprintf_test13 diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test13/test13.c b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test13/test13.cpp index 1abada4033..1abada4033 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test13/test13.c +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test13/test13.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test13/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test13/testinfo.dat index a3f14c21dc..d308edf871 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test13/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test13/testinfo.dat @@ -11,4 +11,4 @@ EXE1 = test13 Description = Tests the PAL implementation of the _vsnprintf function. = Tests _vsnprintf with hex numbers (uppercase). -= This test is modeled after _snprintf. += This test is modeled after sprintf_s. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test14/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test14/CMakeLists.txt index 3fc8c814a6..6e4566b577 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test14/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test14/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test14.c + test14.cpp ) add_executable(paltest_vsnprintf_test14 diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test14/test14.c b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test14/test14.cpp index 2e98f6ad4e..2e98f6ad4e 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test14/test14.c +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test14/test14.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test14/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test14/testinfo.dat index f4d921c139..8d11b1d6ff 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test14/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test14/testinfo.dat @@ -11,4 +11,4 @@ EXE1 = test14 Description = Tests the PAL implementation of the _vsnprintf function. = Tests _vsnprintf with exponential format doubles (lowercase). -= This test is modeled after _snprintf. += This test is modeled after sprintf_s. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test15/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test15/CMakeLists.txt index f6bdc83779..d9039b39b7 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test15/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test15/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test15.c + test15.cpp ) add_executable(paltest_vsnprintf_test15 diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test15/test15.c b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test15/test15.cpp index 4d32e9c638..4d32e9c638 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test15/test15.c +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test15/test15.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test15/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test15/testinfo.dat index 3a6620ba46..913912508e 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test15/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test15/testinfo.dat @@ -11,4 +11,4 @@ EXE1 = test15 Description = Tests the PAL implementation of the _vsnprintf function. = Tests _vsnprintf with exponential format doubles (uppercase). -= This test is modeled after _snprintf. += This test is modeled after sprintf_s. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test16/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test16/CMakeLists.txt index b7b06d19bb..b298df318b 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test16/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test16/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test16.c + test16.cpp ) add_executable(paltest_vsnprintf_test16 diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test16/test16.c b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test16/test16.cpp index 118ba1453c..118ba1453c 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test16/test16.c +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test16/test16.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test16/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test16/testinfo.dat index 6363f294af..fc2f13071b 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test16/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test16/testinfo.dat @@ -11,4 +11,4 @@ EXE1 = test16 Description = Tests the PAL implementation of the _vsnprintf function. = Tests _vsnprintf with decimal point format doubles. -= This test is modeled after _snprintf. += This test is modeled after sprintf_s. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test17/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test17/CMakeLists.txt index 2c91cccd4a..b195f334d3 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test17/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test17/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test17.c + test17.cpp ) add_executable(paltest_vsnprintf_test17 diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test17/test17.c b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test17/test17.cpp index 9b5063ddf0..9b5063ddf0 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test17/test17.c +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test17/test17.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test17/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test17/testinfo.dat index ecec515de3..aeb924495c 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test17/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test17/testinfo.dat @@ -11,4 +11,4 @@ EXE1 = test17 Description = Tests the PAL implementation of the _vsnprintf function. = Tests _vsnprintf with compact format doubles (lowercase). -= This test is modeled after _snprintf. += This test is modeled after sprintf_s. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test18/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test18/CMakeLists.txt index 1a06ce01ee..f0f6d1124e 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test18/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test18/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test18.c + test18.cpp ) add_executable(paltest_vsnprintf_test18 diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test18/test18.c b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test18/test18.cpp index 5232befc7f..5232befc7f 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test18/test18.c +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test18/test18.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test18/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test18/testinfo.dat index 34fd7ae2ff..57aaed5953 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test18/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test18/testinfo.dat @@ -11,4 +11,4 @@ EXE1 = test18 Description = Tests the PAL implementation of the _vsnprintf function. = Tests _vsnprintf with compact format doubles (uppercase). -= This test is modeled after _snprintf. += This test is modeled after sprintf_s. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test19/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test19/CMakeLists.txt index 6f2e42cc6b..44b38902ef 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test19/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test19/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test19.c + test19.cpp ) add_executable(paltest_vsnprintf_test19 diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test19/test19.c b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test19/test19.c deleted file mode 100644 index 075a528aba..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test19/test19.c +++ /dev/null @@ -1,103 +0,0 @@ -// 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: test19.c -** -** Purpose: Test #19 for the _vsnprintf function. -** -** -**===================================================================*/ - -#include <palsuite.h> -#include "../_vsnprintf.h" - -/* - * Notes: memcmp is used, as is strlen. - */ - -#define DOTEST(a,b,c,d,e) DoTest(a,b,(void*)c,d,e) - -void DoArgumentPrecTest(char *formatstr, int precision, void *param, - char *paramstr, char *checkstr1, char *checkstr2) -{ - char buf[256]; - - Testvsnprintf(buf,256,formatstr, precision, param); - if (memcmp(buf, checkstr1, strlen(checkstr1) + 1) != 0 && - memcmp(buf, checkstr2, strlen(checkstr2) + 1) != 0) - { - Fail("ERROR: failed to insert %s into \"%s\" with precision %d\n" - "Expected \"%s\" or \"%s\", got \"%s\".\n", - paramstr, formatstr, precision, checkstr1, checkstr2, buf); - } - -} - -void DoArgumentPrecDoubleTest(char *formatstr, int precision, double param, - char *checkstr1, char *checkstr2) -{ - char buf[256]; - - Testvsnprintf(buf,256,formatstr, precision, param); - if (memcmp(buf, checkstr1, strlen(checkstr1) + 1) != 0 && - memcmp(buf, checkstr2, strlen(checkstr2) + 1) != 0) - { - Fail("ERROR: failed to insert %f into \"%s\" with precision %d\n" - "Expected \"%s\" or \"%s\", got \"%s\".\n", - param, formatstr, precision, checkstr1, checkstr2, buf); - } - -} - - - -int __cdecl main(int argc, char *argv[]) -{ - - if (PAL_Initialize(argc, argv) != 0) - { - return(FAIL); - } - - - DoArgumentPrecTest("%.*s", 2, "bar", "bar", "ba", "ba"); - DoArgumentPrecTest("%.*S", 2, convert("bar"), "bar", "ba", "ba"); - DoArgumentPrecTest("%.*c", 0, (void*)'a', "a", "a", "a"); - DoArgumentPrecTest("%.*c", 4, (void*)'a', "a", "a", "a"); - DoArgumentPrecTest("%.*C", 0, (void*)'a', "a", "a", "a"); - DoArgumentPrecTest("%.*C", 4, (void*)'a', "a", "a", "a"); - DoArgumentPrecTest("%.*d", 1, (void*)42, "42", "42", "42"); - DoArgumentPrecTest("%.*d", 3, (void*)42, "42", "042", "042"); - DoArgumentPrecTest("%.*i", 1, (void*)42, "42", "42", "42"); - DoArgumentPrecTest("%.*i", 3, (void*)42, "42", "042", "042"); - DoArgumentPrecTest("%.*o", 1, (void*)42, "42", "52", "52"); - DoArgumentPrecTest("%.*o", 3, (void*)42, "42", "052", "052"); - DoArgumentPrecTest("%.*u", 1, (void*)42, "42", "42", "42"); - DoArgumentPrecTest("%.*u", 3, (void*)42, "42", "042", "042"); - DoArgumentPrecTest("%.*x", 1, (void*)0x42, "0x42", "42", "42"); - DoArgumentPrecTest("%.*x", 3, (void*)0x42, "0x42", "042", "042"); - DoArgumentPrecTest("%.*X", 1, (void*)0x42, "0x42", "42", "42"); - DoArgumentPrecTest("%.*X", 3, (void*)0x42, "0x42", "042", "042"); - - - DoArgumentPrecDoubleTest("%.*e", 1, 2.01, "2.0e+000", "2.0e+00"); - DoArgumentPrecDoubleTest("%.*e", 3, 2.01, "2.010e+000", "2.010e+00"); - DoArgumentPrecDoubleTest("%.*E", 1, 2.01, "2.0E+000", "2.0E+00"); - DoArgumentPrecDoubleTest("%.*E", 3, 2.01, "2.010E+000", "2.010E+00"); - DoArgumentPrecDoubleTest("%.*f", 1, 2.01, "2.0", "2.0"); - DoArgumentPrecDoubleTest("%.*f", 3, 2.01, "2.010", "2.010"); - DoArgumentPrecDoubleTest("%.*g", 1, 256.01, "3e+002", "3e+02"); - DoArgumentPrecDoubleTest("%.*g", 3, 256.01, "256", "256"); - DoArgumentPrecDoubleTest("%.*g", 4, 256.01, "256", "256"); - DoArgumentPrecDoubleTest("%.*g", 6, 256.01, "256.01", "256.01"); - DoArgumentPrecDoubleTest("%.*G", 1, 256.01, "3E+002", "3E+02"); - DoArgumentPrecDoubleTest("%.*G", 3, 256.01, "256", "256"); - DoArgumentPrecDoubleTest("%.*G", 4, 256.01, "256", "256"); - DoArgumentPrecDoubleTest("%.*G", 6, 256.01, "256.01", "256.01"); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test19/test19.cpp b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test19/test19.cpp new file mode 100644 index 0000000000..211354bc3a --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test19/test19.cpp @@ -0,0 +1,103 @@ +// 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: test19.c +** +** Purpose: Test #19 for the _vsnprintf function. +** +** +**===================================================================*/ + +#include <palsuite.h> +#include "../_vsnprintf.h" + +/* + * Notes: memcmp is used, as is strlen. + */ + +#define DOTEST(a,b,c,d,e) DoTest(a,b,(void*)c,d,e) + +void DoArgumentPrecTest(char *formatstr, int precision, void *param, + char *paramstr, char *checkstr1, char *checkstr2) +{ + char buf[256]; + + Testvsnprintf(buf,256,formatstr, precision, param); + if (memcmp(buf, checkstr1, strlen(checkstr1) + 1) != 0 && + memcmp(buf, checkstr2, strlen(checkstr2) + 1) != 0) + { + Fail("ERROR: failed to insert %s into \"%s\" with precision %d\n" + "Expected \"%s\" or \"%s\", got \"%s\".\n", + paramstr, formatstr, precision, checkstr1, checkstr2, buf); + } + +} + +void DoArgumentPrecDoubleTest(char *formatstr, int precision, double param, + char *checkstr1, char *checkstr2) +{ + char buf[256]; + + Testvsnprintf(buf,256,formatstr, precision, param); + if (memcmp(buf, checkstr1, strlen(checkstr1) + 1) != 0 && + memcmp(buf, checkstr2, strlen(checkstr2) + 1) != 0) + { + Fail("ERROR: failed to insert %f into \"%s\" with precision %d\n" + "Expected \"%s\" or \"%s\", got \"%s\".\n", + param, formatstr, precision, checkstr1, checkstr2, buf); + } + +} + + + +int __cdecl main(int argc, char *argv[]) +{ + + if (PAL_Initialize(argc, argv) != 0) + { + return(FAIL); + } + + + DoArgumentPrecTest("%.*s", 2, (void*)"bar", "bar", "ba", "ba"); + DoArgumentPrecTest("%.*S", 2, (void*)convert("bar"), "bar", "ba", "ba"); + DoArgumentPrecTest("%.*c", 0, (void*)'a', "a", "a", "a"); + DoArgumentPrecTest("%.*c", 4, (void*)'a', "a", "a", "a"); + DoArgumentPrecTest("%.*C", 0, (void*)'a', "a", "a", "a"); + DoArgumentPrecTest("%.*C", 4, (void*)'a', "a", "a", "a"); + DoArgumentPrecTest("%.*d", 1, (void*)42, "42", "42", "42"); + DoArgumentPrecTest("%.*d", 3, (void*)42, "42", "042", "042"); + DoArgumentPrecTest("%.*i", 1, (void*)42, "42", "42", "42"); + DoArgumentPrecTest("%.*i", 3, (void*)42, "42", "042", "042"); + DoArgumentPrecTest("%.*o", 1, (void*)42, "42", "52", "52"); + DoArgumentPrecTest("%.*o", 3, (void*)42, "42", "052", "052"); + DoArgumentPrecTest("%.*u", 1, (void*)42, "42", "42", "42"); + DoArgumentPrecTest("%.*u", 3, (void*)42, "42", "042", "042"); + DoArgumentPrecTest("%.*x", 1, (void*)0x42, "0x42", "42", "42"); + DoArgumentPrecTest("%.*x", 3, (void*)0x42, "0x42", "042", "042"); + DoArgumentPrecTest("%.*X", 1, (void*)0x42, "0x42", "42", "42"); + DoArgumentPrecTest("%.*X", 3, (void*)0x42, "0x42", "042", "042"); + + + DoArgumentPrecDoubleTest("%.*e", 1, 2.01, "2.0e+000", "2.0e+00"); + DoArgumentPrecDoubleTest("%.*e", 3, 2.01, "2.010e+000", "2.010e+00"); + DoArgumentPrecDoubleTest("%.*E", 1, 2.01, "2.0E+000", "2.0E+00"); + DoArgumentPrecDoubleTest("%.*E", 3, 2.01, "2.010E+000", "2.010E+00"); + DoArgumentPrecDoubleTest("%.*f", 1, 2.01, "2.0", "2.0"); + DoArgumentPrecDoubleTest("%.*f", 3, 2.01, "2.010", "2.010"); + DoArgumentPrecDoubleTest("%.*g", 1, 256.01, "3e+002", "3e+02"); + DoArgumentPrecDoubleTest("%.*g", 3, 256.01, "256", "256"); + DoArgumentPrecDoubleTest("%.*g", 4, 256.01, "256", "256"); + DoArgumentPrecDoubleTest("%.*g", 6, 256.01, "256.01", "256.01"); + DoArgumentPrecDoubleTest("%.*G", 1, 256.01, "3E+002", "3E+02"); + DoArgumentPrecDoubleTest("%.*G", 3, 256.01, "256", "256"); + DoArgumentPrecDoubleTest("%.*G", 4, 256.01, "256", "256"); + DoArgumentPrecDoubleTest("%.*G", 6, 256.01, "256.01", "256.01"); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test19/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test19/testinfo.dat index 05f4b5bd87..cda8966865 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test19/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test19/testinfo.dat @@ -11,4 +11,4 @@ EXE1 = test19 Description = Tests the PAL implementation of the _vsnprintf function. = Tests _vsnprintf with argument specified precision. -= This test is modeled after _snprintf. += This test is modeled after sprintf_s. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test2/CMakeLists.txt index a3871d64cf..1d3910e70c 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test2/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test2/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test2.c + test2.cpp ) add_executable(paltest_vsnprintf_test2 diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test2/test2.c b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test2/test2.cpp index 4bac4d2c83..4bac4d2c83 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test2/test2.c +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test2/test2.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test2/testinfo.dat index 5ee925e3f6..6e8f03e639 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test2/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test2/testinfo.dat @@ -11,4 +11,4 @@ EXE1 = test2 Description = Tests the PAL implementation of the _vsnprintf function. = Tests _vsnprintf with strings. -= This test is modeled after _snprintf. += This test is modeled after sprintf_s. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test3/CMakeLists.txt index 1beae06277..62d765ec5f 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test3/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test3/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test3.c + test3.cpp ) add_executable(paltest_vsnprintf_test3 diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test3/test3.c b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test3/test3.cpp index 2b30c9ad99..2b30c9ad99 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test3/test3.c +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test3/test3.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test3/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test3/testinfo.dat index 626949c7c8..638cef69ef 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test3/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test3/testinfo.dat @@ -11,4 +11,4 @@ EXE1 = test3 Description = Tests the PAL implementation of the _vsnprintf function. = Tests _vsnprintf with wide strings. -= This test is modeled after _snprintf. += This test is modeled after sprintf_s. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test4/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test4/CMakeLists.txt index daf7757ddb..5662bd57ad 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test4/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test4/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test4.c + test4.cpp ) add_executable(paltest_vsnprintf_test4 diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test4/test4.c b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test4/test4.cpp index 33fc49deba..33fc49deba 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test4/test4.c +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test4/test4.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test4/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test4/testinfo.dat index bdfdef85ae..03ff2931bc 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test4/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test4/testinfo.dat @@ -11,4 +11,4 @@ EXE1 = test4 Description = Tests the PAL implementation of the _vsnprintf function. = Tests _vsnprintf with pointers. -= This test is modeled after _snprintf. += This test is modeled after sprintf_s. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test5/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test5/CMakeLists.txt index c255b07b42..92540541f3 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test5/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test5/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test5.c + test5.cpp ) add_executable(paltest_vsnprintf_test5 diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test5/test5.c b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test5/test5.cpp index 534e42e293..534e42e293 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test5/test5.c +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test5/test5.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test5/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test5/testinfo.dat index 3cd3f7ee86..c3848824f1 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test5/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test5/testinfo.dat @@ -11,4 +11,4 @@ EXE1 = test5 Description = Tests the PAL implementation of the _vsnprintf function. = Tests _vsnprintf with the count specifier. -= This test is modeled after _snprintf. += This test is modeled after sprintf_s. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test6/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test6/CMakeLists.txt index 8e041f4af8..d80d433c22 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test6/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test6/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test6.c + test6.cpp ) add_executable(paltest_vsnprintf_test6 diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test6/test6.c b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test6/test6.cpp index 103d1181c2..103d1181c2 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test6/test6.c +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test6/test6.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test6/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test6/testinfo.dat index e379e0b3b8..e375f9238d 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test6/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test6/testinfo.dat @@ -11,4 +11,4 @@ EXE1 = test6 Description = Tests the PAL implementation of the _vsnprintf function. = Tests _vsnprintf with characters. -= This test is modeled after _snprintf. += This test is modeled after sprintf_s. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test7/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test7/CMakeLists.txt index 01f9620184..a1dc0a7c2c 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test7/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test7/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test7.c + test7.cpp ) add_executable(paltest_vsnprintf_test7 diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test7/test7.c b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test7/test7.cpp index c7e45d67fa..c7e45d67fa 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test7/test7.c +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test7/test7.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test7/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test7/testinfo.dat index 90749400a5..09eb481b59 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test7/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test7/testinfo.dat @@ -11,4 +11,4 @@ EXE1 = test7 Description = Tests the PAL implementation of the _vsnprintf function. = Tests _vsnprintf with wide characters. -= This test is modeled after _snprintf. += This test is modeled after sprintf_s. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test8/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test8/CMakeLists.txt index 9c525de15a..1ca4732492 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test8/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test8/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test8.c + test8.cpp ) add_executable(paltest_vsnprintf_test8 diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test8/test8.c b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test8/test8.cpp index 2cefbeac25..2cefbeac25 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test8/test8.c +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test8/test8.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test8/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test8/testinfo.dat index 0afc334a67..1bdf411983 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test8/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test8/testinfo.dat @@ -11,4 +11,4 @@ EXE1 = test8 Description = Tests the PAL implementation of the _vsnprintf function. = Tests _vsnprintf with decimal numbers. -= This test is modeled after _snprintf. += This test is modeled after sprintf_s. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test9/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test9/CMakeLists.txt index bfe2572a6d..583971fe5a 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test9/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test9/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test9.c + test9.cpp ) add_executable(paltest_vsnprintf_test9 diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test9/test9.c b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test9/test9.cpp index d2cd8165c0..d2cd8165c0 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test9/test9.c +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test9/test9.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test9/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test9/testinfo.dat index 125724a36b..bdaae87ce8 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test9/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test9/testinfo.dat @@ -11,4 +11,4 @@ EXE1 = test9 Description = Tests the PAL implementation of the _vsnprintf function. = Tests _vsnprintf with integer numbers. -= This test is modeled after _snprintf. += This test is modeled after sprintf_s. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/CMakeLists.txt deleted file mode 100644 index cafb9536b0..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -add_subdirectory(test1) -add_subdirectory(test10) -add_subdirectory(test11) -add_subdirectory(test12) -add_subdirectory(test13) -add_subdirectory(test14) -add_subdirectory(test15) -add_subdirectory(test16) -add_subdirectory(test17) -add_subdirectory(test18) -add_subdirectory(test19) -add_subdirectory(test2) -add_subdirectory(test3) -add_subdirectory(test4) -add_subdirectory(test5) -add_subdirectory(test6) -add_subdirectory(test7) -add_subdirectory(test8) -add_subdirectory(test9) - diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/_vsnwprintf.h b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/_vsnwprintf.h deleted file mode 100644 index a3a932f822..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/_vsnwprintf.h +++ /dev/null @@ -1,133 +0,0 @@ -// 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: _vsnwprintf.h -** -** Purpose: Containts common testing functions for _vsnwprintf -** -** -**==========================================================================*/ - -#ifndef ___VSNWPRINTF_H__ -#define ___VSNWPRINTF_H__ - -/* These functions leaks memory like crazy. C'est la vie. */ -int TestVsnwprintf(wchar_t* buf, size_t count, const wchar_t* format, ...) -{ - int retVal = 0; - va_list arglist; - - va_start(arglist, format); - retVal = _vsnwprintf(buf, count, format, arglist); - va_end(arglist); - - return( retVal); -} - - -void DoWStrTest(WCHAR *formatstr, WCHAR *param, WCHAR *checkstr) -{ - WCHAR buf[256] = { 0 }; - - TestVsnwprintf(buf, 256, formatstr, param); - - if (memcmp(buf, checkstr, wcslen(buf) * 2 + 2) != 0) - { - Fail("ERROR: failed to insert wide string \"%s\" into \"%s\".\n" - "Expected \"%s\", got \"%s\".\n", - convertC(param), convertC(formatstr), - convertC(checkstr), convertC(buf)); - } -} - -void DoStrTest(WCHAR *formatstr, char *param, WCHAR *checkstr) -{ - WCHAR buf[256] = { 0 }; - - TestVsnwprintf(buf, 256, formatstr, param); - - if (memcmp(buf, checkstr, wcslen(buf) * 2 + 2) != 0) - { - Fail("ERROR: failed to insert wide string \"%s\" into \"%s\".\n" - "Expected \"%s\", got \"%s\".\n", - param, convertC(formatstr), convertC(checkstr), - convertC(buf)); - } -} - -void DoCharTest(WCHAR *formatstr, char param, WCHAR *checkstr) -{ - WCHAR buf[256] = { 0 }; - - TestVsnwprintf(buf, 256, formatstr, param); - if (memcmp(buf, checkstr, wcslen(buf)*2 + 2) != 0) - { - Fail("ERROR: failed to insert char \'%c\' (%d) into \"%s\"\n" - "Expected \"%s\" got \"%s\".\n", - param, param, convertC(formatstr), convertC(checkstr), - convertC(buf)); - } -} - -void DoWCharTest(WCHAR *formatstr, WCHAR param, WCHAR *checkstr) -{ - WCHAR buf[256] = { 0 }; - - TestVsnwprintf(buf, 256, formatstr, param); - if (memcmp(buf, checkstr, wcslen(buf)*2 + 2) != 0) - { - Fail("ERROR: failed to insert wide char \'%c\' (%d) into \"%s\"\n" - "Expected \"%s\" got \"%s\".\n", - (char) param, param, convertC(formatstr), - convertC(checkstr), convertC(buf)); - } -} - -void DoNumTest(WCHAR *formatstr, int value, WCHAR*checkstr) -{ - WCHAR buf[256] = { 0 }; - - TestVsnwprintf(buf, 256, formatstr, value); - if (memcmp(buf, checkstr, wcslen(buf)* 2 + 2) != 0) - { - Fail("ERROR: failed to insert %#x into \"%s\"\n" - "Expected \"%s\" got \"%s\".\n", value, convertC(formatstr), - convertC(checkstr), convertC(buf)); - } -} - -void DoI64NumTest(WCHAR *formatstr, INT64 value, char *valuestr, WCHAR*checkstr) -{ - WCHAR buf[256] = { 0 }; - - TestVsnwprintf(buf, 256, formatstr, value); - if (memcmp(buf, checkstr, wcslen(buf)* 2 + 2) != 0) - { - Fail("ERROR: failed to insert %s into \"%s\"\n" - "Expected \"%s\" got \"%s\".\n", valuestr, convertC(formatstr), - convertC(checkstr), convertC(buf)); - } -} -void DoDoubleTest(WCHAR *formatstr, double value, - WCHAR *checkstr1, WCHAR *checkstr2) -{ - WCHAR buf[256] = { 0 }; - - TestVsnwprintf(buf, 256, formatstr, value); - if (memcmp(buf, checkstr1, wcslen(checkstr1) + 2) != 0 && - memcmp(buf, checkstr2, wcslen(checkstr2) + 2) != 0) - { - Fail("ERROR: failed to insert %f into \"%s\"\n" - "Expected \"%s\" or \"%s\", got \"%s\".\n", - value, - convertC(formatstr), - convertC(checkstr1), - convertC(checkstr2), - convertC(buf)); - } -} - -#endif diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test1/CMakeLists.txt deleted file mode 100644 index 52c442d572..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test1/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test1.c -) - -add_executable(paltest_vsnwprintf_test1 - ${SOURCES} -) - -add_dependencies(paltest_vsnwprintf_test1 coreclrpal) - -target_link_libraries(paltest_vsnwprintf_test1 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test1/test1.c deleted file mode 100644 index 0238e42611..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test1/test1.c +++ /dev/null @@ -1,60 +0,0 @@ -// 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: test1.c -** -** Purpose: Test #1 for the _vsnwprintf function. -** -** -**===================================================================*/ - -#include <palsuite.h> -#include "../_vsnwprintf.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[]) -{ - WCHAR *checkstr; - WCHAR buf[256] = { 0 }; - int ret; - - if (PAL_Initialize(argc, argv) != 0) - { - return(FAIL); - } - - checkstr = convert("hello world"); - TestVsnwprintf(buf, 256, checkstr); - if (memcmp(checkstr, buf, wcslen(checkstr)*2+2) != 0) - { - Fail("ERROR: Expected \"%s\", got \"%s\"\n", - convertC(checkstr), convertC(buf)); - } - - TestVsnwprintf(buf, 256, convert("xxxxxxxxxxxxxxxxx")); - ret = TestVsnwprintf(buf, 8, checkstr); - if (memcmp(checkstr, buf, 16) != 0) - { - Fail("ERROR: Expected \"%8s\", got \"%8s\"\n", - convertC(checkstr), convertC(buf)); - } - if (ret >= 0) - { - Fail("ERROR: Expected negative return value, got %d.\n", ret); - } - if (buf[8] != (WCHAR) 'x') - { - Fail("ERROR: buffer overflow using \"%s\" with length 8.\n", - convertC(checkstr)); - } - - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test1/testinfo.dat deleted file mode 100644 index d806fb8ed8..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test1/testinfo.dat +++ /dev/null @@ -1,14 +0,0 @@ -# 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 -Name = Positive Test for _vsnwprintf -TYPE = DEFAULT -EXE1 = test1 -Description -= Tests the PAL implementation of the _vsnwprintf function. -= General test to see if _vsnwprintf works correctly. -= This test is modeled after _snwprintf. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test10/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test10/CMakeLists.txt deleted file mode 100644 index 86ea1a3160..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test10/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test10.c -) - -add_executable(paltest_vsnwprintf_test10 - ${SOURCES} -) - -add_dependencies(paltest_vsnwprintf_test10 coreclrpal) - -target_link_libraries(paltest_vsnwprintf_test10 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test10/test10.c b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test10/test10.c deleted file mode 100644 index 6e188e56ff..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test10/test10.c +++ /dev/null @@ -1,50 +0,0 @@ -// 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: test10.c -** -** Purpose: Test #10 for the _vsnwprintf function. -** -** -**===================================================================*/ - -#include <palsuite.h> -#include "../_vsnwprintf.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[]) -{ - int neg = -42; - int pos = 42; - INT64 l = 42; - - if (PAL_Initialize(argc, argv) != 0) - { - return(FAIL); - } - - DoNumTest(convert("foo %o"), pos, convert("foo 52")); - DoNumTest(convert("foo %lo"), 0xFFFF, convert("foo 177777")); - DoNumTest(convert("foo %ho"), 0xFFFF, convert("foo 177777")); - DoNumTest(convert("foo %Lo"), pos, convert("foo 52")); - DoI64NumTest(convert("foo %I64o"), l, "42", convert("foo 52")); - DoNumTest(convert("foo %3o"), pos, convert("foo 52")); - DoNumTest(convert("foo %-3o"), pos, convert("foo 52 ")); - DoNumTest(convert("foo %.1o"), pos, convert("foo 52")); - DoNumTest(convert("foo %.3o"), pos, convert("foo 052")); - DoNumTest(convert("foo %03o"), pos, convert("foo 052")); - DoNumTest(convert("foo %#o"), pos, convert("foo 052")); - DoNumTest(convert("foo %+o"), pos, convert("foo 52")); - DoNumTest(convert("foo % o"), pos, convert("foo 52")); - DoNumTest(convert("foo %+o"), neg, convert("foo 37777777726")); - DoNumTest(convert("foo % o"), neg, convert("foo 37777777726")); - - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test10/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test10/testinfo.dat deleted file mode 100644 index beb5b41be9..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test10/testinfo.dat +++ /dev/null @@ -1,14 +0,0 @@ -# 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 -Name = Positive Test for _vsnwprintf -TYPE = DEFAULT -EXE1 = test10 -Description -= Tests the PAL implementation of the _vsnwprintf function. -= Tests _vsnwprintf with octal numbers. -= This test is modeled after _snwprintf. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test11/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test11/CMakeLists.txt deleted file mode 100644 index c6011dc1de..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test11/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test11.c -) - -add_executable(paltest_vsnwprintf_test11 - ${SOURCES} -) - -add_dependencies(paltest_vsnwprintf_test11 coreclrpal) - -target_link_libraries(paltest_vsnwprintf_test11 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test11/test11.c b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test11/test11.c deleted file mode 100644 index af54985bdc..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test11/test11.c +++ /dev/null @@ -1,50 +0,0 @@ -// 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: test11.c -** -** Purpose: Test #11 for the _vsnwprintf function. -** -** -**===================================================================*/ - -#include <palsuite.h> -#include "../_vsnwprintf.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[]) -{ - int neg = -42; - int pos = 42; - INT64 l = 42; - - if (PAL_Initialize(argc, argv) != 0) - { - return(FAIL); - } - - DoNumTest(convert("foo %u"), pos, convert("foo 42")); - DoNumTest(convert("foo %lu"), 0xFFFF, convert("foo 65535")); - DoNumTest(convert("foo %hu"), 0xFFFF, convert("foo 65535")); - DoNumTest(convert("foo %Lu"), pos, convert("foo 42")); - DoI64NumTest(convert("foo %I64u"), l, "42", convert("foo 42")); - DoNumTest(convert("foo %3u"), pos, convert("foo 42")); - DoNumTest(convert("foo %-3u"), pos, convert("foo 42 ")); - DoNumTest(convert("foo %.1u"), pos, convert("foo 42")); - DoNumTest(convert("foo %.3u"), pos, convert("foo 042")); - DoNumTest(convert("foo %03u"), pos, convert("foo 042")); - DoNumTest(convert("foo %#u"), pos, convert("foo 42")); - DoNumTest(convert("foo %+u"), pos, convert("foo 42")); - DoNumTest(convert("foo % u"), pos, convert("foo 42")); - DoNumTest(convert("foo %+u"), neg, convert("foo 4294967254")); - DoNumTest(convert("foo % u"), neg, convert("foo 4294967254")); - - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test11/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test11/testinfo.dat deleted file mode 100644 index 083b0fa5af..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test11/testinfo.dat +++ /dev/null @@ -1,14 +0,0 @@ -# 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 -Name = Positive Test for _vsnwprintf -TYPE = DEFAULT -EXE1 = test11 -Description -= Tests the PAL implementation of the _vsnwprintf function. -= Tests _vsnwprintf with unsigned numbers. -= This test is modeled after _snwprintf. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test12/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test12/CMakeLists.txt deleted file mode 100644 index bd9652c2fb..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test12/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test12.c -) - -add_executable(paltest_vsnwprintf_test12 - ${SOURCES} -) - -add_dependencies(paltest_vsnwprintf_test12 coreclrpal) - -target_link_libraries(paltest_vsnwprintf_test12 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test12/test12.c b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test12/test12.c deleted file mode 100644 index b593a82b4b..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test12/test12.c +++ /dev/null @@ -1,50 +0,0 @@ -// 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: test12.c -** -** Purpose: Test #12 for the _vsnwprintf function. -** -** -**===================================================================*/ - -#include <palsuite.h> -#include "../_vsnwprintf.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[]) -{ - int neg = -42; - int pos = 0x1234ab; - INT64 l = I64(0x1234567887654321); - - if (PAL_Initialize(argc, argv) != 0) - { - return(FAIL); - } - - DoNumTest(convert("foo %x"), pos, convert("foo 1234ab")); - DoNumTest(convert("foo %lx"), pos, convert("foo 1234ab")); - DoNumTest(convert("foo %hx"), pos, convert("foo 34ab")); - DoNumTest(convert("foo %Lx"), pos, convert("foo 1234ab")); - DoI64NumTest(convert("foo %I64x"), l, "0x1234567887654321", - convert("foo 1234567887654321")); - DoNumTest(convert("foo %7x"), pos, convert("foo 1234ab")); - DoNumTest(convert("foo %-7x"), pos, convert("foo 1234ab ")); - DoNumTest(convert("foo %.1x"), pos, convert("foo 1234ab")); - DoNumTest(convert("foo %.7x"), pos, convert("foo 01234ab")); - DoNumTest(convert("foo %07x"), pos, convert("foo 01234ab")); - DoNumTest(convert("foo %#x"), pos, convert("foo 0x1234ab")); - DoNumTest(convert("foo %+x"), pos, convert("foo 1234ab")); - DoNumTest(convert("foo % x"), pos, convert("foo 1234ab")); - DoNumTest(convert("foo %+x"), neg, convert("foo ffffffd6")); - DoNumTest(convert("foo % x"), neg, convert("foo ffffffd6")); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test12/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test12/testinfo.dat deleted file mode 100644 index a4450ed8d0..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test12/testinfo.dat +++ /dev/null @@ -1,14 +0,0 @@ -# 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 -Name = Positive Test for _vsnwprintf -TYPE = DEFAULT -EXE1 = test12 -Description -= Tests the PAL implementation of the _vsnwprintf function. -= Tests _vsnwprintf with hex numbers (lowercase). -= This test is modeled after _snwprintf. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test13/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test13/CMakeLists.txt deleted file mode 100644 index c608ab84e3..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test13/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test13.c -) - -add_executable(paltest_vsnwprintf_test13 - ${SOURCES} -) - -add_dependencies(paltest_vsnwprintf_test13 coreclrpal) - -target_link_libraries(paltest_vsnwprintf_test13 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test13/test13.c b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test13/test13.c deleted file mode 100644 index 59a9dc496f..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test13/test13.c +++ /dev/null @@ -1,50 +0,0 @@ -// 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: test13.c -** -** Purpose: Test #13 for the _vsnwprintf function. -** -** -**===================================================================*/ - -#include <palsuite.h> -#include "../_vsnwprintf.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[]) -{ - int neg = -42; - int pos = 0x1234ab; - INT64 l = I64(0x1234567887654321); - - if (PAL_Initialize(argc, argv) != 0) - { - return(FAIL); - } - - DoNumTest(convert("foo %X"), pos, convert("foo 1234AB")); - DoNumTest(convert("foo %lX"), pos, convert("foo 1234AB")); - DoNumTest(convert("foo %hX"), pos, convert("foo 34AB")); - DoNumTest(convert("foo %LX"), pos, convert("foo 1234AB")); - DoI64NumTest(convert("foo %I64X"), l, "0x1234567887654321", - convert("foo 1234567887654321")); - DoNumTest(convert("foo %7X"), pos, convert("foo 1234AB")); - DoNumTest(convert("foo %-7X"), pos, convert("foo 1234AB ")); - DoNumTest(convert("foo %.1X"), pos, convert("foo 1234AB")); - DoNumTest(convert("foo %.7X"), pos, convert("foo 01234AB")); - DoNumTest(convert("foo %07X"), pos, convert("foo 01234AB")); - DoNumTest(convert("foo %#X"), pos, convert("foo 0X1234AB")); - DoNumTest(convert("foo %+X"), pos, convert("foo 1234AB")); - DoNumTest(convert("foo % X"), pos, convert("foo 1234AB")); - DoNumTest(convert("foo %+X"), neg, convert("foo FFFFFFD6")); - DoNumTest(convert("foo % X"), neg, convert("foo FFFFFFD6")); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test13/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test13/testinfo.dat deleted file mode 100644 index fa54ae8a62..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test13/testinfo.dat +++ /dev/null @@ -1,14 +0,0 @@ -# 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 -Name = Positive Test for _vsnwprintf -TYPE = DEFAULT -EXE1 = test13 -Description -= Tests the PAL implementation of the _vsnwprintf function. -= Tests _vsnwprintf with hex numbers (uppercase). -= This test is modeled after _snwprintf. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test14/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test14/CMakeLists.txt deleted file mode 100644 index 3bf157a2b3..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test14/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test14.c -) - -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/test14/test14.c b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test14/test14.c deleted file mode 100644 index 633f9d68ae..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test14/test14.c +++ /dev/null @@ -1,63 +0,0 @@ -// 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 function. -** -** -**===================================================================*/ - -#include <palsuite.h> -#include "../_vsnwprintf.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/test14/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test14/testinfo.dat deleted file mode 100644 index 0796f5e81c..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test14/testinfo.dat +++ /dev/null @@ -1,14 +0,0 @@ -# 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 -Name = Positive Test for _vsnwprintf -TYPE = DEFAULT -EXE1 = test14 -Description -= Tests the PAL implementation of the _vsnwprintf function. -= Tests _vsnwprintf with exponential format doubles (lowercase). -= This test is modeled after _snwprintf. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test15/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test15/CMakeLists.txt deleted file mode 100644 index eedc7bb9db..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test15/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test15.c -) - -add_executable(paltest_vsnwprintf_test15 - ${SOURCES} -) - -add_dependencies(paltest_vsnwprintf_test15 coreclrpal) - -target_link_libraries(paltest_vsnwprintf_test15 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test15/test15.c b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test15/test15.c deleted file mode 100644 index 0af41fe1dc..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test15/test15.c +++ /dev/null @@ -1,64 +0,0 @@ -// 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: test15.c -** -** Purpose: Test #15 for the _vsnwprintf function. -** -** -**===================================================================*/ - -#include <palsuite.h> -#include "../_vsnwprintf.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+002")); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test15/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test15/testinfo.dat deleted file mode 100644 index 9de3c83b8a..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test15/testinfo.dat +++ /dev/null @@ -1,14 +0,0 @@ -# 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 -Name = Positive Test for _vsnwprintf -TYPE = DEFAULT -EXE1 = test15 -Description -= Tests the PAL implementation of the _vsnwprintf function. -= Tests _vsnwprintf with exponential format doubles (uppercase). -= This test is modeled after _snwprintf. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test16/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test16/CMakeLists.txt deleted file mode 100644 index a469c497e9..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test16/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test16.c -) - -add_executable(paltest_vsnwprintf_test16 - ${SOURCES} -) - -add_dependencies(paltest_vsnwprintf_test16 coreclrpal) - -target_link_libraries(paltest_vsnwprintf_test16 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test16/test16.c b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test16/test16.c deleted file mode 100644 index 77571b01b3..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test16/test16.c +++ /dev/null @@ -1,63 +0,0 @@ -// 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: test16.c -** -** Purpose: Test #16 for the _vsnwprintf function. -** -** -**===================================================================*/ - -#include <palsuite.h> -#include "../_vsnwprintf.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 = 2560.001; - double neg = -2560.001; - - if (PAL_Initialize(argc, argv) != 0) - { - return(FAIL); - } - - DoDoubleTest(convert("foo %f"), val, convert("foo 2560.001000"), - convert("foo 2560.001000")); - DoDoubleTest(convert("foo %lf"), val, convert("foo 2560.001000"), - convert("foo 2560.001000")); - DoDoubleTest(convert("foo %hf"), val, convert("foo 2560.001000"), - convert("foo 2560.001000")); - DoDoubleTest(convert("foo %Lf"), val, convert("foo 2560.001000"), - convert("foo 2560.001000")); - DoDoubleTest(convert("foo %I64f"), val, convert("foo 2560.001000"), - convert("foo 2560.001000")); - DoDoubleTest(convert("foo %12f"), val, convert("foo 2560.001000"), - convert("foo 2560.001000")); - DoDoubleTest(convert("foo %-12f"), val, convert("foo 2560.001000 "), - convert("foo 2560.001000 ")); - DoDoubleTest(convert("foo %.1f"), val, convert("foo 2560.0"), - convert("foo 2560.0")); - DoDoubleTest(convert("foo %.8f"), val, convert("foo 2560.00100000"), - convert("foo 2560.00100000")); - DoDoubleTest(convert("foo %012f"), val, convert("foo 02560.001000"), - convert("foo 02560.001000")); - DoDoubleTest(convert("foo %#f"), val, convert("foo 2560.001000"), - convert("foo 2560.001000")); - DoDoubleTest(convert("foo %+f"), val, convert("foo +2560.001000"), - convert("foo +2560.001000")); - DoDoubleTest(convert("foo % f"), val, convert("foo 2560.001000"), - convert("foo 2560.001000")); - DoDoubleTest(convert("foo %+f"), neg, convert("foo -2560.001000"), - convert("foo -2560.001000")); - DoDoubleTest(convert("foo % f"), neg, convert("foo -2560.001000"), - convert("foo -2560.001000")); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test16/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test16/testinfo.dat deleted file mode 100644 index b7134c785b..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test16/testinfo.dat +++ /dev/null @@ -1,14 +0,0 @@ -# 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 -Name = Positive Test for _vsnwprintf -TYPE = DEFAULT -EXE1 = test16 -Description -= Tests the PAL implementation of the _vsnwprintf function. -= Tests _vsnwprintf with decimal point format doubles. -= This test is modeled after _snwprintf. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test17/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test17/CMakeLists.txt deleted file mode 100644 index f429e94417..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test17/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test17.c -) - -add_executable(paltest_vsnwprintf_test17 - ${SOURCES} -) - -add_dependencies(paltest_vsnwprintf_test17 coreclrpal) - -target_link_libraries(paltest_vsnwprintf_test17 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test17/test17.c b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test17/test17.c deleted file mode 100644 index 3a9d70ad03..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test17/test17.c +++ /dev/null @@ -1,65 +0,0 @@ -// 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: test17.c -** -** Purpose: Test #17 for the _vsnwprintf function. -** -** -**===================================================================*/ - -#include <palsuite.h> -#include "../_vsnwprintf.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 = 2560.001; - double neg = -2560.001; - - if (PAL_Initialize(argc, argv) != 0) - { - return(FAIL); - } - - DoDoubleTest(convert("foo %g"), val, convert("foo 2560"), - convert("foo 2560")); - DoDoubleTest(convert("foo %lg"), val, convert("foo 2560"), - convert("foo 2560")); - DoDoubleTest(convert("foo %hg"), val, convert("foo 2560"), - convert("foo 2560")); - DoDoubleTest(convert("foo %Lg"), val, convert("foo 2560"), - convert("foo 2560")); - DoDoubleTest(convert("foo %I64g"), val, convert("foo 2560"), - convert("foo 2560")); - DoDoubleTest(convert("foo %5g"), val, convert("foo 2560"), - convert("foo 2560")); - DoDoubleTest(convert("foo %-5g"), val, convert("foo 2560 "), - convert("foo 2560 ")); - DoDoubleTest(convert("foo %.1g"), val, convert("foo 3e+003"), - convert("foo 3e+03")); - DoDoubleTest(convert("foo %.2g"), val, convert("foo 2.6e+003"), - convert("foo 2.6e+03")); - DoDoubleTest(convert("foo %.12g"), val, convert("foo 2560.001"), - convert("foo 2560.001")); - DoDoubleTest(convert("foo %06g"), val, convert("foo 002560"), - convert("foo 002560")); - DoDoubleTest(convert("foo %#g"), val, convert("foo 2560.00"), - convert("foo 2560.00")); - DoDoubleTest(convert("foo %+g"), val, convert("foo +2560"), - convert("foo +2560")); - DoDoubleTest(convert("foo % g"), val, convert("foo 2560"), - convert("foo 2560")); - DoDoubleTest(convert("foo %+g"), neg, convert("foo -2560"), - convert("foo -2560")); - DoDoubleTest(convert("foo % g"), neg, convert("foo -2560"), - convert("foo -2560")); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test17/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test17/testinfo.dat deleted file mode 100644 index 5d5553151e..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test17/testinfo.dat +++ /dev/null @@ -1,14 +0,0 @@ -# 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 -Name = Positive Test for _vsnwprintf -TYPE = DEFAULT -EXE1 = test17 -Description -= Tests the PAL implementation of the _vsnwprintf function. -= Tests _vsnwprintf with compact format doubles (lowercase). -= This test is modeled after _snwprintf. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test18/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test18/CMakeLists.txt deleted file mode 100644 index 25dd6a2c5b..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test18/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test18.c -) - -add_executable(paltest_vsnwprintf_test18 - ${SOURCES} -) - -add_dependencies(paltest_vsnwprintf_test18 coreclrpal) - -target_link_libraries(paltest_vsnwprintf_test18 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test18/test18.c b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test18/test18.c deleted file mode 100644 index 03f9870113..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test18/test18.c +++ /dev/null @@ -1,65 +0,0 @@ -// 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: test18.c -** -** Purpose: Test #18 for the _vsnwprintf function. -** -** -**===================================================================*/ - -#include <palsuite.h> -#include "../_vsnwprintf.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 = 2560.001; - double neg = -2560.001; - - if (PAL_Initialize(argc, argv) != 0) - { - return(FAIL); - } - - DoDoubleTest(convert("foo %G"), val, convert("foo 2560"), - convert("foo 2560")); - DoDoubleTest(convert("foo %lG"), val, convert("foo 2560"), - convert("foo 2560")); - DoDoubleTest(convert("foo %hG"), val, convert("foo 2560"), - convert("foo 2560")); - DoDoubleTest(convert("foo %LG"), val, convert("foo 2560"), - convert("foo 2560")); - DoDoubleTest(convert("foo %I64G"), val, convert("foo 2560"), - convert("foo 2560")); - DoDoubleTest(convert("foo %5G"), val, convert("foo 2560"), - convert("foo 2560")); - DoDoubleTest(convert("foo %-5G"), val, convert("foo 2560 "), - convert("foo 2560 ")); - DoDoubleTest(convert("foo %.1G"), val, convert("foo 3E+003"), - convert("foo 3E+03")); - DoDoubleTest(convert("foo %.2G"), val, convert("foo 2.6E+003"), - convert("foo 2.6E+03")); - DoDoubleTest(convert("foo %.12G"), val, convert("foo 2560.001"), - convert("foo 2560.001")); - DoDoubleTest(convert("foo %06G"), val, convert("foo 002560"), - convert("foo 002560")); - DoDoubleTest(convert("foo %#G"), val, convert("foo 2560.00"), - convert("foo 2560.00")); - DoDoubleTest(convert("foo %+G"), val, convert("foo +2560"), - convert("foo +2560")); - DoDoubleTest(convert("foo % G"), val, convert("foo 2560"), - convert("foo 2560")); - DoDoubleTest(convert("foo %+G"), neg, convert("foo -2560"), - convert("foo -2560")); - DoDoubleTest(convert("foo % G"), neg, convert("foo -2560"), - convert("foo -2560")); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test18/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test18/testinfo.dat deleted file mode 100644 index f56c80980d..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test18/testinfo.dat +++ /dev/null @@ -1,14 +0,0 @@ -# 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 -Name = Positive Test for _vsnwprintf -TYPE = DEFAULT -EXE1 = test18 -Description -= Tests the PAL implementation of the _vsnwprintf function. -= Tests _vsnwprintf with compact format doubles (uppercase). -= This test is modeled after _snwprintf. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test19/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test19/CMakeLists.txt deleted file mode 100644 index 9c636b8b0a..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test19/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test19.c -) - -add_executable(paltest_vsnwprintf_test19 - ${SOURCES} -) - -add_dependencies(paltest_vsnwprintf_test19 coreclrpal) - -target_link_libraries(paltest_vsnwprintf_test19 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test19/test19.c b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test19/test19.c deleted file mode 100644 index fea275a242..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test19/test19.c +++ /dev/null @@ -1,139 +0,0 @@ -// 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: test18.c -** -** Purpose: Test #18 for the _vsnwprintf function. -** -** -**===================================================================*/ - -#include <palsuite.h> -#include "../_vsnwprintf.h" - -/* memcmp is used to verify the results, so this test is dependent on it. */ -/* ditto with wcslen */ - -#define DOTEST(a,b,c,d,e) DoTest(a,b,(void*)c,d,e) - -void DoArgumentPrecTest(WCHAR *formatstr, int precision, void *param, - WCHAR *paramstr, WCHAR *checkstr1, WCHAR *checkstr2) -{ - WCHAR buf[256]; - - TestVsnwprintf(buf, 256, formatstr, precision, param); - if (memcmp(buf, checkstr1, wcslen(checkstr1) + 2) != 0 && - memcmp(buf, checkstr2, wcslen(checkstr2) + 2) != 0) - { - Fail("ERROR: failed to insert %s into \"%s\" with precision %d\n" - "Expected \"%s\" or \"%s\", got \"%s\".\n", - paramstr, - convertC(formatstr), - precision, - convertC(checkstr1), - convertC(checkstr2), - convertC(buf)); - } -} -void DoArgumentPrecDoubleTest(WCHAR *formatstr, int precision, double param, - WCHAR *checkstr1, WCHAR *checkstr2) -{ - WCHAR buf[256]; - - TestVsnwprintf(buf, 256, formatstr, precision, param); - if (memcmp(buf, checkstr1, wcslen(checkstr1) + 2) != 0 && - memcmp(buf, checkstr2, wcslen(checkstr2) + 2) != 0) - { - Fail("ERROR: failed to insert %f into \"%s\" with precision %d\n" - "Expected \"%s\" or \"%s\", got \"%s\".\n", - param, convertC(formatstr), - precision, - convertC(checkstr1), - convertC(checkstr2), - convertC(buf)); - } -} - -/* - * Uses memcmp & wcslen - */ - -int __cdecl main(int argc, char *argv[]) -{ - - if (PAL_Initialize(argc, argv) != 0) - { - return(FAIL); - } - - DoArgumentPrecTest(convert("%.*s"), 2, convert("bar"), convert("bar"), - convert("ba"), convert("ba")); - DoArgumentPrecTest(convert("%.*c"), 0, (void*)'a', convert("a"), - convert("a"), convert("a")); - DoArgumentPrecTest(convert("%.*c"), 4, (void*)'a', convert("a"), - convert("a"), convert("a")); - DoArgumentPrecTest(convert("%.*C"), 0, (void*)'a', convert("a"), - convert("a"), convert("a")); - DoArgumentPrecTest(convert("%.*C"), 4, (void*)'a', convert("a"), - convert("a"), convert("a")); - DoArgumentPrecTest(convert("%.*d"), 1, (void*)42, convert("42"), - convert("42"), convert("42")); - DoArgumentPrecTest(convert("%.*d"), 3, (void*)42, convert("42"), - convert("042"), convert("042")); - DoArgumentPrecTest(convert("%.*i"), 1, (void*)42, convert("42"), - convert("42"), convert("42")); - DoArgumentPrecTest(convert("%.*i"), 3, (void*)42, convert("42"), - convert("042"), convert("042")); - DoArgumentPrecTest(convert("%.*o"), 1, (void*)42, convert("42"), - convert("52"), convert("52")); - DoArgumentPrecTest(convert("%.*o"), 3, (void*)42, convert("42"), - convert("052"), convert("052")); - DoArgumentPrecTest(convert("%.*u"), 1, (void*)42, convert("42"), - convert("42"), convert("42")); - DoArgumentPrecTest(convert("%.*u"), 3, (void*)42, convert("42"), - convert("042"), convert("042")); - DoArgumentPrecTest(convert("%.*x"), 1, (void*)0x42, convert("0x42"), - convert("42"), convert("42")); - DoArgumentPrecTest(convert("%.*x"), 3, (void*)0x42, convert("0x42"), - convert("042"), convert("042")); - DoArgumentPrecTest(convert("%.*X"), 1, (void*)0x42, convert("0x42"), - convert("42"), convert("42")); - DoArgumentPrecTest(convert("%.*X"), 3, (void*)0x42, convert("0x42"), - convert("042"), convert("042")); - - - DoArgumentPrecDoubleTest(convert("%.*e"), 1, 2.01, convert("2.0e+000"), - convert("2.0e+00")); - DoArgumentPrecDoubleTest(convert("%.*e"), 3, 2.01, convert("2.010e+000"), - convert("2.010e+00")); - DoArgumentPrecDoubleTest(convert("%.*E"), 1, 2.01, convert("2.0E+000"), - convert("2.0E+00")); - DoArgumentPrecDoubleTest(convert("%.*E"), 3, 2.01, convert("2.010E+000"), - convert("2.010E+00")); - DoArgumentPrecDoubleTest(convert("%.*f"), 1, 2.01, convert("2.0"), - convert("2.0")); - DoArgumentPrecDoubleTest(convert("%.*f"), 3, 2.01, convert("2.010"), - convert("2.010")); - DoArgumentPrecDoubleTest(convert("%.*g"), 1, 256.01, convert("3e+002"), - convert("3e+02")); - DoArgumentPrecDoubleTest(convert("%.*g"), 3, 256.01, convert("256"), - convert("256")); - DoArgumentPrecDoubleTest(convert("%.*g"), 4, 256.01, convert("256"), - convert("256")); - DoArgumentPrecDoubleTest(convert("%.*g"), 6, 256.01, convert("256.01"), - convert("256.01")); - DoArgumentPrecDoubleTest(convert("%.*G"), 1, 256.01, convert("3E+002"), - convert("3E+02")); - DoArgumentPrecDoubleTest(convert("%.*G"), 3, 256.01, convert("256"), - convert("256")); - DoArgumentPrecDoubleTest(convert("%.*G"), 4, 256.01, convert("256"), - convert("256")); - DoArgumentPrecDoubleTest(convert("%.*G"), 6, 256.01, convert("256.01"), - convert("256.01")); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test19/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test19/testinfo.dat deleted file mode 100644 index 77178f1471..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test19/testinfo.dat +++ /dev/null @@ -1,14 +0,0 @@ -# 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 -Name = Positive Test for _vsnwprintf -TYPE = DEFAULT -EXE1 = test19 -Description -= Tests the PAL implementation of the _vsnwprintf function. -= Tests _vsnwprintf with argument specified precision. -= This test is modeled after _snwprintf. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test2/CMakeLists.txt deleted file mode 100644 index 817657ea61..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test2/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test2.c -) - -add_executable(paltest_vsnwprintf_test2 - ${SOURCES} -) - -add_dependencies(paltest_vsnwprintf_test2 coreclrpal) - -target_link_libraries(paltest_vsnwprintf_test2 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test2/test2.c b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test2/test2.c deleted file mode 100644 index 20499954db..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test2/test2.c +++ /dev/null @@ -1,40 +0,0 @@ -// 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: test2.c -** -** Purpose: Test #2 for the _vsnwprintf function. -** -** -**===================================================================*/ - -#include <palsuite.h> -#include "../_vsnwprintf.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[]) -{ - if (PAL_Initialize(argc, argv) != 0) - return(FAIL); - - DoWStrTest(convert("foo %s"), convert("bar"), convert("foo bar")); - DoStrTest(convert("foo %hs"), "bar", convert("foo bar")); - DoWStrTest(convert("foo %ls"), convert("bar"), convert("foo bar")); - DoWStrTest(convert("foo %ws"), convert("bar"), convert("foo bar")); - DoWStrTest(convert("foo %Ls"), convert("bar"), convert("foo bar")); - DoWStrTest(convert("foo %I64s"), convert("bar"), convert("foo bar")); - DoWStrTest(convert("foo %5s"), convert("bar"), convert("foo bar")); - DoWStrTest(convert("foo %.2s"), convert("bar"), convert("foo ba")); - DoWStrTest(convert("foo %5.2s"), convert("bar"), convert("foo ba")); - DoWStrTest(convert("foo %-5s"), convert("bar"), convert("foo bar ")); - DoWStrTest(convert("foo %05s"), convert("bar"), convert("foo 00bar")); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test2/testinfo.dat deleted file mode 100644 index 429911bd83..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test2/testinfo.dat +++ /dev/null @@ -1,14 +0,0 @@ -# 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 -Name = Positive Test for _vsnwprintf -TYPE = DEFAULT -EXE1 = test2 -Description -= Tests the PAL implementation of the _vsnwprintf function. -= Tests _vsnwprintf with strings. -= This test is modeled after _snwprintf. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test3/CMakeLists.txt deleted file mode 100644 index 4af3e36f3b..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test3/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test3.c -) - -add_executable(paltest_vsnwprintf_test3 - ${SOURCES} -) - -add_dependencies(paltest_vsnwprintf_test3 coreclrpal) - -target_link_libraries(paltest_vsnwprintf_test3 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test3/test3.c b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test3/test3.c deleted file mode 100644 index 9a37d3fc4b..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test3/test3.c +++ /dev/null @@ -1,40 +0,0 @@ -// 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: test3.c -** -** Purpose: Test #3 for the _vsnwprintf function. -** -** -**===================================================================*/ - -#include <palsuite.h> -#include "../_vsnwprintf.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[]) -{ - if (PAL_Initialize(argc, argv) != 0) - return(FAIL); - - DoStrTest(convert("foo %S"), "bar", convert("foo bar")); - DoStrTest(convert("foo %hS"), "bar", convert("foo bar")); - DoWStrTest(convert("foo %lS"), convert("bar"), convert("foo bar")); - DoWStrTest(convert("foo %wS"), convert("bar"), convert("foo bar")); - DoStrTest(convert("foo %LS"), "bar", convert("foo bar")); - DoStrTest(convert("foo %I64S"), "bar", convert("foo bar")); - DoStrTest(convert("foo %5S"), "bar", convert("foo bar")); - DoStrTest(convert("foo %.2S"), "bar", convert("foo ba")); - DoStrTest(convert("foo %5.2S"), "bar", convert("foo ba")); - DoStrTest(convert("foo %-5S"), "bar", convert("foo bar ")); - DoStrTest(convert("foo %05S"), "bar", convert("foo 00bar")); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test3/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test3/testinfo.dat deleted file mode 100644 index d4e2686763..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test3/testinfo.dat +++ /dev/null @@ -1,14 +0,0 @@ -# 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 -Name = Positive Test for _vsnwprintf -TYPE = DEFAULT -EXE1 = test3 -Description -= Tests the PAL implementation of the _vsnwprintf function. -= Tests _vsnwprintf with wide strings. -= This test is modeled after _snwprintf. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test4/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test4/CMakeLists.txt deleted file mode 100644 index b7ff9e7bb3..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test4/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test4.c -) - -add_executable(paltest_vsnwprintf_test4 - ${SOURCES} -) - -add_dependencies(paltest_vsnwprintf_test4 coreclrpal) - -target_link_libraries(paltest_vsnwprintf_test4 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test4/test4.c b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test4/test4.c deleted file mode 100644 index 6f39be2a80..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test4/test4.c +++ /dev/null @@ -1,121 +0,0 @@ -// 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: test4.c -** -** Purpose: Test #4 for the _vsnwprintf function. -** -** -**===================================================================*/ - -#include <palsuite.h> -#include "../_vsnwprintf.h" - -/* memcmp is used to verify the results, so this test is dependent on it. */ -/* ditto with wcslen */ -static void DoPointerTest(WCHAR *formatstr, void* param, WCHAR* paramstr, - WCHAR *checkstr1) -{ - WCHAR buf[256] = { 0 }; - - TestVsnwprintf(buf, 256, formatstr, param); - if (memcmp(buf, checkstr1, wcslen(checkstr1) + 2) != 0) - - { - Fail("ERROR: failed to insert pointer to %#p into \"%s\"\n" - "Expected \"%s\" got \"%s\".\n", - paramstr, - convertC(formatstr), - convertC(checkstr1), - convertC(buf)); - } -} - -static void DoI64DoubleTest(WCHAR *formatstr, INT64 value, WCHAR *valuestr, - WCHAR *checkstr1) -{ - WCHAR buf[256] = { 0 }; - - TestVsnwprintf(buf, 256, formatstr, value); - if (memcmp(buf, checkstr1, wcslen(checkstr1) + 2) != 0) - { - Fail("ERROR: failed to insert %s into \"%s\"\n" - "Expected \"%s\", got \"%s\".\n", - value, - convertC(formatstr), - convertC(checkstr1), - convertC(buf)); - } -} - -int __cdecl main(int argc, char *argv[]) -{ - void *ptr = (void*) 0x123456; - INT64 lptr = I64(0x1234567887654321); - - if (PAL_Initialize(argc, argv) != 0) - { - return(FAIL); - } - -/* -** Run only on 64 bit platforms -*/ -#if defined(BIT64) && defined(PLATFORM_UNIX) - Trace("Testing for 64 Bit Platforms \n"); - DoPointerTest(convert("%p"), NULL, convert("NULL"), convert("00000000")); - DoPointerTest(convert("%p"), ptr, convert("pointer to 0x123456"), - convert("0000000000123456")); - DoPointerTest(convert("%17p"), ptr, convert("pointer to 0x123456"), - convert(" 0000000000123456")); - DoPointerTest(convert("%17p"), ptr, convert("pointer to 0x123456"), - convert(" 0000000000123456")); - DoPointerTest(convert("%-17p"), ptr, convert("pointer to 0x123456"), - convert("0000000000123456 ")); - DoPointerTest(convert("%+p"), ptr, convert("pointer to 0x123456"), - convert("0000000000123456")); - DoPointerTest(convert("%#p"), ptr, convert("pointer to 0x123456"), - convert("0X0000000000123456")); - DoPointerTest(convert("%lp"), ptr, convert("pointer to 0x123456"), - convert("00123456")); - DoPointerTest(convert("%hp"), ptr, convert("pointer to 0x123456"), - convert("00003456")); - DoPointerTest(convert("%Lp"), ptr, convert("pointer to 0x123456"), - convert("00123456")); - DoI64DoubleTest(convert("%I64p"), lptr, - convert("pointer to 0x1234567887654321"), - convert("1234567887654321")); - -#else - Trace("Testing for Non 64 Bit Platforms \n"); - DoPointerTest(convert("%p"), NULL, convert("NULL"), convert("00000000")); - DoPointerTest(convert("%p"), ptr, convert("pointer to 0x123456"), - convert("00123456")); - DoPointerTest(convert("%9p"), ptr, convert("pointer to 0x123456"), - convert(" 00123456")); - DoPointerTest(convert("%09p"), ptr, convert("pointer to 0x123456"), - convert(" 00123456")); - DoPointerTest(convert("%-9p"), ptr, convert("pointer to 0x123456"), - convert("00123456 ")); - DoPointerTest(convert("%+p"), ptr, convert("pointer to 0x123456"), - convert("00123456")); - DoPointerTest(convert("%#p"), ptr, convert("pointer to 0x123456"), - convert("0X00123456")); - DoPointerTest(convert("%lp"), ptr, convert("pointer to 0x123456"), - convert("00123456")); - DoPointerTest(convert("%hp"), ptr, convert("pointer to 0x123456"), - convert("00003456")); - DoPointerTest(convert("%Lp"), ptr, convert("pointer to 0x123456"), - convert("00123456")); - DoI64DoubleTest(convert("%I64p"), lptr, - convert("pointer to 0x1234567887654321"), - convert("1234567887654321")); -#endif - - PAL_Terminate(); - return PASS; -} - diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test4/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test4/testinfo.dat deleted file mode 100644 index 56f488a66a..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test4/testinfo.dat +++ /dev/null @@ -1,14 +0,0 @@ -# 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 -Name = Positive Test for _vsnwprintf -TYPE = DEFAULT -EXE1 = test4 -Description -= Tests the PAL implementation of the _vsnwprintf function. -= Tests _vsnwprintf with pointers. -= This test is modeled after _snwprintf. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test5/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test5/CMakeLists.txt deleted file mode 100644 index 9b316b9f90..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test5/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test5.c -) - -add_executable(paltest_vsnwprintf_test5 - ${SOURCES} -) - -add_dependencies(paltest_vsnwprintf_test5 coreclrpal) - -target_link_libraries(paltest_vsnwprintf_test5 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test5/test5.c b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test5/test5.c deleted file mode 100644 index 224db766ff..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test5/test5.c +++ /dev/null @@ -1,81 +0,0 @@ -// 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: test5.c -** -** Purpose: Test #5 for the _vsnwprintf function. -** -** -**===================================================================*/ - -#include <palsuite.h> -#include "../_vsnwprintf.h" - -/* memcmp is used to verify the results, so this test is dependent on it. */ -/* ditto with wcslen */ - -static void DoTest(WCHAR *formatstr, int param, WCHAR *checkstr) -{ - WCHAR buf[256] = { 0 }; - int n = -1; - - TestVsnwprintf(buf, 256, formatstr, &n); - - if (n != param) - { - Fail("ERROR: Expected count parameter to resolve to %d, got %d\n", - param, n); - } - - if (memcmp(buf, checkstr, wcslen(buf)*2 + 2) != 0) - { - Fail("ERROR: Expected \"%s\" got \"%s\".\n", - convertC(checkstr), convertC(buf)); - } -} - -static void DoShortTest(WCHAR *formatstr, int param, WCHAR *checkstr) -{ - WCHAR buf[256] = { 0 }; - short int n = -1; - - TestVsnwprintf(buf, 256, formatstr, &n); - - if (n != param) - { - Fail("ERROR: Expected count parameter to resolve to %d, got %d\n", - param, n); - } - - if (memcmp(buf, checkstr, wcslen(buf)*2 + 2) != 0) - { - Fail("ERROR: Expected \"%s\" got \"%s\".\n", - convertC(checkstr), convertC(buf)); - } -} - -int __cdecl main(int argc, char *argv[]) -{ - if (PAL_Initialize(argc, argv) != 0) - { - return(FAIL); - } - - DoTest(convert("foo %n bar"), 4, convert("foo bar")); - DoTest(convert("foo %#n bar"), 4, convert("foo bar")); - DoTest(convert("foo % n bar"), 4, convert("foo bar")); - DoTest(convert("foo %+n bar"), 4, convert("foo bar")); - DoTest(convert("foo %-n bar"), 4, convert("foo bar")); - DoTest(convert("foo %0n bar"), 4, convert("foo bar")); - DoShortTest(convert("foo %hn bar"), 4, convert("foo bar")); - DoTest(convert("foo %ln bar"), 4, convert("foo bar")); - DoTest(convert("foo %Ln bar"), 4, convert("foo bar")); - DoTest(convert("foo %I64n bar"), 4, convert("foo bar")); - DoTest(convert("foo %20.3n bar"), 4, convert("foo bar")); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test5/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test5/testinfo.dat deleted file mode 100644 index 35d3816a76..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test5/testinfo.dat +++ /dev/null @@ -1,14 +0,0 @@ -# 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 -Name = Positive Test for _vsnwprintf -TYPE = DEFAULT -EXE1 = test5 -Description -= Tests the PAL implementation of the _vsnwprintf function. -= Tests _vsnwprintf with the count specifier. -= This test is modeled after _snwprintf. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test6/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test6/CMakeLists.txt deleted file mode 100644 index d3fad03597..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test6/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test6.c -) - -add_executable(paltest_vsnwprintf_test6 - ${SOURCES} -) - -add_dependencies(paltest_vsnwprintf_test6 coreclrpal) - -target_link_libraries(paltest_vsnwprintf_test6 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test6/test6.c b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test6/test6.c deleted file mode 100644 index 1bd83ea85c..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test6/test6.c +++ /dev/null @@ -1,43 +0,0 @@ -// 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: test6.c -** -** Purpose: Test #6 for the _vsnwprintf function. -** -** -**===================================================================*/ - -#include <palsuite.h> -#include "../_vsnwprintf.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[]) -{ - WCHAR wc = (WCHAR) 'c'; - - if (PAL_Initialize(argc, argv) != 0) - { - return(FAIL); - } - - DoWCharTest(convert("foo %c"), wc, convert("foo c")); - DoCharTest(convert("foo %hc"), 'b', convert("foo b")); - DoWCharTest(convert("foo %lc"), wc, convert("foo c")); - DoWCharTest(convert("foo %Lc"), wc, convert("foo c")); - DoWCharTest(convert("foo %I64c"), wc, convert("foo c")); - DoWCharTest(convert("foo %5c"), wc, convert("foo c")); - DoWCharTest(convert("foo %.0c"), wc, convert("foo c")); - DoWCharTest(convert("foo %-5c"), wc, convert("foo c ")); - DoWCharTest(convert("foo %05c"), wc, convert("foo 0000c")); - DoWCharTest(convert("foo % c"), wc, convert("foo c")); - DoWCharTest(convert("foo %#c"), wc, convert("foo c")); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test6/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test6/testinfo.dat deleted file mode 100644 index 6afe96d1cd..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test6/testinfo.dat +++ /dev/null @@ -1,14 +0,0 @@ -# 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 -Name = Positive Test for _vsnwprintf -TYPE = DEFAULT -EXE1 = test6 -Description -= Tests the PAL implementation of the _vsnwprintf function. -= Tests _vsnwprintf with characters. -= This test is modeled after _snwprintf. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test7/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test7/CMakeLists.txt deleted file mode 100644 index cede861358..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test7/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test7.c -) - -add_executable(paltest_vsnwprintf_test7 - ${SOURCES} -) - -add_dependencies(paltest_vsnwprintf_test7 coreclrpal) - -target_link_libraries(paltest_vsnwprintf_test7 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test7/test7.c b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test7/test7.c deleted file mode 100644 index e13798b784..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test7/test7.c +++ /dev/null @@ -1,43 +0,0 @@ -// 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: test7.c -** -** Purpose: Test #7 for the _vsnwprintf function. -** -** -**===================================================================*/ - -#include <palsuite.h> -#include "../_vsnwprintf.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[]) -{ - WCHAR wc = (WCHAR) 'c'; - - if (PAL_Initialize(argc, argv) != 0) - { - return(FAIL); - } - - DoCharTest(convert("foo %C"), 'b', convert("foo b")); - DoWCharTest(convert("foo %hC"), wc, convert("foo c")); - DoCharTest(convert("foo %lC"), 'b', convert("foo b")); - DoCharTest(convert("foo %LC"), 'b', convert("foo b")); - DoCharTest(convert("foo %I64C"), 'b', convert("foo b")); - DoCharTest(convert("foo %5C"), 'b', convert("foo b")); - DoCharTest(convert("foo %.0C"), 'b', convert("foo b")); - DoCharTest(convert("foo %-5C"), 'b', convert("foo b ")); - DoCharTest(convert("foo %05C"), 'b', convert("foo 0000b")); - DoCharTest(convert("foo % C"), 'b', convert("foo b")); - DoCharTest(convert("foo %#C"), 'b', convert("foo b")); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test7/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test7/testinfo.dat deleted file mode 100644 index ece40aa195..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test7/testinfo.dat +++ /dev/null @@ -1,14 +0,0 @@ -# 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 -Name = Positive Test for _vsnwprintf -TYPE = DEFAULT -EXE1 = test7 -Description -= Tests the PAL implementation of the _vsnwprintf function. -= Tests _vsnwprintf with wide characters. -= This test is modeled after _snwprintf. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test8/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test8/CMakeLists.txt deleted file mode 100644 index 846e7b9219..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test8/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test8.c -) - -add_executable(paltest_vsnwprintf_test8 - ${SOURCES} -) - -add_dependencies(paltest_vsnwprintf_test8 coreclrpal) - -target_link_libraries(paltest_vsnwprintf_test8 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test8/test8.c b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test8/test8.c deleted file mode 100644 index 8f02412eb0..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test8/test8.c +++ /dev/null @@ -1,49 +0,0 @@ -// 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: test8.c -** -** Purpose: Test #8 for the _vsnwprintf function. -** -** -**===================================================================*/ - -#include <palsuite.h> -#include "../_vsnwprintf.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[]) -{ - int neg = -42; - int pos = 42; - INT64 l = 42; - - if (PAL_Initialize(argc, argv) != 0) - { - return(FAIL); - } - - DoNumTest(convert("foo %d"), pos, convert("foo 42")); - DoNumTest(convert("foo %ld"), 0xFFFF, convert("foo 65535")); - DoNumTest(convert("foo %hd"), 0xFFFF, convert("foo -1")); - DoNumTest(convert("foo %Ld"), pos, convert("foo 42")); - DoI64NumTest(convert("foo %I64d"), l, "42", convert("foo 42")); - DoNumTest(convert("foo %3d"), pos, convert("foo 42")); - DoNumTest(convert("foo %-3d"), pos, convert("foo 42 ")); - DoNumTest(convert("foo %.1d"), pos, convert("foo 42")); - DoNumTest(convert("foo %.3d"), pos, convert("foo 042")); - DoNumTest(convert("foo %03d"), pos, convert("foo 042")); - DoNumTest(convert("foo %#d"), pos, convert("foo 42")); - DoNumTest(convert("foo %+d"), pos, convert("foo +42")); - DoNumTest(convert("foo % d"), pos, convert("foo 42")); - DoNumTest(convert("foo %+d"), neg, convert("foo -42")); - DoNumTest(convert("foo % d"), neg, convert("foo -42")); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test8/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test8/testinfo.dat deleted file mode 100644 index d7a567a6d6..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test8/testinfo.dat +++ /dev/null @@ -1,14 +0,0 @@ -# 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 -Name = Positive Test for _vsnwprintf -TYPE = DEFAULT -EXE1 = test8 -Description -= Tests the PAL implementation of the _vsnwprintf function. -= Tests _vsnwprintf with decimal numbers. -= This test is modeled after _snwprintf. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test9/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test9/CMakeLists.txt deleted file mode 100644 index e25eded172..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test9/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test9.c -) - -add_executable(paltest_vsnwprintf_test9 - ${SOURCES} -) - -add_dependencies(paltest_vsnwprintf_test9 coreclrpal) - -target_link_libraries(paltest_vsnwprintf_test9 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test9/test9.c b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test9/test9.c deleted file mode 100644 index 7b5b6cd8a6..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test9/test9.c +++ /dev/null @@ -1,49 +0,0 @@ -// 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: test9.c -** -** Purpose: Test #9 for the _vsnwprintf function. -** -** -**===================================================================*/ - -#include <palsuite.h> -#include "../_vsnwprintf.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[]) -{ - int neg = -42; - int pos = 42; - INT64 l = 42; - - if (PAL_Initialize(argc, argv) != 0) - { - return(FAIL); - } - - DoNumTest(convert("foo %i"), pos, convert("foo 42")); - DoNumTest(convert("foo %li"), 0xFFFF, convert("foo 65535")); - DoNumTest(convert("foo %hi"), 0xFFFF, convert("foo -1")); - DoNumTest(convert("foo %Li"), pos, convert("foo 42")); - DoI64NumTest(convert("foo %I64i"), l, "42", convert("foo 42")); - DoNumTest(convert("foo %3i"), pos, convert("foo 42")); - DoNumTest(convert("foo %-3i"), pos, convert("foo 42 ")); - DoNumTest(convert("foo %.1i"), pos, convert("foo 42")); - DoNumTest(convert("foo %.3i"), pos, convert("foo 042")); - DoNumTest(convert("foo %03i"), pos, convert("foo 042")); - DoNumTest(convert("foo %#i"), pos, convert("foo 42")); - DoNumTest(convert("foo %+i"), pos, convert("foo +42")); - DoNumTest(convert("foo % i"), pos, convert("foo 42")); - DoNumTest(convert("foo %+i"), neg, convert("foo -42")); - DoNumTest(convert("foo % i"), neg, convert("foo -42")); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test9/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test9/testinfo.dat deleted file mode 100644 index 726b060240..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test9/testinfo.dat +++ /dev/null @@ -1,14 +0,0 @@ -# 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 -Name = Positive Test for _vsnwprintf -TYPE = DEFAULT -EXE1 = test9 -Description -= Tests the PAL implementation of the _vsnwprintf function. -= Tests _vsnwprintf with integer numbers -= This test is modeled after _snwprintf. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/CMakeLists.txt new file mode 100644 index 0000000000..8fe1cb60ac --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/CMakeLists.txt @@ -0,0 +1,21 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +add_subdirectory(test1) +add_subdirectory(test10) +add_subdirectory(test11) +add_subdirectory(test12) +add_subdirectory(test13) +add_subdirectory(test14) +add_subdirectory(test15) +add_subdirectory(test16) +add_subdirectory(test17) +add_subdirectory(test18) +add_subdirectory(test19) +add_subdirectory(test2) +add_subdirectory(test3) +add_subdirectory(test4) +add_subdirectory(test6) +add_subdirectory(test7) +add_subdirectory(test8) +add_subdirectory(test9) + diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/_vsnwprintf_s.h b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/_vsnwprintf_s.h new file mode 100644 index 0000000000..34cf411c25 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/_vsnwprintf_s.h @@ -0,0 +1,133 @@ +// 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: _vsnwprintf_s.h +** +** Purpose: Containts common testing functions for _vsnwprintf_s +** +** +**==========================================================================*/ + +#ifndef ___VSNWPRINTF_H__ +#define ___VSNWPRINTF_H__ + +/* These functions leaks memory like crazy. C'est la vie. */ +int TestVsnwprintf_s(wchar_t* buf, size_t count, const wchar_t* format, ...) +{ + int retVal = 0; + va_list arglist; + + va_start(arglist, format); + retVal = _vsnwprintf_s(buf, count, _TRUNCATE, format, arglist); + va_end(arglist); + + return( retVal); +} + + +void DoWStrTest(const WCHAR *formatstr, WCHAR *param, const WCHAR *checkstr) +{ + WCHAR buf[256] = { 0 }; + + TestVsnwprintf_s(buf, 256, formatstr, param); + + if (memcmp(buf, checkstr, wcslen(buf) * 2 + 2) != 0) + { + Fail("ERROR: failed to insert wide string \"%s\" into \"%s\".\n" + "Expected \"%s\", got \"%s\".\n", + convertC(param), convertC(formatstr), + convertC(checkstr), convertC(buf)); + } +} + +void DoStrTest(const WCHAR *formatstr, char *param, const WCHAR *checkstr) +{ + WCHAR buf[256] = { 0 }; + + TestVsnwprintf_s(buf, 256, formatstr, param); + + if (memcmp(buf, checkstr, wcslen(buf) * 2 + 2) != 0) + { + Fail("ERROR: failed to insert wide string \"%s\" into \"%s\".\n" + "Expected \"%s\", got \"%s\".\n", + param, convertC(formatstr), convertC(checkstr), + convertC(buf)); + } +} + +void DoCharTest(const WCHAR *formatstr, char param, const WCHAR *checkstr) +{ + WCHAR buf[256] = { 0 }; + + TestVsnwprintf_s(buf, 256, formatstr, param); + if (memcmp(buf, checkstr, wcslen(buf)*2 + 2) != 0) + { + Fail("ERROR: failed to insert char \'%c\' (%d) into \"%s\"\n" + "Expected \"%s\" got \"%s\".\n", + param, param, convertC(formatstr), convertC(checkstr), + convertC(buf)); + } +} + +void DoWCharTest(const WCHAR *formatstr, WCHAR param, const WCHAR *checkstr) +{ + WCHAR buf[256] = { 0 }; + + TestVsnwprintf_s(buf, 256, formatstr, param); + if (memcmp(buf, checkstr, wcslen(buf)*2 + 2) != 0) + { + Fail("ERROR: failed to insert wide char \'%c\' (%d) into \"%s\"\n" + "Expected \"%s\" got \"%s\".\n", + (char) param, param, convertC(formatstr), + convertC(checkstr), convertC(buf)); + } +} + +void DoNumTest(const WCHAR *formatstr, int value, const WCHAR *checkstr) +{ + WCHAR buf[256] = { 0 }; + + TestVsnwprintf_s(buf, 256, formatstr, value); + if (memcmp(buf, checkstr, wcslen(buf)* 2 + 2) != 0) + { + Fail("ERROR: failed to insert %#x into \"%s\"\n" + "Expected \"%s\" got \"%s\".\n", value, convertC(formatstr), + convertC(checkstr), convertC(buf)); + } +} + +void DoI64NumTest(const WCHAR *formatstr, INT64 value, char *valuestr, const WCHAR *checkstr) +{ + WCHAR buf[256] = { 0 }; + + TestVsnwprintf_s(buf, 256, formatstr, value); + if (memcmp(buf, checkstr, wcslen(buf)* 2 + 2) != 0) + { + Fail("ERROR: failed to insert %s into \"%s\"\n" + "Expected \"%s\" got \"%s\".\n", valuestr, convertC(formatstr), + convertC(checkstr), convertC(buf)); + } +} +void DoDoubleTest(const WCHAR *formatstr, double value, + const WCHAR *checkstr1, const WCHAR *checkstr2) +{ + WCHAR buf[256] = { 0 }; + + TestVsnwprintf_s(buf, 256, formatstr, value); + if (memcmp(buf, checkstr1, wcslen(checkstr1) + 2) != 0 && + memcmp(buf, checkstr2, wcslen(checkstr2) + 2) != 0) + { + Fail("ERROR: failed to insert %f into \"%s\"\n" + "Expected \"%s\" or \"%s\", got \"%s\".\n", + value, + convertC(formatstr), + convertC(checkstr1), + convertC(checkstr2), + convertC(buf)); + } +} + +#endif diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test1/CMakeLists.txt new file mode 100644 index 0000000000..d1245168f3 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test1/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test1.cpp +) + +add_executable(paltest_vsnwprintf_test1 + ${SOURCES} +) + +add_dependencies(paltest_vsnwprintf_test1 coreclrpal) + +target_link_libraries(paltest_vsnwprintf_test1 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test1/test1.cpp b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test1/test1.cpp new file mode 100644 index 0000000000..4a7a02e778 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test1/test1.cpp @@ -0,0 +1,60 @@ +// 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: test1.c +** +** Purpose: Test #1 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[]) +{ + WCHAR *checkstr; + WCHAR buf[256] = { 0 }; + int ret; + + if (PAL_Initialize(argc, argv) != 0) + { + return(FAIL); + } + + checkstr = convert("hello world"); + TestVsnwprintf_s(buf, 256, checkstr); + if (memcmp(checkstr, buf, wcslen(checkstr)*2+2) != 0) + { + Fail("ERROR: Expected \"%s\", got \"%s\"\n", + convertC(checkstr), convertC(buf)); + } + + TestVsnwprintf_s(buf, 256, convert("xxxxxxxxxxxxxxxxx")); + ret = TestVsnwprintf_s(buf, 8, checkstr); + if ((memcmp(checkstr, buf, 14)) != 0 || (buf[7] != 0)) + { + Fail("ERROR: Expected \"%8s\", got \"%8s\"\n", + convertC(checkstr), convertC(buf)); + } + if (ret >= 0) + { + Fail("ERROR: Expected negative return value, got %d.\n", ret); + } + if (buf[8] != (WCHAR) 'x') + { + Fail("ERROR: buffer overflow using \"%s\" with length 8.\n", + convertC(checkstr)); + } + + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test1/testinfo.dat new file mode 100644 index 0000000000..450c5b9034 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test1/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 = test1 +Description += Tests the PAL implementation of the _vsnwprintf_s function. += General test to see if _vsnwprintf_s works correctly. += This test is modeled after _snwprintf. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test10/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test10/CMakeLists.txt new file mode 100644 index 0000000000..6367964f1d --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test10/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test10.cpp +) + +add_executable(paltest_vsnwprintf_test10 + ${SOURCES} +) + +add_dependencies(paltest_vsnwprintf_test10 coreclrpal) + +target_link_libraries(paltest_vsnwprintf_test10 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test10/test10.cpp b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test10/test10.cpp new file mode 100644 index 0000000000..e33f2281df --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test10/test10.cpp @@ -0,0 +1,50 @@ +// 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: test10.c +** +** Purpose: Test #10 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[]) +{ + int neg = -42; + int pos = 42; + INT64 l = 42; + + if (PAL_Initialize(argc, argv) != 0) + { + return(FAIL); + } + + DoNumTest(convert("foo %o"), pos, convert("foo 52")); + DoNumTest(convert("foo %lo"), 0xFFFF, convert("foo 177777")); + DoNumTest(convert("foo %ho"), 0xFFFF, convert("foo 177777")); + DoNumTest(convert("foo %Lo"), pos, convert("foo 52")); + DoI64NumTest(convert("foo %I64o"), l, "42", convert("foo 52")); + DoNumTest(convert("foo %3o"), pos, convert("foo 52")); + DoNumTest(convert("foo %-3o"), pos, convert("foo 52 ")); + DoNumTest(convert("foo %.1o"), pos, convert("foo 52")); + DoNumTest(convert("foo %.3o"), pos, convert("foo 052")); + DoNumTest(convert("foo %03o"), pos, convert("foo 052")); + DoNumTest(convert("foo %#o"), pos, convert("foo 052")); + DoNumTest(convert("foo %+o"), pos, convert("foo 52")); + DoNumTest(convert("foo % o"), pos, convert("foo 52")); + DoNumTest(convert("foo %+o"), neg, convert("foo 37777777726")); + DoNumTest(convert("foo % o"), neg, convert("foo 37777777726")); + + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test10/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test10/testinfo.dat new file mode 100644 index 0000000000..59af082f49 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test10/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 = test10 +Description += Tests the PAL implementation of the _vsnwprintf_s function. += Tests _vsnwprintf_s with octal numbers. += This test is modeled after _snwprintf. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test11/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test11/CMakeLists.txt new file mode 100644 index 0000000000..b45fd0ed1e --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test11/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test11.cpp +) + +add_executable(paltest_vsnwprintf_test11 + ${SOURCES} +) + +add_dependencies(paltest_vsnwprintf_test11 coreclrpal) + +target_link_libraries(paltest_vsnwprintf_test11 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test11/test11.cpp b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test11/test11.cpp new file mode 100644 index 0000000000..4e860bbc21 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test11/test11.cpp @@ -0,0 +1,50 @@ +// 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: test11.c +** +** Purpose: Test #11 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[]) +{ + int neg = -42; + int pos = 42; + INT64 l = 42; + + if (PAL_Initialize(argc, argv) != 0) + { + return(FAIL); + } + + DoNumTest(convert("foo %u"), pos, convert("foo 42")); + DoNumTest(convert("foo %lu"), 0xFFFF, convert("foo 65535")); + DoNumTest(convert("foo %hu"), 0xFFFF, convert("foo 65535")); + DoNumTest(convert("foo %Lu"), pos, convert("foo 42")); + DoI64NumTest(convert("foo %I64u"), l, "42", convert("foo 42")); + DoNumTest(convert("foo %3u"), pos, convert("foo 42")); + DoNumTest(convert("foo %-3u"), pos, convert("foo 42 ")); + DoNumTest(convert("foo %.1u"), pos, convert("foo 42")); + DoNumTest(convert("foo %.3u"), pos, convert("foo 042")); + DoNumTest(convert("foo %03u"), pos, convert("foo 042")); + DoNumTest(convert("foo %#u"), pos, convert("foo 42")); + DoNumTest(convert("foo %+u"), pos, convert("foo 42")); + DoNumTest(convert("foo % u"), pos, convert("foo 42")); + DoNumTest(convert("foo %+u"), neg, convert("foo 4294967254")); + DoNumTest(convert("foo % u"), neg, convert("foo 4294967254")); + + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test11/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test11/testinfo.dat new file mode 100644 index 0000000000..10c0014fca --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test11/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 = test11 +Description += Tests the PAL implementation of the _vsnwprintf_s function. += Tests _vsnwprintf_s with unsigned numbers. += This test is modeled after _snwprintf. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test12/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test12/CMakeLists.txt new file mode 100644 index 0000000000..2a15b198c0 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test12/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test12.cpp +) + +add_executable(paltest_vsnwprintf_test12 + ${SOURCES} +) + +add_dependencies(paltest_vsnwprintf_test12 coreclrpal) + +target_link_libraries(paltest_vsnwprintf_test12 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test12/test12.cpp b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test12/test12.cpp new file mode 100644 index 0000000000..2dcfcf5998 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test12/test12.cpp @@ -0,0 +1,50 @@ +// 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: test12.c +** +** Purpose: Test #12 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[]) +{ + int neg = -42; + int pos = 0x1234ab; + INT64 l = I64(0x1234567887654321); + + if (PAL_Initialize(argc, argv) != 0) + { + return(FAIL); + } + + DoNumTest(convert("foo %x"), pos, convert("foo 1234ab")); + DoNumTest(convert("foo %lx"), pos, convert("foo 1234ab")); + DoNumTest(convert("foo %hx"), pos, convert("foo 34ab")); + DoNumTest(convert("foo %Lx"), pos, convert("foo 1234ab")); + DoI64NumTest(convert("foo %I64x"), l, "0x1234567887654321", + convert("foo 1234567887654321")); + DoNumTest(convert("foo %7x"), pos, convert("foo 1234ab")); + DoNumTest(convert("foo %-7x"), pos, convert("foo 1234ab ")); + DoNumTest(convert("foo %.1x"), pos, convert("foo 1234ab")); + DoNumTest(convert("foo %.7x"), pos, convert("foo 01234ab")); + DoNumTest(convert("foo %07x"), pos, convert("foo 01234ab")); + DoNumTest(convert("foo %#x"), pos, convert("foo 0x1234ab")); + DoNumTest(convert("foo %+x"), pos, convert("foo 1234ab")); + DoNumTest(convert("foo % x"), pos, convert("foo 1234ab")); + DoNumTest(convert("foo %+x"), neg, convert("foo ffffffd6")); + DoNumTest(convert("foo % x"), neg, convert("foo ffffffd6")); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test12/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test12/testinfo.dat new file mode 100644 index 0000000000..de089895b9 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test12/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 = test12 +Description += Tests the PAL implementation of the _vsnwprintf_s function. += Tests _vsnwprintf_s with hex numbers (lowercase). += This test is modeled after _snwprintf. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test13/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test13/CMakeLists.txt new file mode 100644 index 0000000000..01ab97cc62 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test13/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test13.cpp +) + +add_executable(paltest_vsnwprintf_test13 + ${SOURCES} +) + +add_dependencies(paltest_vsnwprintf_test13 coreclrpal) + +target_link_libraries(paltest_vsnwprintf_test13 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test13/test13.cpp b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test13/test13.cpp new file mode 100644 index 0000000000..c95278a56b --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test13/test13.cpp @@ -0,0 +1,50 @@ +// 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: test13.c +** +** Purpose: Test #13 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[]) +{ + int neg = -42; + int pos = 0x1234ab; + INT64 l = I64(0x1234567887654321); + + if (PAL_Initialize(argc, argv) != 0) + { + return(FAIL); + } + + DoNumTest(convert("foo %X"), pos, convert("foo 1234AB")); + DoNumTest(convert("foo %lX"), pos, convert("foo 1234AB")); + DoNumTest(convert("foo %hX"), pos, convert("foo 34AB")); + DoNumTest(convert("foo %LX"), pos, convert("foo 1234AB")); + DoI64NumTest(convert("foo %I64X"), l, "0x1234567887654321", + convert("foo 1234567887654321")); + DoNumTest(convert("foo %7X"), pos, convert("foo 1234AB")); + DoNumTest(convert("foo %-7X"), pos, convert("foo 1234AB ")); + DoNumTest(convert("foo %.1X"), pos, convert("foo 1234AB")); + DoNumTest(convert("foo %.7X"), pos, convert("foo 01234AB")); + DoNumTest(convert("foo %07X"), pos, convert("foo 01234AB")); + DoNumTest(convert("foo %#X"), pos, convert("foo 0X1234AB")); + DoNumTest(convert("foo %+X"), pos, convert("foo 1234AB")); + DoNumTest(convert("foo % X"), pos, convert("foo 1234AB")); + DoNumTest(convert("foo %+X"), neg, convert("foo FFFFFFD6")); + DoNumTest(convert("foo % X"), neg, convert("foo FFFFFFD6")); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test13/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test13/testinfo.dat new file mode 100644 index 0000000000..94479d527c --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test13/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 = test13 +Description += Tests the PAL implementation of the _vsnwprintf_s function. += Tests _vsnwprintf_s with hex numbers (uppercase). += This test is modeled after _snwprintf. 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. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test15/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test15/CMakeLists.txt new file mode 100644 index 0000000000..e1a32b1825 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test15/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test15.cpp +) + +add_executable(paltest_vsnwprintf_test15 + ${SOURCES} +) + +add_dependencies(paltest_vsnwprintf_test15 coreclrpal) + +target_link_libraries(paltest_vsnwprintf_test15 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test15/test15.cpp b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test15/test15.cpp new file mode 100644 index 0000000000..d5738991a6 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test15/test15.cpp @@ -0,0 +1,64 @@ +// 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: test15.c +** +** Purpose: Test #15 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+002")); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test15/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test15/testinfo.dat new file mode 100644 index 0000000000..7737f49a35 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test15/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 = test15 +Description += Tests the PAL implementation of the _vsnwprintf_s function. += Tests _vsnwprintf_s with exponential format doubles (uppercase). += This test is modeled after _snwprintf. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test16/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test16/CMakeLists.txt new file mode 100644 index 0000000000..9e2b25b308 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test16/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test16.cpp +) + +add_executable(paltest_vsnwprintf_test16 + ${SOURCES} +) + +add_dependencies(paltest_vsnwprintf_test16 coreclrpal) + +target_link_libraries(paltest_vsnwprintf_test16 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test16/test16.cpp b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test16/test16.cpp new file mode 100644 index 0000000000..72c546eb63 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test16/test16.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: test16.c +** +** Purpose: Test #16 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 = 2560.001; + double neg = -2560.001; + + if (PAL_Initialize(argc, argv) != 0) + { + return(FAIL); + } + + DoDoubleTest(convert("foo %f"), val, convert("foo 2560.001000"), + convert("foo 2560.001000")); + DoDoubleTest(convert("foo %lf"), val, convert("foo 2560.001000"), + convert("foo 2560.001000")); + DoDoubleTest(convert("foo %hf"), val, convert("foo 2560.001000"), + convert("foo 2560.001000")); + DoDoubleTest(convert("foo %Lf"), val, convert("foo 2560.001000"), + convert("foo 2560.001000")); + DoDoubleTest(convert("foo %I64f"), val, convert("foo 2560.001000"), + convert("foo 2560.001000")); + DoDoubleTest(convert("foo %12f"), val, convert("foo 2560.001000"), + convert("foo 2560.001000")); + DoDoubleTest(convert("foo %-12f"), val, convert("foo 2560.001000 "), + convert("foo 2560.001000 ")); + DoDoubleTest(convert("foo %.1f"), val, convert("foo 2560.0"), + convert("foo 2560.0")); + DoDoubleTest(convert("foo %.8f"), val, convert("foo 2560.00100000"), + convert("foo 2560.00100000")); + DoDoubleTest(convert("foo %012f"), val, convert("foo 02560.001000"), + convert("foo 02560.001000")); + DoDoubleTest(convert("foo %#f"), val, convert("foo 2560.001000"), + convert("foo 2560.001000")); + DoDoubleTest(convert("foo %+f"), val, convert("foo +2560.001000"), + convert("foo +2560.001000")); + DoDoubleTest(convert("foo % f"), val, convert("foo 2560.001000"), + convert("foo 2560.001000")); + DoDoubleTest(convert("foo %+f"), neg, convert("foo -2560.001000"), + convert("foo -2560.001000")); + DoDoubleTest(convert("foo % f"), neg, convert("foo -2560.001000"), + convert("foo -2560.001000")); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test16/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test16/testinfo.dat new file mode 100644 index 0000000000..9aec1c008a --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test16/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 = test16 +Description += Tests the PAL implementation of the _vsnwprintf_s function. += Tests _vsnwprintf_s with decimal point format doubles. += This test is modeled after _snwprintf. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test17/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test17/CMakeLists.txt new file mode 100644 index 0000000000..2d8ba31a08 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test17/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test17.cpp +) + +add_executable(paltest_vsnwprintf_test17 + ${SOURCES} +) + +add_dependencies(paltest_vsnwprintf_test17 coreclrpal) + +target_link_libraries(paltest_vsnwprintf_test17 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test17/test17.cpp b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test17/test17.cpp new file mode 100644 index 0000000000..e6860b930f --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test17/test17.cpp @@ -0,0 +1,65 @@ +// 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: test17.c +** +** Purpose: Test #17 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 = 2560.001; + double neg = -2560.001; + + if (PAL_Initialize(argc, argv) != 0) + { + return(FAIL); + } + + DoDoubleTest(convert("foo %g"), val, convert("foo 2560"), + convert("foo 2560")); + DoDoubleTest(convert("foo %lg"), val, convert("foo 2560"), + convert("foo 2560")); + DoDoubleTest(convert("foo %hg"), val, convert("foo 2560"), + convert("foo 2560")); + DoDoubleTest(convert("foo %Lg"), val, convert("foo 2560"), + convert("foo 2560")); + DoDoubleTest(convert("foo %I64g"), val, convert("foo 2560"), + convert("foo 2560")); + DoDoubleTest(convert("foo %5g"), val, convert("foo 2560"), + convert("foo 2560")); + DoDoubleTest(convert("foo %-5g"), val, convert("foo 2560 "), + convert("foo 2560 ")); + DoDoubleTest(convert("foo %.1g"), val, convert("foo 3e+003"), + convert("foo 3e+03")); + DoDoubleTest(convert("foo %.2g"), val, convert("foo 2.6e+003"), + convert("foo 2.6e+03")); + DoDoubleTest(convert("foo %.12g"), val, convert("foo 2560.001"), + convert("foo 2560.001")); + DoDoubleTest(convert("foo %06g"), val, convert("foo 002560"), + convert("foo 002560")); + DoDoubleTest(convert("foo %#g"), val, convert("foo 2560.00"), + convert("foo 2560.00")); + DoDoubleTest(convert("foo %+g"), val, convert("foo +2560"), + convert("foo +2560")); + DoDoubleTest(convert("foo % g"), val, convert("foo 2560"), + convert("foo 2560")); + DoDoubleTest(convert("foo %+g"), neg, convert("foo -2560"), + convert("foo -2560")); + DoDoubleTest(convert("foo % g"), neg, convert("foo -2560"), + convert("foo -2560")); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test17/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test17/testinfo.dat new file mode 100644 index 0000000000..1487b7a17e --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test17/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 = test17 +Description += Tests the PAL implementation of the _vsnwprintf_s function. += Tests _vsnwprintf_s with compact format doubles (lowercase). += This test is modeled after _snwprintf. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test18/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test18/CMakeLists.txt new file mode 100644 index 0000000000..503856c2f3 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test18/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test18.cpp +) + +add_executable(paltest_vsnwprintf_test18 + ${SOURCES} +) + +add_dependencies(paltest_vsnwprintf_test18 coreclrpal) + +target_link_libraries(paltest_vsnwprintf_test18 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test18/test18.cpp b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test18/test18.cpp new file mode 100644 index 0000000000..a164edbc0f --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test18/test18.cpp @@ -0,0 +1,65 @@ +// 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: test18.c +** +** Purpose: Test #18 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 = 2560.001; + double neg = -2560.001; + + if (PAL_Initialize(argc, argv) != 0) + { + return(FAIL); + } + + DoDoubleTest(convert("foo %G"), val, convert("foo 2560"), + convert("foo 2560")); + DoDoubleTest(convert("foo %lG"), val, convert("foo 2560"), + convert("foo 2560")); + DoDoubleTest(convert("foo %hG"), val, convert("foo 2560"), + convert("foo 2560")); + DoDoubleTest(convert("foo %LG"), val, convert("foo 2560"), + convert("foo 2560")); + DoDoubleTest(convert("foo %I64G"), val, convert("foo 2560"), + convert("foo 2560")); + DoDoubleTest(convert("foo %5G"), val, convert("foo 2560"), + convert("foo 2560")); + DoDoubleTest(convert("foo %-5G"), val, convert("foo 2560 "), + convert("foo 2560 ")); + DoDoubleTest(convert("foo %.1G"), val, convert("foo 3E+003"), + convert("foo 3E+03")); + DoDoubleTest(convert("foo %.2G"), val, convert("foo 2.6E+003"), + convert("foo 2.6E+03")); + DoDoubleTest(convert("foo %.12G"), val, convert("foo 2560.001"), + convert("foo 2560.001")); + DoDoubleTest(convert("foo %06G"), val, convert("foo 002560"), + convert("foo 002560")); + DoDoubleTest(convert("foo %#G"), val, convert("foo 2560.00"), + convert("foo 2560.00")); + DoDoubleTest(convert("foo %+G"), val, convert("foo +2560"), + convert("foo +2560")); + DoDoubleTest(convert("foo % G"), val, convert("foo 2560"), + convert("foo 2560")); + DoDoubleTest(convert("foo %+G"), neg, convert("foo -2560"), + convert("foo -2560")); + DoDoubleTest(convert("foo % G"), neg, convert("foo -2560"), + convert("foo -2560")); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test18/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test18/testinfo.dat new file mode 100644 index 0000000000..54c4e87c89 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test18/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 = test18 +Description += Tests the PAL implementation of the _vsnwprintf_s function. += Tests _vsnwprintf_s with compact format doubles (uppercase). += This test is modeled after _snwprintf. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test19/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test19/CMakeLists.txt new file mode 100644 index 0000000000..68485eff12 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test19/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test19.cpp +) + +add_executable(paltest_vsnwprintf_test19 + ${SOURCES} +) + +add_dependencies(paltest_vsnwprintf_test19 coreclrpal) + +target_link_libraries(paltest_vsnwprintf_test19 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test19/test19.cpp b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test19/test19.cpp new file mode 100644 index 0000000000..c2a85478ae --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test19/test19.cpp @@ -0,0 +1,139 @@ +// 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: test18.c +** +** Purpose: Test #18 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 */ + +#define DOTEST(a,b,c,d,e) DoTest(a,b,(void*)c,d,e) + +void DoArgumentPrecTest(WCHAR *formatstr, int precision, void *param, + WCHAR *paramstr, WCHAR *checkstr1, WCHAR *checkstr2) +{ + WCHAR buf[256]; + + TestVsnwprintf_s(buf, 256, formatstr, precision, param); + if (memcmp(buf, checkstr1, wcslen(checkstr1) + 2) != 0 && + memcmp(buf, checkstr2, wcslen(checkstr2) + 2) != 0) + { + Fail("ERROR: failed to insert %s into \"%s\" with precision %d\n" + "Expected \"%s\" or \"%s\", got \"%s\".\n", + paramstr, + convertC(formatstr), + precision, + convertC(checkstr1), + convertC(checkstr2), + convertC(buf)); + } +} +void DoArgumentPrecDoubleTest(WCHAR *formatstr, int precision, double param, + WCHAR *checkstr1, WCHAR *checkstr2) +{ + WCHAR buf[256]; + + TestVsnwprintf_s(buf, 256, formatstr, precision, param); + if (memcmp(buf, checkstr1, wcslen(checkstr1) + 2) != 0 && + memcmp(buf, checkstr2, wcslen(checkstr2) + 2) != 0) + { + Fail("ERROR: failed to insert %f into \"%s\" with precision %d\n" + "Expected \"%s\" or \"%s\", got \"%s\".\n", + param, convertC(formatstr), + precision, + convertC(checkstr1), + convertC(checkstr2), + convertC(buf)); + } +} + +/* + * Uses memcmp & wcslen + */ + +int __cdecl main(int argc, char *argv[]) +{ + + if (PAL_Initialize(argc, argv) != 0) + { + return(FAIL); + } + + DoArgumentPrecTest(convert("%.*s"), 2, (void*)convert("bar"), convert("bar"), + convert("ba"), convert("ba")); + DoArgumentPrecTest(convert("%.*c"), 0, (void*)'a', convert("a"), + convert("a"), convert("a")); + DoArgumentPrecTest(convert("%.*c"), 4, (void*)'a', convert("a"), + convert("a"), convert("a")); + DoArgumentPrecTest(convert("%.*C"), 0, (void*)'a', convert("a"), + convert("a"), convert("a")); + DoArgumentPrecTest(convert("%.*C"), 4, (void*)'a', convert("a"), + convert("a"), convert("a")); + DoArgumentPrecTest(convert("%.*d"), 1, (void*)42, convert("42"), + convert("42"), convert("42")); + DoArgumentPrecTest(convert("%.*d"), 3, (void*)42, convert("42"), + convert("042"), convert("042")); + DoArgumentPrecTest(convert("%.*i"), 1, (void*)42, convert("42"), + convert("42"), convert("42")); + DoArgumentPrecTest(convert("%.*i"), 3, (void*)42, convert("42"), + convert("042"), convert("042")); + DoArgumentPrecTest(convert("%.*o"), 1, (void*)42, convert("42"), + convert("52"), convert("52")); + DoArgumentPrecTest(convert("%.*o"), 3, (void*)42, convert("42"), + convert("052"), convert("052")); + DoArgumentPrecTest(convert("%.*u"), 1, (void*)42, convert("42"), + convert("42"), convert("42")); + DoArgumentPrecTest(convert("%.*u"), 3, (void*)42, convert("42"), + convert("042"), convert("042")); + DoArgumentPrecTest(convert("%.*x"), 1, (void*)0x42, convert("0x42"), + convert("42"), convert("42")); + DoArgumentPrecTest(convert("%.*x"), 3, (void*)0x42, convert("0x42"), + convert("042"), convert("042")); + DoArgumentPrecTest(convert("%.*X"), 1, (void*)0x42, convert("0x42"), + convert("42"), convert("42")); + DoArgumentPrecTest(convert("%.*X"), 3, (void*)0x42, convert("0x42"), + convert("042"), convert("042")); + + + DoArgumentPrecDoubleTest(convert("%.*e"), 1, 2.01, convert("2.0e+000"), + convert("2.0e+00")); + DoArgumentPrecDoubleTest(convert("%.*e"), 3, 2.01, convert("2.010e+000"), + convert("2.010e+00")); + DoArgumentPrecDoubleTest(convert("%.*E"), 1, 2.01, convert("2.0E+000"), + convert("2.0E+00")); + DoArgumentPrecDoubleTest(convert("%.*E"), 3, 2.01, convert("2.010E+000"), + convert("2.010E+00")); + DoArgumentPrecDoubleTest(convert("%.*f"), 1, 2.01, convert("2.0"), + convert("2.0")); + DoArgumentPrecDoubleTest(convert("%.*f"), 3, 2.01, convert("2.010"), + convert("2.010")); + DoArgumentPrecDoubleTest(convert("%.*g"), 1, 256.01, convert("3e+002"), + convert("3e+02")); + DoArgumentPrecDoubleTest(convert("%.*g"), 3, 256.01, convert("256"), + convert("256")); + DoArgumentPrecDoubleTest(convert("%.*g"), 4, 256.01, convert("256"), + convert("256")); + DoArgumentPrecDoubleTest(convert("%.*g"), 6, 256.01, convert("256.01"), + convert("256.01")); + DoArgumentPrecDoubleTest(convert("%.*G"), 1, 256.01, convert("3E+002"), + convert("3E+02")); + DoArgumentPrecDoubleTest(convert("%.*G"), 3, 256.01, convert("256"), + convert("256")); + DoArgumentPrecDoubleTest(convert("%.*G"), 4, 256.01, convert("256"), + convert("256")); + DoArgumentPrecDoubleTest(convert("%.*G"), 6, 256.01, convert("256.01"), + convert("256.01")); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test19/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test19/testinfo.dat new file mode 100644 index 0000000000..2913e30406 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test19/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 = test19 +Description += Tests the PAL implementation of the _vsnwprintf_s function. += Tests _vsnwprintf_s with argument specified precision. += This test is modeled after _snwprintf. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test2/CMakeLists.txt new file mode 100644 index 0000000000..a512be6e47 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test2/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test2.cpp +) + +add_executable(paltest_vsnwprintf_test2 + ${SOURCES} +) + +add_dependencies(paltest_vsnwprintf_test2 coreclrpal) + +target_link_libraries(paltest_vsnwprintf_test2 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test2/test2.cpp b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test2/test2.cpp new file mode 100644 index 0000000000..18e5adffd3 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test2/test2.cpp @@ -0,0 +1,40 @@ +// 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: test2.c +** +** Purpose: Test #2 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[]) +{ + if (PAL_Initialize(argc, argv) != 0) + return(FAIL); + + DoWStrTest(convert("foo %s"), convert("bar"), convert("foo bar")); + DoStrTest(convert("foo %hs"), "bar", convert("foo bar")); + DoWStrTest(convert("foo %ls"), convert("bar"), convert("foo bar")); + DoWStrTest(convert("foo %ws"), convert("bar"), convert("foo bar")); + DoWStrTest(convert("foo %Ls"), convert("bar"), convert("foo bar")); + DoWStrTest(convert("foo %I64s"), convert("bar"), convert("foo bar")); + DoWStrTest(convert("foo %5s"), convert("bar"), convert("foo bar")); + DoWStrTest(convert("foo %.2s"), convert("bar"), convert("foo ba")); + DoWStrTest(convert("foo %5.2s"), convert("bar"), convert("foo ba")); + DoWStrTest(convert("foo %-5s"), convert("bar"), convert("foo bar ")); + DoWStrTest(convert("foo %05s"), convert("bar"), convert("foo 00bar")); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test2/testinfo.dat new file mode 100644 index 0000000000..5b9b6292dc --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test2/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 = test2 +Description += Tests the PAL implementation of the _vsnwprintf_s function. += Tests _vsnwprintf_s with strings. += This test is modeled after _snwprintf. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test3/CMakeLists.txt new file mode 100644 index 0000000000..7991c25afc --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test3/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test3.cpp +) + +add_executable(paltest_vsnwprintf_test3 + ${SOURCES} +) + +add_dependencies(paltest_vsnwprintf_test3 coreclrpal) + +target_link_libraries(paltest_vsnwprintf_test3 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test3/test3.cpp b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test3/test3.cpp new file mode 100644 index 0000000000..5e2bfa21a0 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test3/test3.cpp @@ -0,0 +1,40 @@ +// 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: test3.c +** +** Purpose: Test #3 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[]) +{ + if (PAL_Initialize(argc, argv) != 0) + return(FAIL); + + DoStrTest(convert("foo %S"), "bar", convert("foo bar")); + DoStrTest(convert("foo %hS"), "bar", convert("foo bar")); + DoWStrTest(convert("foo %lS"), convert("bar"), convert("foo bar")); + DoWStrTest(convert("foo %wS"), convert("bar"), convert("foo bar")); + DoStrTest(convert("foo %LS"), "bar", convert("foo bar")); + DoStrTest(convert("foo %I64S"), "bar", convert("foo bar")); + DoStrTest(convert("foo %5S"), "bar", convert("foo bar")); + DoStrTest(convert("foo %.2S"), "bar", convert("foo ba")); + DoStrTest(convert("foo %5.2S"), "bar", convert("foo ba")); + DoStrTest(convert("foo %-5S"), "bar", convert("foo bar ")); + DoStrTest(convert("foo %05S"), "bar", convert("foo 00bar")); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test3/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test3/testinfo.dat new file mode 100644 index 0000000000..62160695e6 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test3/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 = test3 +Description += Tests the PAL implementation of the _vsnwprintf_s function. += Tests _vsnwprintf_s with wide strings. += This test is modeled after _snwprintf. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test4/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test4/CMakeLists.txt new file mode 100644 index 0000000000..18f5d02df2 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test4/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test4.cpp +) + +add_executable(paltest_vsnwprintf_test4 + ${SOURCES} +) + +add_dependencies(paltest_vsnwprintf_test4 coreclrpal) + +target_link_libraries(paltest_vsnwprintf_test4 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test4/test4.cpp b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test4/test4.cpp new file mode 100644 index 0000000000..3627ff8bc8 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test4/test4.cpp @@ -0,0 +1,121 @@ +// 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: test4.c +** +** Purpose: Test #4 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 */ +static void DoPointerTest(WCHAR *formatstr, void* param, WCHAR* paramstr, + WCHAR *checkstr1) +{ + WCHAR buf[256] = { 0 }; + + TestVsnwprintf_s(buf, 256, formatstr, param); + if (memcmp(buf, checkstr1, wcslen(checkstr1) + 2) != 0) + + { + Fail("ERROR: failed to insert pointer to %#p into \"%s\"\n" + "Expected \"%s\" got \"%s\".\n", + paramstr, + convertC(formatstr), + convertC(checkstr1), + convertC(buf)); + } +} + +static void DoI64DoubleTest(WCHAR *formatstr, INT64 value, WCHAR *valuestr, + WCHAR *checkstr1) +{ + WCHAR buf[256] = { 0 }; + + TestVsnwprintf_s(buf, 256, formatstr, value); + if (memcmp(buf, checkstr1, wcslen(checkstr1) + 2) != 0) + { + Fail("ERROR: failed to insert %s into \"%s\"\n" + "Expected \"%s\", got \"%s\".\n", + value, + convertC(formatstr), + convertC(checkstr1), + convertC(buf)); + } +} + +int __cdecl main(int argc, char *argv[]) +{ + void *ptr = (void*) 0x123456; + INT64 lptr = I64(0x1234567887654321); + + if (PAL_Initialize(argc, argv) != 0) + { + return(FAIL); + } + +/* +** Run only on 64 bit platforms +*/ +#if defined(BIT64) && defined(PLATFORM_UNIX) + Trace("Testing for 64 Bit Platforms \n"); + DoPointerTest(convert("%p"), NULL, convert("NULL"), convert("00000000")); + DoPointerTest(convert("%p"), ptr, convert("pointer to 0x123456"), + convert("0000000000123456")); + DoPointerTest(convert("%17p"), ptr, convert("pointer to 0x123456"), + convert(" 0000000000123456")); + DoPointerTest(convert("%17p"), ptr, convert("pointer to 0x123456"), + convert(" 0000000000123456")); + DoPointerTest(convert("%-17p"), ptr, convert("pointer to 0x123456"), + convert("0000000000123456 ")); + DoPointerTest(convert("%+p"), ptr, convert("pointer to 0x123456"), + convert("0000000000123456")); + DoPointerTest(convert("%#p"), ptr, convert("pointer to 0x123456"), + convert("0X0000000000123456")); + DoPointerTest(convert("%lp"), ptr, convert("pointer to 0x123456"), + convert("00123456")); + DoPointerTest(convert("%hp"), ptr, convert("pointer to 0x123456"), + convert("00003456")); + DoPointerTest(convert("%Lp"), ptr, convert("pointer to 0x123456"), + convert("00123456")); + DoI64DoubleTest(convert("%I64p"), lptr, + convert("pointer to 0x1234567887654321"), + convert("1234567887654321")); + +#else + Trace("Testing for Non 64 Bit Platforms \n"); + DoPointerTest(convert("%p"), NULL, convert("NULL"), convert("00000000")); + DoPointerTest(convert("%p"), ptr, convert("pointer to 0x123456"), + convert("00123456")); + DoPointerTest(convert("%9p"), ptr, convert("pointer to 0x123456"), + convert(" 00123456")); + DoPointerTest(convert("%09p"), ptr, convert("pointer to 0x123456"), + convert(" 00123456")); + DoPointerTest(convert("%-9p"), ptr, convert("pointer to 0x123456"), + convert("00123456 ")); + DoPointerTest(convert("%+p"), ptr, convert("pointer to 0x123456"), + convert("00123456")); + DoPointerTest(convert("%#p"), ptr, convert("pointer to 0x123456"), + convert("0X00123456")); + DoPointerTest(convert("%lp"), ptr, convert("pointer to 0x123456"), + convert("00123456")); + DoPointerTest(convert("%hp"), ptr, convert("pointer to 0x123456"), + convert("00003456")); + DoPointerTest(convert("%Lp"), ptr, convert("pointer to 0x123456"), + convert("00123456")); + DoI64DoubleTest(convert("%I64p"), lptr, + convert("pointer to 0x1234567887654321"), + convert("1234567887654321")); +#endif + + PAL_Terminate(); + return PASS; +} + diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test4/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test4/testinfo.dat new file mode 100644 index 0000000000..9fbfcba5cf --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test4/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 = test4 +Description += Tests the PAL implementation of the _vsnwprintf_s function. += Tests _vsnwprintf_s with pointers. += This test is modeled after _snwprintf. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test6/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test6/CMakeLists.txt new file mode 100644 index 0000000000..c431da4a00 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test6/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test6.cpp +) + +add_executable(paltest_vsnwprintf_test6 + ${SOURCES} +) + +add_dependencies(paltest_vsnwprintf_test6 coreclrpal) + +target_link_libraries(paltest_vsnwprintf_test6 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test6/test6.cpp b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test6/test6.cpp new file mode 100644 index 0000000000..ecba5853a6 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test6/test6.cpp @@ -0,0 +1,43 @@ +// 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: test6.c +** +** Purpose: Test #6 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[]) +{ + WCHAR wc = (WCHAR) 'c'; + + if (PAL_Initialize(argc, argv) != 0) + { + return(FAIL); + } + + DoWCharTest(convert("foo %c"), wc, convert("foo c")); + DoCharTest(convert("foo %hc"), 'b', convert("foo b")); + DoWCharTest(convert("foo %lc"), wc, convert("foo c")); + DoWCharTest(convert("foo %Lc"), wc, convert("foo c")); + DoWCharTest(convert("foo %I64c"), wc, convert("foo c")); + DoWCharTest(convert("foo %5c"), wc, convert("foo c")); + DoWCharTest(convert("foo %.0c"), wc, convert("foo c")); + DoWCharTest(convert("foo %-5c"), wc, convert("foo c ")); + DoWCharTest(convert("foo %05c"), wc, convert("foo 0000c")); + DoWCharTest(convert("foo % c"), wc, convert("foo c")); + DoWCharTest(convert("foo %#c"), wc, convert("foo c")); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test6/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test6/testinfo.dat new file mode 100644 index 0000000000..1b411d7982 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test6/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 = test6 +Description += Tests the PAL implementation of the _vsnwprintf_s function. += Tests _vsnwprintf_s with characters. += This test is modeled after _snwprintf. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test7/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test7/CMakeLists.txt new file mode 100644 index 0000000000..5759b836b5 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test7/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test7.cpp +) + +add_executable(paltest_vsnwprintf_test7 + ${SOURCES} +) + +add_dependencies(paltest_vsnwprintf_test7 coreclrpal) + +target_link_libraries(paltest_vsnwprintf_test7 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test7/test7.cpp b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test7/test7.cpp new file mode 100644 index 0000000000..519657a202 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test7/test7.cpp @@ -0,0 +1,43 @@ +// 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: test7.c +** +** Purpose: Test #7 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[]) +{ + WCHAR wc = (WCHAR) 'c'; + + if (PAL_Initialize(argc, argv) != 0) + { + return(FAIL); + } + + DoCharTest(convert("foo %C"), 'b', convert("foo b")); + DoWCharTest(convert("foo %hC"), wc, convert("foo c")); + DoCharTest(convert("foo %lC"), 'b', convert("foo b")); + DoCharTest(convert("foo %LC"), 'b', convert("foo b")); + DoCharTest(convert("foo %I64C"), 'b', convert("foo b")); + DoCharTest(convert("foo %5C"), 'b', convert("foo b")); + DoCharTest(convert("foo %.0C"), 'b', convert("foo b")); + DoCharTest(convert("foo %-5C"), 'b', convert("foo b ")); + DoCharTest(convert("foo %05C"), 'b', convert("foo 0000b")); + DoCharTest(convert("foo % C"), 'b', convert("foo b")); + DoCharTest(convert("foo %#C"), 'b', convert("foo b")); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test7/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test7/testinfo.dat new file mode 100644 index 0000000000..8f2ccf0b58 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test7/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 = test7 +Description += Tests the PAL implementation of the _vsnwprintf_s function. += Tests _vsnwprintf_s with wide characters. += This test is modeled after _snwprintf. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test8/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test8/CMakeLists.txt new file mode 100644 index 0000000000..5e8a6284a5 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test8/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test8.cpp +) + +add_executable(paltest_vsnwprintf_test8 + ${SOURCES} +) + +add_dependencies(paltest_vsnwprintf_test8 coreclrpal) + +target_link_libraries(paltest_vsnwprintf_test8 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test8/test8.cpp b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test8/test8.cpp new file mode 100644 index 0000000000..15641f7b9e --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test8/test8.cpp @@ -0,0 +1,49 @@ +// 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: test8.c +** +** Purpose: Test #8 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[]) +{ + int neg = -42; + int pos = 42; + INT64 l = 42; + + if (PAL_Initialize(argc, argv) != 0) + { + return(FAIL); + } + + DoNumTest(convert("foo %d"), pos, convert("foo 42")); + DoNumTest(convert("foo %ld"), 0xFFFF, convert("foo 65535")); + DoNumTest(convert("foo %hd"), 0xFFFF, convert("foo -1")); + DoNumTest(convert("foo %Ld"), pos, convert("foo 42")); + DoI64NumTest(convert("foo %I64d"), l, "42", convert("foo 42")); + DoNumTest(convert("foo %3d"), pos, convert("foo 42")); + DoNumTest(convert("foo %-3d"), pos, convert("foo 42 ")); + DoNumTest(convert("foo %.1d"), pos, convert("foo 42")); + DoNumTest(convert("foo %.3d"), pos, convert("foo 042")); + DoNumTest(convert("foo %03d"), pos, convert("foo 042")); + DoNumTest(convert("foo %#d"), pos, convert("foo 42")); + DoNumTest(convert("foo %+d"), pos, convert("foo +42")); + DoNumTest(convert("foo % d"), pos, convert("foo 42")); + DoNumTest(convert("foo %+d"), neg, convert("foo -42")); + DoNumTest(convert("foo % d"), neg, convert("foo -42")); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test8/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test8/testinfo.dat new file mode 100644 index 0000000000..905740c1bb --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test8/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 = test8 +Description += Tests the PAL implementation of the _vsnwprintf_s function. += Tests _vsnwprintf_s with decimal numbers. += This test is modeled after _snwprintf. diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test9/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test9/CMakeLists.txt new file mode 100644 index 0000000000..323365dcd9 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test9/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test9.cpp +) + +add_executable(paltest_vsnwprintf_test9 + ${SOURCES} +) + +add_dependencies(paltest_vsnwprintf_test9 coreclrpal) + +target_link_libraries(paltest_vsnwprintf_test9 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test9/test9.cpp b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test9/test9.cpp new file mode 100644 index 0000000000..38f6be21e7 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test9/test9.cpp @@ -0,0 +1,49 @@ +// 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: test9.c +** +** Purpose: Test #9 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[]) +{ + int neg = -42; + int pos = 42; + INT64 l = 42; + + if (PAL_Initialize(argc, argv) != 0) + { + return(FAIL); + } + + DoNumTest(convert("foo %i"), pos, convert("foo 42")); + DoNumTest(convert("foo %li"), 0xFFFF, convert("foo 65535")); + DoNumTest(convert("foo %hi"), 0xFFFF, convert("foo -1")); + DoNumTest(convert("foo %Li"), pos, convert("foo 42")); + DoI64NumTest(convert("foo %I64i"), l, "42", convert("foo 42")); + DoNumTest(convert("foo %3i"), pos, convert("foo 42")); + DoNumTest(convert("foo %-3i"), pos, convert("foo 42 ")); + DoNumTest(convert("foo %.1i"), pos, convert("foo 42")); + DoNumTest(convert("foo %.3i"), pos, convert("foo 042")); + DoNumTest(convert("foo %03i"), pos, convert("foo 042")); + DoNumTest(convert("foo %#i"), pos, convert("foo 42")); + DoNumTest(convert("foo %+i"), pos, convert("foo +42")); + DoNumTest(convert("foo % i"), pos, convert("foo 42")); + DoNumTest(convert("foo %+i"), neg, convert("foo -42")); + DoNumTest(convert("foo % i"), neg, convert("foo -42")); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test9/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test9/testinfo.dat new file mode 100644 index 0000000000..974efdb4cf --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test9/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 = test9 +Description += Tests the PAL implementation of the _vsnwprintf_s function. += Tests _vsnwprintf_s with integer numbers += This test is modeled after _snwprintf. diff --git a/src/pal/tests/palsuite/c_runtime/_wcsicmp/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_wcsicmp/test1/CMakeLists.txt index 5f085cc723..023b777cab 100644 --- a/src/pal/tests/palsuite/c_runtime/_wcsicmp/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_wcsicmp/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_wcsicmp_test1 diff --git a/src/pal/tests/palsuite/c_runtime/_wcsicmp/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_wcsicmp/test1/test1.cpp index dd4bb54680..dd4bb54680 100644 --- a/src/pal/tests/palsuite/c_runtime/_wcsicmp/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/_wcsicmp/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_wcslwr/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_wcslwr/test1/CMakeLists.txt index a78098f86a..b9df132d29 100644 --- a/src/pal/tests/palsuite/c_runtime/_wcslwr/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_wcslwr/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_wcslwr_test1 diff --git a/src/pal/tests/palsuite/c_runtime/_wcslwr/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_wcslwr/test1/test1.cpp index 3a758de39b..3a758de39b 100644 --- a/src/pal/tests/palsuite/c_runtime/_wcslwr/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/_wcslwr/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_wcsnicmp/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_wcsnicmp/test1/CMakeLists.txt index afd3560b10..ea22daa477 100644 --- a/src/pal/tests/palsuite/c_runtime/_wcsnicmp/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_wcsnicmp/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_wcsnicmp_test1 diff --git a/src/pal/tests/palsuite/c_runtime/_wcsnicmp/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_wcsnicmp/test1/test1.cpp index 0271bcc60d..0271bcc60d 100644 --- a/src/pal/tests/palsuite/c_runtime/_wcsnicmp/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/_wcsnicmp/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_wfopen/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_wfopen/test1/CMakeLists.txt index 96df58ee54..f7aa22d5b2 100644 --- a/src/pal/tests/palsuite/c_runtime/_wfopen/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_wfopen/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_wfopen_test1 diff --git a/src/pal/tests/palsuite/c_runtime/_wfopen/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_wfopen/test1/test1.cpp index 81d2502cd5..81d2502cd5 100644 --- a/src/pal/tests/palsuite/c_runtime/_wfopen/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/_wfopen/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_wfopen/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_wfopen/test2/CMakeLists.txt index 47203d86d5..3159889f0a 100644 --- a/src/pal/tests/palsuite/c_runtime/_wfopen/test2/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_wfopen/test2/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test2.c + test2.cpp ) add_executable(paltest_wfopen_test2 diff --git a/src/pal/tests/palsuite/c_runtime/_wfopen/test2/test2.c b/src/pal/tests/palsuite/c_runtime/_wfopen/test2/test2.cpp index 921ffef19d..921ffef19d 100644 --- a/src/pal/tests/palsuite/c_runtime/_wfopen/test2/test2.c +++ b/src/pal/tests/palsuite/c_runtime/_wfopen/test2/test2.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_wfopen/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_wfopen/test3/CMakeLists.txt index deec8bbfe6..06d0941471 100644 --- a/src/pal/tests/palsuite/c_runtime/_wfopen/test3/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_wfopen/test3/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test3.c + test3.cpp ) add_executable(paltest_wfopen_test3 diff --git a/src/pal/tests/palsuite/c_runtime/_wfopen/test3/test3.c b/src/pal/tests/palsuite/c_runtime/_wfopen/test3/test3.cpp index 3b67818bc5..3b67818bc5 100644 --- a/src/pal/tests/palsuite/c_runtime/_wfopen/test3/test3.c +++ b/src/pal/tests/palsuite/c_runtime/_wfopen/test3/test3.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_wfopen/test4/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_wfopen/test4/CMakeLists.txt index e93cdd58de..8253d75d8d 100644 --- a/src/pal/tests/palsuite/c_runtime/_wfopen/test4/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_wfopen/test4/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test4.c + test4.cpp ) add_executable(paltest_wfopen_test4 diff --git a/src/pal/tests/palsuite/c_runtime/_wfopen/test4/test4.c b/src/pal/tests/palsuite/c_runtime/_wfopen/test4/test4.cpp index 0948fa11cc..0948fa11cc 100644 --- a/src/pal/tests/palsuite/c_runtime/_wfopen/test4/test4.c +++ b/src/pal/tests/palsuite/c_runtime/_wfopen/test4/test4.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_wfopen/test5/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_wfopen/test5/CMakeLists.txt index 1530416795..8b3d064ec6 100644 --- a/src/pal/tests/palsuite/c_runtime/_wfopen/test5/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_wfopen/test5/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test5.c + test5.cpp ) add_executable(paltest_wfopen_test5 diff --git a/src/pal/tests/palsuite/c_runtime/_wfopen/test5/test5.c b/src/pal/tests/palsuite/c_runtime/_wfopen/test5/test5.cpp index 21e5ec84ed..21e5ec84ed 100644 --- a/src/pal/tests/palsuite/c_runtime/_wfopen/test5/test5.c +++ b/src/pal/tests/palsuite/c_runtime/_wfopen/test5/test5.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_wfopen/test6/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_wfopen/test6/CMakeLists.txt index c401c6f40f..bf1eaeca27 100644 --- a/src/pal/tests/palsuite/c_runtime/_wfopen/test6/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_wfopen/test6/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test6.c + test6.cpp ) add_executable(paltest_wfopen_test6 diff --git a/src/pal/tests/palsuite/c_runtime/_wfopen/test6/test6.c b/src/pal/tests/palsuite/c_runtime/_wfopen/test6/test6.cpp index 17d36a0c50..17d36a0c50 100644 --- a/src/pal/tests/palsuite/c_runtime/_wfopen/test6/test6.c +++ b/src/pal/tests/palsuite/c_runtime/_wfopen/test6/test6.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_wfopen/test7/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_wfopen/test7/CMakeLists.txt index 47f4804b43..5d04528a21 100644 --- a/src/pal/tests/palsuite/c_runtime/_wfopen/test7/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_wfopen/test7/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test7.c + test7.cpp ) add_executable(paltest_wfopen_test7 diff --git a/src/pal/tests/palsuite/c_runtime/_wfopen/test7/test7.c b/src/pal/tests/palsuite/c_runtime/_wfopen/test7/test7.cpp index 0a889adc8a..0a889adc8a 100644 --- a/src/pal/tests/palsuite/c_runtime/_wfopen/test7/test7.c +++ b/src/pal/tests/palsuite/c_runtime/_wfopen/test7/test7.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_wmakepath/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_wmakepath/CMakeLists.txt deleted file mode 100644 index f6aa0cb2d9..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_wmakepath/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -add_subdirectory(test1) - diff --git a/src/pal/tests/palsuite/c_runtime/_wmakepath/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_wmakepath/test1/CMakeLists.txt deleted file mode 100644 index 343cb41f51..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_wmakepath/test1/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test1.c -) - -add_executable(paltest_wmakepath_test1 - ${SOURCES} -) - -add_dependencies(paltest_wmakepath_test1 coreclrpal) - -target_link_libraries(paltest_wmakepath_test1 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_wmakepath/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_wmakepath/test1/test1.c deleted file mode 100644 index eb79dc6286..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_wmakepath/test1/test1.c +++ /dev/null @@ -1,76 +0,0 @@ -// 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: test1.c -** -** Purpose: Tests the PAL implementation of the _wmakepath function. -** Create a path, and ensure that it builds how it is -** supposed to. -** -** -**===================================================================*/ - -#define UNICODE - -#include <palsuite.h> - -int __cdecl main(int argc, char **argv) -{ - WCHAR FullPath[128]; - WCHAR File[] = {'t','e','s','t','\0'}; - WCHAR Ext[] = {'t','x','t','\0'}; - char * PrintResult=NULL; /* Used for printing out errors */ - char * PrintCorrect=NULL; - -#if WIN32 - WCHAR Drive[] = {'C','\0'}; - WCHAR Dir[] = {'\\','t','e','s','t','\0'}; - WCHAR PathName[] = - {'C',':','\\','t','e','s','t','\\','t','e', - 's','t','.','t','x','t','\0'}; -#else - WCHAR *Drive = NULL; - WCHAR Dir[] = {'/','t','e','s','t','\0'}; - WCHAR PathName[] = - {'/','t','e','s','t','/','t','e','s','t','.','t','x','t','\0'}; -#endif - - /* - * Initialize the PAL and return FAIL if this fails - */ - if (0 != (PAL_Initialize(argc,argv))) - { - return FAIL; - } - - _wmakepath(FullPath, Drive, Dir, File, Ext); - - if(wcscmp(FullPath,PathName) != 0) - { - PrintResult = convertC(FullPath); - PrintCorrect = convertC(PathName); - - Fail("ERROR: The pathname which was created turned out to be %s " - "when it was supposed to be %s.\n",PrintResult,PrintCorrect); - } - - - PAL_Terminate(); - return PASS; -} - - - - - - - - - - - - - diff --git a/src/pal/tests/palsuite/c_runtime/_wmakepath/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_wmakepath/test1/testinfo.dat deleted file mode 100644 index 6720d342ce..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_wmakepath/test1/testinfo.dat +++ /dev/null @@ -1,13 +0,0 @@ -# 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 = _wmakepath -Name = Positive Test for _wmakepath -TYPE = DEFAULT -EXE1 = test1 -Description -= Purpose: Tests the PAL implementation of the _wmakepath function. -= Create a path, and ensure that it builds how it is supposed to. diff --git a/src/pal/tests/palsuite/c_runtime/_wsplitpath/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_wsplitpath/CMakeLists.txt deleted file mode 100644 index f6aa0cb2d9..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_wsplitpath/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -add_subdirectory(test1) - diff --git a/src/pal/tests/palsuite/c_runtime/_wsplitpath/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_wsplitpath/test1/CMakeLists.txt deleted file mode 100644 index ee9a7a8e96..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_wsplitpath/test1/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test1.c -) - -add_executable(paltest_wsplitpath_test1 - ${SOURCES} -) - -add_dependencies(paltest_wsplitpath_test1 coreclrpal) - -target_link_libraries(paltest_wsplitpath_test1 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/_wsplitpath/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_wsplitpath/test1/test1.c deleted file mode 100644 index 305768e53a..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_wsplitpath/test1/test1.c +++ /dev/null @@ -1,151 +0,0 @@ -// 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: test1.c -** -** Purpose: Passes _wsplitpath() a series of sample paths and checks -** that it parses them as expected. -** -** -**==========================================================================*/ - - -#include <palsuite.h> - -struct testCase -{ - char path[_MAX_PATH]; /* The path to parse. */ - char drive[_MAX_DRIVE]; /* The expected values... */ - char dir[_MAX_DIR]; - char fname[_MAX_FNAME]; - char ext[_MAX_EXT]; -}; - -struct wTestCase -{ - WCHAR *path; /* The path to parse. */ - WCHAR *drive; /* The expected values... */ - WCHAR *dir; - WCHAR *fname; - WCHAR *ext; -}; - - - -int __cdecl main(int argc, char **argv) -{ - struct testCase testCases[] = - { -#if WIN32 - {"c:\\foo\\bar\\foo.bar", "c:", "\\foo\\bar\\", "foo", ".bar"}, - {"c:/foo/bar/foo.bar", "c:", "/foo/bar/", "foo", ".bar"}, - {"c:/foo/bar/foo", "c:", "/foo/bar/", "foo", ""}, - {"c:/foo/bar/.bar", "c:", "/foo/bar/", "", ".bar"}, - {"c:/foo/bar/", "c:", "/foo/bar/", "", ""}, - {"/foo/bar/foo.bar", "", "/foo/bar/", "foo", ".bar"}, - {"c:foo.bar", "c:", "", "foo", ".bar"} -#else - {"c:\\foo\\bar\\foo.bar", "","c:/foo/bar/", "foo", ".bar"}, - {"c:/foo/bar/foo.bar", "", "c:/foo/bar/", "foo", ".bar"}, - {"c:/foo/bar/foo", "", "c:/foo/bar/", "foo", ""}, - {"c:/foo/bar/.bar", "", "c:/foo/bar/", ".bar", ""}, - {"c:/foo/bar/", "", "c:/foo/bar/", "", ""}, - {"/foo/bar/foo.bar", "", "/foo/bar/", "foo", ".bar"}, - {"c:foo.bar", "", "", "c:foo", ".bar"} -#endif - }; - - struct wTestCase wTestCases[sizeof(testCases)/sizeof(struct testCase)]; - - wchar_t wDrive[_MAX_DRIVE]; - wchar_t wDir[_MAX_DIR]; - wchar_t wFname[_MAX_FNAME]; - wchar_t wExt[_MAX_EXT]; - - char *drive; - char *dir; - char *fname; - char *ext; - - int i; - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - - /*create wide character versions of the test cases*/ - for(i = 0; i < sizeof(testCases)/sizeof(struct testCase); i ++) - { - wTestCases[i].path = convert(testCases[i].path); - wTestCases[i].drive = convert(testCases[i].drive); - wTestCases[i].dir = convert(testCases[i].dir); - wTestCases[i].fname = convert(testCases[i].fname); - wTestCases[i].ext = convert(testCases[i].ext); - } - - - for (i = 0; i < sizeof(wTestCases)/sizeof(struct wTestCase); i++) - { - _wsplitpath(wTestCases[i].path, wDrive, wDir, wFname, wExt); - - /*Convert the results to regular ANSI strings.*/ - drive = convertC(wDrive); - dir = convertC(wDir); - fname = convertC(wFname); - ext = convertC(wExt); - - - /*on platforms that don't support drive letters, the drive - returned should always be "" */ - if (wcscmp(wDrive, wTestCases[i].drive) != 0) - { - Fail("_wsplitpath read the path \"%s\" and thought the drive was " - "\"%s\" instead of \"%s\"" - , testCases[i].path, drive, testCases[i].drive); - } - - if (wcscmp(wDir, wTestCases[i].dir) != 0) - { - Fail("_wsplitpath read the path \"%s\" and thought the directory " - "was \"%s\" instead of \"%s\"" - , testCases[i].path, dir, testCases[i].dir); - } - - if (wcscmp(wFname, wTestCases[i].fname) != 0) - { - Fail("_wsplitpath read the path \"%s\" and thought the filename " - "was \"%s\" instead of \"%s\"" - , testCases[i].path, fname, testCases[i].fname); - } - - if (wcscmp(wExt, wTestCases[i].ext) != 0) - { - Fail("_wsplitpath read the path \"%s\" and thought the file " - "extension was \"%s\" instead of \"%s\"" - , testCases[i].path, ext, testCases[i].ext); - } - - free(drive); - free(dir); - free(fname); - free(ext); - } - - for(i = 0; i < sizeof(testCases)/sizeof(struct testCase); i++) - { - free(wTestCases[i].path); - free(wTestCases[i].drive); - free(wTestCases[i].dir); - free(wTestCases[i].fname); - free(wTestCases[i].ext); - } - - PAL_Terminate(); - - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/_wsplitpath/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_wsplitpath/test1/testinfo.dat deleted file mode 100644 index 30be680bb4..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_wsplitpath/test1/testinfo.dat +++ /dev/null @@ -1,15 +0,0 @@ -# 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 = _wsplitpath -Name = Positive Test for _wsplitpath -TYPE = DEFAULT -EXE1 = test1 -Description -= Passes _wsplitpath() a series of sample paths and checks that it -= parses them as expected. - - diff --git a/src/pal/tests/palsuite/c_runtime/_wtoi/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_wtoi/test1/CMakeLists.txt index 9e6610fc0f..ed02fec3af 100644 --- a/src/pal/tests/palsuite/c_runtime/_wtoi/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_wtoi/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_wtoi_test1 diff --git a/src/pal/tests/palsuite/c_runtime/_wtoi/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_wtoi/test1/test1.cpp index 0b14dedd60..0b14dedd60 100644 --- a/src/pal/tests/palsuite/c_runtime/_wtoi/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/_wtoi/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/abs/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/abs/test1/CMakeLists.txt index c8a8595d01..b01d97ff2f 100644 --- a/src/pal/tests/palsuite/c_runtime/abs/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/abs/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - abs.c + abs.cpp ) add_executable(paltest_abs_test1 diff --git a/src/pal/tests/palsuite/c_runtime/abs/test1/abs.c b/src/pal/tests/palsuite/c_runtime/abs/test1/abs.cpp index 233a5dcb30..233a5dcb30 100644 --- a/src/pal/tests/palsuite/c_runtime/abs/test1/abs.c +++ b/src/pal/tests/palsuite/c_runtime/abs/test1/abs.cpp diff --git a/src/pal/tests/palsuite/c_runtime/acos/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/acos/test1/CMakeLists.txt index 978ab427e8..5bd3ae06e8 100644 --- a/src/pal/tests/palsuite/c_runtime/acos/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/acos/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_acos_test1 diff --git a/src/pal/tests/palsuite/c_runtime/acos/test1/test1.c b/src/pal/tests/palsuite/c_runtime/acos/test1/test1.cpp index c6ed0692c7..c6ed0692c7 100644 --- a/src/pal/tests/palsuite/c_runtime/acos/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/acos/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/acosf/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/acosf/CMakeLists.txt new file mode 100644 index 0000000000..5e1ef7f28b --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/acosf/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +add_subdirectory(test1) diff --git a/src/pal/tests/palsuite/c_runtime/acosf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/acosf/test1/CMakeLists.txt new file mode 100644 index 0000000000..2643647438 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/acosf/test1/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test1.c +) + +add_executable(paltest_acosf_test1 + ${SOURCES} +) + +add_dependencies(paltest_acosf_test1 coreclrpal) + +target_link_libraries(paltest_acosf_test1 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/acosf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/acosf/test1/test1.c new file mode 100644 index 0000000000..3d8668cebb --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/acosf/test1/test1.c @@ -0,0 +1,129 @@ +// 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: test1.c +** +** Purpose: Test to ensure that acosf return the correct values +** +** Dependencies: PAL_Initialize +** PAL_Terminate +** Fail +** fabs +** +**===========================================================================*/ + +#include <palsuite.h> + +// binary32 (float) has a machine epsilon of 2^-23 (approx. 1.19e-07). However, this +// is slightly too accurate when writing tests meant to run against libm implementations +// for various platforms. 2^-21 (approx. 4.76e-07) seems to be as accurate as we can get. +// +// The tests themselves will take PAL_EPSILON and adjust it according to the expected result +// so that the delta used for comparison will compare the most significant digits and ignore +// any digits that are outside the double precision range (6-9 digits). + +// For example, a test with an expect result in the format of 0.xxxxxxxxx will use PAL_EPSILON +// for the variance, while an expected result in the format of 0.0xxxxxxxxx will use +// PAL_EPSILON / 10 and and expected result in the format of x.xxxxxx will use PAL_EPSILON * 10. +#define PAL_EPSILON 4.76837158e-07 + +#define PAL_NAN sqrtf(-1.0f) +#define PAL_POSINF -logf(0.0f) +#define PAL_NEGINF logf(0.0f) + +/** + * Helper test structure + */ +struct test +{ + float value; /* value to test the function with */ + float expected; /* expected result */ + float variance; /* maximum delta between the expected and actual result */ +}; + +/** + * validate + * + * test validation function + */ +void __cdecl validate(float value, float expected, float variance) +{ + float result = acosf(value); + + /* + * The test is valid when the difference between result + * and expected is less than or equal to variance + */ + float delta = fabsf(result - expected); + + if (delta > variance) + { + Fail("acosf(%g) returned %10.9g when it should have returned %10.9g", + value, result, expected); + } +} + +/** + * validate + * + * test validation function for values returning NaN + */ +void __cdecl validate_isnan(float value) +{ + float result = acosf(value); + + if (!_isnanf(result)) + { + Fail("acosf(%g) returned %10.9g when it should have returned %10.9g", + value, result, PAL_NAN); + } +} + +/** + * main + * + * executable entry point + */ +int __cdecl main(int argc, char **argv) +{ + struct test tests[] = + { + /* value expected variance */ + { -1, 3.14159265f, PAL_EPSILON * 10 }, // expected: pi + { -0.911733915f, 2.71828183f, PAL_EPSILON * 10 }, // expected: e + { -0.668201510f, 2.30258509f, PAL_EPSILON * 10 }, // expected: ln(10) + { 0, 1.57079633f, PAL_EPSILON * 10 }, // expected: pi / 2 + { 0.127751218f, 1.44269504f, PAL_EPSILON * 10 }, // expected: logf2(e) + { 0.155943695f, 1.41421356f, PAL_EPSILON * 10 }, // expected: sqrtf(2) + { 0.428125148f, 1.12837917f, PAL_EPSILON * 10 }, // expected: 2 / sqrtf(pi) + { 0.540302306f, 1, PAL_EPSILON * 10 }, + { 0.707106781f, 0.785398163f, PAL_EPSILON }, // expected: pi / 4, value: 1 / sqrtf(2) + { 0.760244597f, 0.707106781f, PAL_EPSILON }, // expected: 1 / sqrtf(2) + { 0.769238901f, 0.693147181f, PAL_EPSILON }, // expected: ln(2) + { 0.804109828f, 0.636619772f, PAL_EPSILON }, // expected: 2 / pi + { 0.907167129f, 0.434294482f, PAL_EPSILON }, // expected: logf10f(e) + { 0.949765715f, 0.318309886f, PAL_EPSILON }, // expected: 1 / pi + { 1, 0, PAL_EPSILON }, + }; + + /* PAL initialization */ + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) + { + validate(tests[i].value, tests[i].expected, tests[i].variance); + } + + validate_isnan(PAL_NEGINF); + validate_isnan(PAL_NAN); + validate_isnan(PAL_POSINF); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/acosf/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/acosf/test1/testinfo.dat new file mode 100644 index 0000000000..41cead33bb --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/acosf/test1/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 = acosf +Name = Positive Test for acosf +TYPE = DEFAULT +EXE1 = test1 +Description += Passes a series of values to the acosf() function, += checking each for the expfected result. Also checks += for proper handling of out-of-range values. diff --git a/src/pal/tests/palsuite/c_runtime/asin/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/asin/test1/CMakeLists.txt index a3aec3f60f..510b543a59 100644 --- a/src/pal/tests/palsuite/c_runtime/asin/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/asin/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_asin_test1 diff --git a/src/pal/tests/palsuite/c_runtime/asin/test1/test1.c b/src/pal/tests/palsuite/c_runtime/asin/test1/test1.cpp index 0a63356ed0..0a63356ed0 100644 --- a/src/pal/tests/palsuite/c_runtime/asin/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/asin/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/asinf/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/asinf/CMakeLists.txt new file mode 100644 index 0000000000..5e1ef7f28b --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/asinf/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +add_subdirectory(test1) diff --git a/src/pal/tests/palsuite/c_runtime/asinf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/asinf/test1/CMakeLists.txt new file mode 100644 index 0000000000..b167bd8715 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/asinf/test1/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test1.c +) + +add_executable(paltest_asinf_test1 + ${SOURCES} +) + +add_dependencies(paltest_asinf_test1 coreclrpal) + +target_link_libraries(paltest_asinf_test1 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/asinf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/asinf/test1/test1.c new file mode 100644 index 0000000000..773015eec0 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/asinf/test1/test1.c @@ -0,0 +1,145 @@ +// 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: test1.c +** +** Purpose: Test to ensure that asinf return the correct values +** +** Dependencies: PAL_Initialize +** PAL_Terminate +** Fail +** fabs +** +**===========================================================================*/ + +#include <palsuite.h> + +// binary32 (float) has a machine epsilon of 2^-23 (approx. 1.19e-07). However, this +// is slightly too accurate when writing tests meant to run against libm implementations +// for various platforms. 2^-21 (approx. 4.76e-07) seems to be as accurate as we can get. +// +// The tests themselves will take PAL_EPSILON and adjust it according to the expected result +// so that the delta used for comparison will compare the most significant digits and ignore +// any digits that are outside the double precision range (6-9 digits). + +// For example, a test with an expect result in the format of 0.xxxxxxxxx will use PAL_EPSILON +// for the variance, while an expected result in the format of 0.0xxxxxxxxx will use +// PAL_EPSILON / 10 and and expected result in the format of x.xxxxxx will use PAL_EPSILON * 10. +#define PAL_EPSILON 4.76837158e-07 + +#define PAL_NAN sqrtf(-1.0f) +#define PAL_POSINF -logf(0.0f) +#define PAL_NEGINF logf(0.0f) + +/** + * Helper test structure + */ +struct test +{ + float value; /* value to test the function with */ + float expected; /* expected result */ + float variance; /* maximum delta between the expected and actual result */ +}; + +/** + * validate + * + * test validation function + */ +void __cdecl validate(float value, float expected, float variance) +{ + float result = asinf(value); + + /* + * The test is valid when the difference between result + * and expected is less than or equal to variance + */ + float delta = fabsf(result - expected); + + if (delta > variance) + { + Fail("asinf(%g) returned %10.9g when it should have returned %10.9g", + value, result, expected); + } +} + +/** + * validate + * + * test validation function for values returning NaN + */ +void __cdecl validate_isnan(float value) +{ + float result = asinf(value); + + if (!_isnanf(result)) + { + Fail("asinf(%g) returned %10.9g when it should have returned %10.9g", + value, result, PAL_NAN); + } +} + +/** + * validate + * + * test validation function for values returning +INF + */ +void __cdecl validate_isinf_positive(float value) +{ + float result = asinf(value); + + if (result != PAL_POSINF) + { + Fail("asinf(%g) returned %10.9g when it should have returned %10.9g", + value, result, PAL_POSINF); + } +} + +/** + * main + * + * executable entry point + */ +int __cdecl main(int argc, char **argv) +{ + struct test tests[] = + { + /* value expected variance */ + { 0, 0, PAL_EPSILON }, + { 0.312961796f, 0.318309886f, PAL_EPSILON }, // expected: 1 / pi + { 0.410781291f, 0.423310825f, PAL_EPSILON }, // expected: pi - e + { 0.420770483f, 0.434294482f, PAL_EPSILON }, // expected: logf10f(e) + { 0.594480769f, 0.636619772f, PAL_EPSILON }, // expected: 2 / pi + { 0.638961276f, 0.693147181f, PAL_EPSILON }, // expected: ln(2) + { 0.649636939f, 0.707106781f, PAL_EPSILON }, // expected: 1 / sqrtf(2) + { 0.707106781f, 0.785398163f, PAL_EPSILON }, // expected: pi / 4, value: 1 / sqrtf(2) + { 0.743980337f, 0.839007561f, PAL_EPSILON }, // expected: pi - ln(10) + { 0.841470985f, 1, PAL_EPSILON * 10 }, + { 0.903719457f, 1.12837917f, PAL_EPSILON * 10 }, // expected: 2 / sqrtf(pi) + { 0.987765946f, 1.41421356f, PAL_EPSILON * 10 }, // expected: sqrtf(2) + { 0.991806244f, 1.44269504f, PAL_EPSILON * 10 }, // expected: logf2(e) + { 1, 1.57079633f, PAL_EPSILON * 10 }, // expected: pi / 2 + }; + + /* PAL initialization */ + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) + { + validate( tests[i].value, tests[i].expected, tests[i].variance); + validate(-tests[i].value, -tests[i].expected, tests[i].variance); + } + + validate_isnan(PAL_NEGINF); + validate_isnan(PAL_NAN); + validate_isnan(PAL_POSINF); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/asinf/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/asinf/test1/testinfo.dat new file mode 100644 index 0000000000..ca2dd42150 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/asinf/test1/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 = asinf +Name = Positive Test for asinf +TYPE = DEFAULT +EXE1 = test1 +Description += Passes a series of values to the asinf() function, += checking each for the expected result. Also checks += for proper handling of out-of-range values. diff --git a/src/pal/tests/palsuite/c_runtime/atan/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/atan/test1/CMakeLists.txt index b0b84e7c07..ace64e48bc 100644 --- a/src/pal/tests/palsuite/c_runtime/atan/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/atan/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_atan_test1 diff --git a/src/pal/tests/palsuite/c_runtime/atan/test1/test1.c b/src/pal/tests/palsuite/c_runtime/atan/test1/test1.cpp index 6840d46172..6840d46172 100644 --- a/src/pal/tests/palsuite/c_runtime/atan/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/atan/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/atan2/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/atan2/test1/CMakeLists.txt index 8bd69da2fa..cafa09f7fe 100644 --- a/src/pal/tests/palsuite/c_runtime/atan2/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/atan2/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_atan2_test1 diff --git a/src/pal/tests/palsuite/c_runtime/atan2/test1/test1.c b/src/pal/tests/palsuite/c_runtime/atan2/test1/test1.cpp index 15aa8f53b9..15aa8f53b9 100644 --- a/src/pal/tests/palsuite/c_runtime/atan2/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/atan2/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/atan2f/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/atan2f/CMakeLists.txt new file mode 100644 index 0000000000..5e1ef7f28b --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/atan2f/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +add_subdirectory(test1) diff --git a/src/pal/tests/palsuite/c_runtime/atan2f/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/atan2f/test1/CMakeLists.txt new file mode 100644 index 0000000000..d71a61b17b --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/atan2f/test1/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test1.c +) + +add_executable(paltest_atan2f_test1 + ${SOURCES} +) + +add_dependencies(paltest_atan2f_test1 coreclrpal) + +target_link_libraries(paltest_atan2f_test1 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/atan2f/test1/test1.c b/src/pal/tests/palsuite/c_runtime/atan2f/test1/test1.c new file mode 100644 index 0000000000..2ee641e8d4 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/atan2f/test1/test1.c @@ -0,0 +1,147 @@ +// 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: test1.c +** +** Purpose: Tests that atan2f returns correct values for a subset of values. +** Tests with positive and negative values of x and y to ensure +** atan2f is returning results from the correct quadrant. +** +**===================================================================*/ + +#include <palsuite.h> + +// binary32 (float) has a machine epsilon of 2^-23 (approx. 1.19e-07). However, this +// is slightly too accurate when writing tests meant to run against libm implementations +// for various platforms. 2^-21 (approx. 4.76e-07) seems to be as accurate as we can get. +// +// The tests themselves will take PAL_EPSILON and adjust it according to the expected result +// so that the delta used for comparison will compare the most significant digits and ignore +// any digits that are outside the double precision range (6-9 digits). + +// For example, a test with an expect result in the format of 0.xxxxxxxxx will use PAL_EPSILON +// for the variance, while an expected result in the format of 0.0xxxxxxxxx will use +// PAL_EPSILON / 10 and and expected result in the format of x.xxxxxx will use PAL_EPSILON * 10. +#define PAL_EPSILON 4.76837158e-07 + +#define PAL_NAN sqrtf(-1.0f) +#define PAL_POSINF -logf(0.0f) +#define PAL_NEGINF logf(0.0f) + +struct test +{ + float y; /* second component of the value to test the function with */ + float x; /* first component of the value to test the function with */ + float expected; /* expected result */ + float variance; /* maximum delta between the expected and actual result */ +}; + +/** + * validate + * + * test validation function + */ +void __cdecl validate(float y, float x, float expected, float variance) +{ + float result = atan2f(y, x); + + /* + * The test is valid when the difference between result + * and expected is less than or equal to variance + */ + float delta = fabsf(result - expected); + + if (delta > variance) + { + Fail("atan2f(%g, %g) returned %10.9g when it should have returned %10.9g", + y, x, result, expected); + } +} + +/** + * validate + * + * test validation function for values returning NaN + */ +void __cdecl validate_isnan(float y, float x) +{ + float result = atan2f(y, x); + + if (!_isnanf(result)) + { + Fail("atan2f(%g, %g) returned %10.9g when it should have returned %10.9g", + y, x, result, PAL_NAN); + } +} + +/** + * main + * + * executable entry point + */ +int __cdecl main(int argc, char **argv) +{ + struct test tests[] = + { + /* y x expected variance */ + { 0, PAL_POSINF, 0, PAL_EPSILON }, + { 0, 0, 0, PAL_EPSILON }, + { 0.312961796f, 0.949765715f, 0.318309886f, PAL_EPSILON }, // expected: 1 / pi + { 0.420770483f, 0.907167129f, 0.434294482f, PAL_EPSILON }, // expected: logf10f(e) + { 0.594480769f, 0.804109828f, 0.636619772f, PAL_EPSILON }, // expected: 2 / pi + { 0.638961276f, 0.769238901f, 0.693147181f, PAL_EPSILON }, // expected: ln(2) + { 0.649636939f, 0.760244597f, 0.707106781f, PAL_EPSILON }, // expected: 1 / sqrtf(2) + { 0.707106781f, 0.707106781f, 0.785398163f, PAL_EPSILON }, // expected: pi / 4, value: 1 / sqrtf(2) + { 1, 1, 0.785398163f, PAL_EPSILON }, // expected: pi / 4 + { PAL_POSINF, PAL_POSINF, 0.785398163f, PAL_EPSILON }, // expected: pi / 4 + { 0.841470985f, 0.540302306f, 1, PAL_EPSILON * 10 }, + { 0.903719457f, 0.428125148f, 1.12837917f, PAL_EPSILON * 10 }, // expected: 2 / sqrtf(pi) + { 0.987765946f, 0.155943695f, 1.41421356f, PAL_EPSILON * 10 }, // expected: sqrtf(2) + { 0.991806244f, 0.127751218f, 1.44269504f, PAL_EPSILON * 10 }, // expected: logf2(e) + { 1, 0, 1.57079633f, PAL_EPSILON * 10 }, // expected: pi / 2 + { PAL_POSINF, 0, 1.57079633f, PAL_EPSILON * 10 }, // expected: pi / 2 + { PAL_POSINF, 1, 1.57079633f, PAL_EPSILON * 10 }, // expected: pi / 2 + { 0.743980337f, -0.668201510f, 2.30258509f, PAL_EPSILON * 10 }, // expected: ln(10) + { 0.410781291f, -0.911733915f, 2.71828183f, PAL_EPSILON * 10 }, // expected: e + { 0, -1, 3.14159265f, PAL_EPSILON * 10 }, // expected: pi + { 1, PAL_POSINF, 0, PAL_EPSILON }, + }; + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) + { + const float pi = 3.14159265f; + + validate( tests[i].y, tests[i].x, tests[i].expected, tests[i].variance); + validate(-tests[i].y, tests[i].x, -tests[i].expected, tests[i].variance); + validate( tests[i].y, -tests[i].x, pi - tests[i].expected, tests[i].variance); + validate(-tests[i].y, -tests[i].x, tests[i].expected - pi, tests[i].variance); + } + + validate_isnan(PAL_NEGINF, PAL_NAN); + validate_isnan(PAL_NAN, PAL_NEGINF); + validate_isnan(PAL_NAN, PAL_POSINF); + validate_isnan(PAL_POSINF, PAL_NAN); + + validate_isnan(PAL_NAN, -1); + validate_isnan(PAL_NAN, -0.0f); + validate_isnan(PAL_NAN, 0); + validate_isnan(PAL_NAN, 1); + + validate_isnan(-1, PAL_NAN); + validate_isnan(-0.0f, PAL_NAN); + validate_isnan( 0, PAL_NAN); + validate_isnan( 1, PAL_NAN); + + validate_isnan(PAL_NAN, PAL_NAN); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/atan2f/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/atan2f/test1/testinfo.dat new file mode 100644 index 0000000000..bd9a9d9b93 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/atan2f/test1/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 = atan2f +Name = Test #1 for atan2f +Type = DEFAULT +EXE1 = test1 +Description +=Tests that atan2f returns correct values for a subset of values. +=Tests with positive and negative values of x and y to ensure +=atan2f is returning results from the correct quadrant. diff --git a/src/pal/tests/palsuite/c_runtime/atanf/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/atanf/CMakeLists.txt new file mode 100644 index 0000000000..5e1ef7f28b --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/atanf/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +add_subdirectory(test1) diff --git a/src/pal/tests/palsuite/c_runtime/atanf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/atanf/test1/CMakeLists.txt new file mode 100644 index 0000000000..b71b1cf40c --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/atanf/test1/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test1.c +) + +add_executable(paltest_atanf_test1 + ${SOURCES} +) + +add_dependencies(paltest_atanf_test1 coreclrpal) + +target_link_libraries(paltest_atanf_test1 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/atanf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/atanf/test1/test1.c new file mode 100644 index 0000000000..543a0a8168 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/atanf/test1/test1.c @@ -0,0 +1,127 @@ +// 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: test1.c +** +** Purpose: Test to ensure that atanf return the correct values +** +** Dependencies: PAL_Initialize +** PAL_Terminate +** Fail +** fabs +** +**===========================================================================*/ + +#include <palsuite.h> + +// binary32 (float) has a machine epsilon of 2^-23 (approx. 1.19e-07). However, this +// is slightly too accurate when writing tests meant to run against libm implementations +// for various platforms. 2^-21 (approx. 4.76e-07) seems to be as accurate as we can get. +// +// The tests themselves will take PAL_EPSILON and adjust it according to the expected result +// so that the delta used for comparison will compare the most significant digits and ignore +// any digits that are outside the double precision range (6-9 digits). + +// For example, a test with an expect result in the format of 0.xxxxxxxxx will use PAL_EPSILON +// for the variance, while an expected result in the format of 0.0xxxxxxxxx will use +// PAL_EPSILON / 10 and and expected result in the format of x.xxxxxx will use PAL_EPSILON * 10. +#define PAL_EPSILON 4.76837158e-07 + +#define PAL_NAN sqrtf(-1.0f) +#define PAL_POSINF -logf(0.0f) +#define PAL_NEGINF logf(0.0f) + +/** + * Helper test structure + */ +struct test +{ + float value; /* value to test the function with */ + float expected; /* expected result */ + float variance; /* maximum delta between the expected and actual result */ +}; + +/** + * validate + * + * test validation function + */ +void __cdecl validate(float value, float expected, float variance) +{ + float result = atanf(value); + + /* + * The test is valid when the difference between result + * and expected is less than or equal to variance + */ + float delta = fabsf(result - expected); + + if (delta > variance) + { + Fail("atanf(%g) returned %10.9g when it should have returned %10.9g", + value, result, expected); + } +} + +/** + * validate + * + * test validation function for values returning NaN + */ +void __cdecl validate_isnan(float value) +{ + float result = atanf(value); + + if (!_isnanf(result)) + { + Fail("atanf(%g) returned %10.9g when it should have returned %10.9g", + value, result, PAL_NAN); + } +} + +/** + * main + * + * executable entry point + */ +int __cdecl main(int argc, char **argv) +{ + struct test tests[] = + { + /* value expected variance */ + { 0, 0, PAL_EPSILON }, + { 0.329514733f, 0.318309886f, PAL_EPSILON }, // expected: 1 / pi + { 0.450549534f, 0.423310825f, PAL_EPSILON }, // expected: pi - e + { 0.463829067f, 0.434294482f, PAL_EPSILON }, // expected: logf10f(e) + { 0.739302950f, 0.636619772f, PAL_EPSILON }, // expected: 2 / pi + { 0.830640878f, 0.693147181f, PAL_EPSILON }, // expected: ln(2) + { 0.854510432f, 0.707106781f, PAL_EPSILON }, // expected: 1 / sqrtf(2) + { 1, 0.785398163f, PAL_EPSILON }, // expected: pi / 4 + { 1.11340715f, 0.839007561f, PAL_EPSILON }, // expected: pi - ln(10) + { 1.55740772f, 1, PAL_EPSILON * 10 }, + { 2.11087684f, 1.12837917f, PAL_EPSILON * 10 }, // expected: 2 / sqrtf(pi) + { 6.33411917f, 1.41421356f, PAL_EPSILON * 10 }, // expected: sqrtf(2) + { 7.76357567f, 1.44269504f, PAL_EPSILON * 10 }, // expected: logf2(e) + { PAL_POSINF, 1.57079633f, PAL_EPSILON * 10 }, // expected: pi / 2 + }; + + /* PAL initialization */ + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) + { + validate( tests[i].value, tests[i].expected, tests[i].variance); + validate(-tests[i].value, -tests[i].expected, tests[i].variance); + } + + validate_isnan(PAL_NAN); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/atanf/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/atanf/test1/testinfo.dat new file mode 100644 index 0000000000..0d184272a2 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/atanf/test1/testinfo.dat @@ -0,0 +1,13 @@ +# 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 = atanf +Name = Positive Test for atanf +TYPE = DEFAULT +EXE1 = test1 +Description += Passes a series of values to the atanf() function, += checking each for the expected result. diff --git a/src/pal/tests/palsuite/c_runtime/atof/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/atof/test1/CMakeLists.txt index 1f34b7ebf5..12e584b9a0 100644 --- a/src/pal/tests/palsuite/c_runtime/atof/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/atof/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_atof_test1 diff --git a/src/pal/tests/palsuite/c_runtime/atof/test1/test1.c b/src/pal/tests/palsuite/c_runtime/atof/test1/test1.cpp index a973133f9e..a973133f9e 100644 --- a/src/pal/tests/palsuite/c_runtime/atof/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/atof/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/atoi/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/atoi/test1/CMakeLists.txt index 3549aca737..225052213f 100644 --- a/src/pal/tests/palsuite/c_runtime/atoi/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/atoi/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_atoi_test1 diff --git a/src/pal/tests/palsuite/c_runtime/atoi/test1/test1.c b/src/pal/tests/palsuite/c_runtime/atoi/test1/test1.cpp index 2554d4c353..2554d4c353 100644 --- a/src/pal/tests/palsuite/c_runtime/atoi/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/atoi/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/atol/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/atol/test1/CMakeLists.txt index 4fea187ad8..29643aae6b 100644 --- a/src/pal/tests/palsuite/c_runtime/atol/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/atol/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_atol_test1 diff --git a/src/pal/tests/palsuite/c_runtime/atol/test1/test1.c b/src/pal/tests/palsuite/c_runtime/atol/test1/test1.cpp index 5ad85d873f..5ad85d873f 100644 --- a/src/pal/tests/palsuite/c_runtime/atol/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/atol/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/bsearch/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/bsearch/test1/CMakeLists.txt index d2018f3325..c5aab7b84d 100644 --- a/src/pal/tests/palsuite/c_runtime/bsearch/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/bsearch/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_bsearch_test1 diff --git a/src/pal/tests/palsuite/c_runtime/bsearch/test1/test1.c b/src/pal/tests/palsuite/c_runtime/bsearch/test1/test1.cpp index c4b91738eb..c4b91738eb 100644 --- a/src/pal/tests/palsuite/c_runtime/bsearch/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/bsearch/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/bsearch/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/bsearch/test2/CMakeLists.txt index dc65560196..7ad33b12e5 100644 --- a/src/pal/tests/palsuite/c_runtime/bsearch/test2/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/bsearch/test2/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test2.c + test2.cpp ) add_executable(paltest_bsearch_test2 diff --git a/src/pal/tests/palsuite/c_runtime/bsearch/test2/test2.c b/src/pal/tests/palsuite/c_runtime/bsearch/test2/test2.cpp index 6de1b3fada..6de1b3fada 100644 --- a/src/pal/tests/palsuite/c_runtime/bsearch/test2/test2.c +++ b/src/pal/tests/palsuite/c_runtime/bsearch/test2/test2.cpp diff --git a/src/pal/tests/palsuite/c_runtime/ceil/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/ceil/test1/CMakeLists.txt index c73ad1dbbe..f834914545 100644 --- a/src/pal/tests/palsuite/c_runtime/ceil/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/ceil/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_ceil_test1 diff --git a/src/pal/tests/palsuite/c_runtime/ceil/test1/test1.c b/src/pal/tests/palsuite/c_runtime/ceil/test1/test1.cpp index e6e36e6e33..e6e36e6e33 100644 --- a/src/pal/tests/palsuite/c_runtime/ceil/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/ceil/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/ceilf/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/ceilf/CMakeLists.txt new file mode 100644 index 0000000000..5e1ef7f28b --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/ceilf/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +add_subdirectory(test1) diff --git a/src/pal/tests/palsuite/c_runtime/ceilf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/ceilf/test1/CMakeLists.txt new file mode 100644 index 0000000000..64f14cda9a --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/ceilf/test1/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test1.c +) + +add_executable(paltest_ceilf_test1 + ${SOURCES} +) + +add_dependencies(paltest_ceilf_test1 coreclrpal) + +target_link_libraries(paltest_ceilf_test1 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/ceilf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/ceilf/test1/test1.c new file mode 100644 index 0000000000..4939fb7ccf --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/ceilf/test1/test1.c @@ -0,0 +1,131 @@ +// 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: test1.c +** +** Purpose: Tests ceilf with simple positive and negative values. Also tests +** extreme cases like extremely small values and positive and +** negative infinity. Makes sure that calling ceilf on NaN returns +** NaN +** +**==========================================================================*/ + +#include <palsuite.h> + +// binary32 (float) has a machine epsilon of 2^-23 (approx. 1.19e-07). However, this +// is slightly too accurate when writing tests meant to run against libm implementations +// for various platforms. 2^-21 (approx. 4.76e-07) seems to be as accurate as we can get. +// +// The tests themselves will take PAL_EPSILON and adjust it according to the expected result +// so that the delta used for comparison will compare the most significant digits and ignore +// any digits that are outside the double precision range (6-9 digits). + +// For example, a test with an expect result in the format of 0.xxxxxxxxx will use PAL_EPSILON +// for the variance, while an expected result in the format of 0.0xxxxxxxxx will use +// PAL_EPSILON / 10 and and expected result in the format of x.xxxxxx will use PAL_EPSILON * 10. +#define PAL_EPSILON 4.76837158e-07 + +#define PAL_NAN sqrtf(-1.0f) +#define PAL_POSINF -logf(0.0f) +#define PAL_NEGINF logf(0.0f) + +/** + * Helper test structure + */ +struct test +{ + float value; /* value to test the function with */ + float expected; /* expected result */ + float variance; /* maximum delta between the expected and actual result */ +}; + +/** + * validate + * + * test validation function + */ +void __cdecl validate(float value, float expected, float variance) +{ + float result = ceilf(value); + + /* + * The test is valid when the difference between result + * and expected is less than or equal to variance + */ + float delta = fabsf(result - expected); + + if (delta > variance) + { + Fail("ceilf(%g) returned %10.9g when it should have returned %10.9g", + value, result, expected); + } +} + +/** + * validate + * + * test validation function for values returning NaN + */ +void __cdecl validate_isnan(float value) +{ + float result = ceilf(value); + + if (!_isnanf(result)) + { + Fail("ceilf(%g) returned %10.9g when it should have returned %10.9g", + value, result, PAL_NAN); + } +} + +/** + * main + * + * executable entry point + */ +int __cdecl main(int argc, char *argv[]) +{ + struct test tests[] = + { + /* value expected variance */ + { 0.318309886f, 1, PAL_EPSILON * 10 }, // value: 1 / pi + { 0.434294482f, 1, PAL_EPSILON * 10 }, // value: log10f(e) + { 0.636619772f, 1, PAL_EPSILON * 10 }, // value: 2 / pi + { 0.693147181f, 1, PAL_EPSILON * 10 }, // value: ln(2) + { 0.707106781f, 1, PAL_EPSILON * 10 }, // value: 1 / sqrtf(2) + { 0.785398163f, 1, PAL_EPSILON * 10 }, // value: pi / 4 + { 1.12837917f, 2, PAL_EPSILON * 10 }, // value: 2 / sqrtf(pi) + { 1.41421356f, 2, PAL_EPSILON * 10 }, // value: sqrtf(2) + { 1.44269504f, 2, PAL_EPSILON * 10 }, // value: logf2(e) + { 1.57079633f, 2, PAL_EPSILON * 10 }, // value: pi / 2 + { 2.30258509f, 3, PAL_EPSILON * 10 }, // value: ln(10) + { 2.71828183f, 3, PAL_EPSILON * 10 }, // value: e + { 3.14159265f, 4, PAL_EPSILON * 10 }, // value: pi + { PAL_POSINF, PAL_POSINF, 0 } + }; + + /* PAL initialization */ + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + validate( 0, 0, PAL_EPSILON); + validate(-0.0f, 0, PAL_EPSILON); + + validate( 1, 1, PAL_EPSILON * 10); + validate(-1.0f, -1, PAL_EPSILON * 10); + + for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) + { + validate( tests[i].value, tests[i].expected, tests[i].variance); + validate(-tests[i].value, 1 - tests[i].expected, tests[i].variance); + } + + validate_isnan(PAL_NAN); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/ceilf/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/ceilf/test1/testinfo.dat new file mode 100644 index 0000000000..095b8b216a --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/ceilf/test1/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 = ceilf +Name = Test #1 for ceilf +TYPE = DEFAULT +EXE1 = test1 +Description +=Tests ceilf with simple positive and negative values. Also tests +=extreme cases like extremely small values and positive and negative +=infinity. Makes sure that calling ceilf on NaN returns NaN diff --git a/src/pal/tests/palsuite/c_runtime/cos/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/cos/test1/CMakeLists.txt index 1dda9a2563..536664c128 100644 --- a/src/pal/tests/palsuite/c_runtime/cos/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/cos/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_cos_test1 diff --git a/src/pal/tests/palsuite/c_runtime/cos/test1/test1.c b/src/pal/tests/palsuite/c_runtime/cos/test1/test1.cpp index 8c1c7300e6..8c1c7300e6 100644 --- a/src/pal/tests/palsuite/c_runtime/cos/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/cos/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/cosf/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/cosf/CMakeLists.txt new file mode 100644 index 0000000000..5e1ef7f28b --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/cosf/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +add_subdirectory(test1) diff --git a/src/pal/tests/palsuite/c_runtime/cosf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/cosf/test1/CMakeLists.txt new file mode 100644 index 0000000000..b3a18ea271 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/cosf/test1/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test1.c +) + +add_executable(paltest_cosf_test1 + ${SOURCES} +) + +add_dependencies(paltest_cosf_test1 coreclrpal) + +target_link_libraries(paltest_cosf_test1 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/cosf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/cosf/test1/test1.c new file mode 100644 index 0000000000..210851a2fa --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/cosf/test1/test1.c @@ -0,0 +1,130 @@ +// 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: test1.c +** +** Purpose: Test to ensure that cosf return the correct values +** +** Dependencies: PAL_Initialize +** PAL_Terminate +** Fail +** fabs +** +**===========================================================================*/ + +#include <palsuite.h> + +// binary32 (float) has a machine epsilon of 2^-23 (approx. 1.19e-07). However, this +// is slightly too accurate when writing tests meant to run against libm implementations +// for various platforms. 2^-21 (approx. 4.76e-07) seems to be as accurate as we can get. +// +// The tests themselves will take PAL_EPSILON and adjust it according to the expected result +// so that the delta used for comparison will compare the most significant digits and ignore +// any digits that are outside the double precision range (6-9 digits). + +// For example, a test with an expect result in the format of 0.xxxxxxxxx will use PAL_EPSILON +// for the variance, while an expected result in the format of 0.0xxxxxxxxx will use +// PAL_EPSILON / 10 and and expected result in the format of x.xxxxxx will use PAL_EPSILON * 10. +#define PAL_EPSILON 4.76837158e-07 + +#define PAL_NAN sqrtf(-1.0f) +#define PAL_POSINF -logf(0.0f) +#define PAL_NEGINF logf(0.0f) + +/** + * Helper test structure + */ +struct test +{ + float value; /* value to test the function with */ + float expected; /* expected result */ + float variance; /* maximum delta between the expected and actual result */ +}; + +/** + * validate + * + * test validation function + */ +void __cdecl validate(float value, float expected, float variance) +{ + float result = cosf(value); + + /* + * The test is valid when the difference between result + * and expected is less than or equal to variance + */ + float delta = fabsf(result - expected); + + if (delta > variance) + { + Fail("cosf(%g) returned %10.9g when it should have returned %10.9g", + value, result, expected); + } +} + +/** + * validate + * + * test validation function for values returning NaN + */ +void __cdecl validate_isnan(float value) +{ + float result = cosf(value); + + if (!_isnanf(result)) + { + Fail("cosf(%g) returned %10.9g when it should have returned %10.9g", + value, result, PAL_NAN); + } +} + +/** + * main + * + * executable entry point + */ +int __cdecl main(int argc, char **argv) +{ + struct test tests[] = + { + /* value expected variance */ + { 0, 1, PAL_EPSILON * 10 }, + { 0.318309886f, 0.949765715f, PAL_EPSILON }, // value: 1 / pi + { 0.434294482f, 0.907167129f, PAL_EPSILON }, // value: log10f(e) + { 0.636619772f, 0.804109828f, PAL_EPSILON }, // value: 2 / pi + { 0.693147181f, 0.769238901f, PAL_EPSILON }, // value: ln(2) + { 0.707106781f, 0.760244597f, PAL_EPSILON }, // value: 1 / sqrtf(2) + { 0.785398163f, 0.707106781f, PAL_EPSILON }, // value: pi / 4, expected: 1 / sqrtf(2) + { 1, 0.540302306f, PAL_EPSILON }, + { 1.12837917f, 0.428125148f, PAL_EPSILON }, // value: 2 / sqrtf(pi) + { 1.41421356f, 0.155943695f, PAL_EPSILON }, // value: sqrtf(2) + { 1.44269504f, 0.127751218f, PAL_EPSILON }, // value: logf2(e) + { 1.57079633f, 0, PAL_EPSILON }, // value: pi / 2 + { 2.30258509f, -0.668201510f, PAL_EPSILON }, // value: ln(10) + { 2.71828183f, -0.911733918f, PAL_EPSILON }, // value: e + { 3.14159265f, -1, PAL_EPSILON * 10 }, // value: pi + }; + + /* PAL initialization */ + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) + { + validate( tests[i].value, tests[i].expected, tests[i].variance); + validate(-tests[i].value, tests[i].expected, tests[i].variance); + } + + validate_isnan(PAL_NEGINF); + validate_isnan(PAL_NAN); + validate_isnan(PAL_POSINF); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/cosf/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/cosf/test1/testinfo.dat new file mode 100644 index 0000000000..a0265add2f --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/cosf/test1/testinfo.dat @@ -0,0 +1,13 @@ +# 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 = cosf +Name = Positive Test for cosf +TYPE = DEFAULT +EXE1 = test1 +Description += Passes to cosf() a series of angle value, checking that += each one return the correct value. diff --git a/src/pal/tests/palsuite/c_runtime/cosh/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/cosh/test1/CMakeLists.txt index bea7b7a3b7..e1fff0e9f1 100644 --- a/src/pal/tests/palsuite/c_runtime/cosh/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/cosh/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_cosh_test1 diff --git a/src/pal/tests/palsuite/c_runtime/cosh/test1/test1.c b/src/pal/tests/palsuite/c_runtime/cosh/test1/test1.cpp index 40c2fca85d..40c2fca85d 100644 --- a/src/pal/tests/palsuite/c_runtime/cosh/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/cosh/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/coshf/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/coshf/CMakeLists.txt new file mode 100644 index 0000000000..5e1ef7f28b --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/coshf/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +add_subdirectory(test1) diff --git a/src/pal/tests/palsuite/c_runtime/coshf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/coshf/test1/CMakeLists.txt new file mode 100644 index 0000000000..92fcfdea6d --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/coshf/test1/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test1.c +) + +add_executable(paltest_coshf_test1 + ${SOURCES} +) + +add_dependencies(paltest_coshf_test1 coreclrpal) + +target_link_libraries(paltest_coshf_test1 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/coshf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/coshf/test1/test1.c new file mode 100644 index 0000000000..e1ab745acb --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/coshf/test1/test1.c @@ -0,0 +1,129 @@ +// 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: test1.c +** +** Purpose: Test to ensure that coshf return the correct values +** +** Dependencies: PAL_Initialize +** PAL_Terminate +** Fail +** fabs +** +**===========================================================================*/ + +#include <palsuite.h> + +// binary32 (float) has a machine epsilon of 2^-23 (approx. 1.19e-07). However, this +// is slightly too accurate when writing tests meant to run against libm implementations +// for various platforms. 2^-21 (approx. 4.76e-07) seems to be as accurate as we can get. +// +// The tests themselves will take PAL_EPSILON and adjust it according to the expected result +// so that the delta used for comparison will compare the most significant digits and ignore +// any digits that are outside the double precision range (6-9 digits). + +// For example, a test with an expect result in the format of 0.xxxxxxxxx will use PAL_EPSILON +// for the variance, while an expected result in the format of 0.0xxxxxxxxx will use +// PAL_EPSILON / 10 and and expected result in the format of x.xxxxxx will use PAL_EPSILON * 10. +#define PAL_EPSILON 4.76837158e-07 + +#define PAL_NAN sqrtf(-1.0f) +#define PAL_POSINF -logf(0.0f) +#define PAL_NEGINF logf(0.0f) + +/** + * Helper test structure + */ +struct test +{ + float value; /* value to test the function with */ + float expected; /* expected result */ + float variance; /* maximum delta between the expected and actual result */ +}; + +/** + * validate + * + * test validation function + */ +void __cdecl validate(float value, float expected, float variance) +{ + float result = coshf(value); + + /* + * The test is valid when the difference between result + * and expected is less than or equal to variance + */ + float delta = fabsf(result - expected); + + if (delta > variance) + { + Fail("coshf(%g) returned %10.9g when it should have returned %10.9g", + value, result, expected); + } +} + +/** + * validate + * + * test validation function for values returning PAL_NAN + */ +void __cdecl validate_isnan(float value) +{ + float result = coshf(value); + + if (!_isnanf(result)) + { + Fail("coshf(%g) returned %10.9g when it should have returned %10.9g", + value, result, PAL_NAN); + } +} + +/** + * main + * + * executable entry point + */ +int __cdecl main(int argc, char **argv) +{ + struct test tests[] = + { + /* value expected variance */ + { 0, 1, PAL_EPSILON * 10 }, + { 0.318309886f, 1.05108979f, PAL_EPSILON * 10 }, // value: 1 / pi + { 0.434294482f, 1.09579746f, PAL_EPSILON * 10 }, // value: log10f(e) + { 0.636619772f, 1.20957949f, PAL_EPSILON * 10 }, // value: 2 / pi + { 0.693147181f, 1.25f, PAL_EPSILON * 10 }, // value: ln(2) + { 0.707106781f, 1.26059184f, PAL_EPSILON * 10 }, // value: 1 / sqrtf(2) + { 0.785398163f, 1.32460909f, PAL_EPSILON * 10 }, // value: pi / 4 + { 1, 1.54308063f, PAL_EPSILON * 10 }, + { 1.12837917f, 1.70710014f, PAL_EPSILON * 10 }, // value: 2 / sqrtf(pi) + { 1.41421356f, 2.17818356f, PAL_EPSILON * 10 }, // value: sqrtf(2) + { 1.44269504f, 2.23418810f, PAL_EPSILON * 10 }, // value: logf2(e) + { 1.57079633f, 2.50917848f, PAL_EPSILON * 10 }, // value: pi / 2 + { 2.30258509f, 5.05f, PAL_EPSILON * 10 }, // value: ln(10) + { 2.71828183f, 7.61012514f, PAL_EPSILON * 10 }, // value: e + { 3.14159265f, 11.5919533f, PAL_EPSILON * 100 }, // value: pi + { PAL_POSINF, PAL_POSINF, 0 }, + }; + + /* PAL initialization */ + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) + { + validate( tests[i].value, tests[i].expected, tests[i].variance); + validate(-tests[i].value, tests[i].expected, tests[i].variance); + } + + validate_isnan(PAL_NAN); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/coshf/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/coshf/test1/testinfo.dat new file mode 100644 index 0000000000..814ed98698 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/coshf/test1/testinfo.dat @@ -0,0 +1,13 @@ +# 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 = coshf +Name = Positive Test for coshf +TYPE = DEFAULT +EXE1 = test1 +Description += Passes to coshf() a series of angle value, checking that += each one return to correct value. diff --git a/src/pal/tests/palsuite/c_runtime/ctime/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/ctime/test1/CMakeLists.txt index aa64a71d1e..3eeffb0e39 100644 --- a/src/pal/tests/palsuite/c_runtime/ctime/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/ctime/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_ctime_test1 diff --git a/src/pal/tests/palsuite/c_runtime/ctime/test1/test1.c b/src/pal/tests/palsuite/c_runtime/ctime/test1/test1.cpp index 5d5e22ce89..5d5e22ce89 100644 --- a/src/pal/tests/palsuite/c_runtime/ctime/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/ctime/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/errno/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/errno/test1/CMakeLists.txt index 89b25a4fac..91b8d094b1 100644 --- a/src/pal/tests/palsuite/c_runtime/errno/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/errno/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_errno_test1 diff --git a/src/pal/tests/palsuite/c_runtime/errno/test1/test1.c b/src/pal/tests/palsuite/c_runtime/errno/test1/test1.cpp index 3ae25fb02a..3ae25fb02a 100644 --- a/src/pal/tests/palsuite/c_runtime/errno/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/errno/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/errno/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/errno/test2/CMakeLists.txt index edd4cf7975..ab7c4a27f2 100644 --- a/src/pal/tests/palsuite/c_runtime/errno/test2/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/errno/test2/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test2.c + test2.cpp ) add_executable(paltest_errno_test2 diff --git a/src/pal/tests/palsuite/c_runtime/errno/test2/test2.c b/src/pal/tests/palsuite/c_runtime/errno/test2/test2.cpp index f418d2f199..f418d2f199 100644 --- a/src/pal/tests/palsuite/c_runtime/errno/test2/test2.c +++ b/src/pal/tests/palsuite/c_runtime/errno/test2/test2.cpp diff --git a/src/pal/tests/palsuite/c_runtime/exit/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/exit/test1/CMakeLists.txt index eb9ca4e780..bb2cbccb9b 100644 --- a/src/pal/tests/palsuite/c_runtime/exit/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/exit/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_exit_test1 diff --git a/src/pal/tests/palsuite/c_runtime/exit/test1/test1.c b/src/pal/tests/palsuite/c_runtime/exit/test1/test1.cpp index 87c9d22b8a..87c9d22b8a 100644 --- a/src/pal/tests/palsuite/c_runtime/exit/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/exit/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/exit/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/exit/test2/CMakeLists.txt index 47d3a44c85..8a74e75ed5 100644 --- a/src/pal/tests/palsuite/c_runtime/exit/test2/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/exit/test2/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test2.c + test2.cpp ) add_executable(paltest_exit_test2 diff --git a/src/pal/tests/palsuite/c_runtime/exit/test2/test2.c b/src/pal/tests/palsuite/c_runtime/exit/test2/test2.cpp index 16fbdfed2f..16fbdfed2f 100644 --- a/src/pal/tests/palsuite/c_runtime/exit/test2/test2.c +++ b/src/pal/tests/palsuite/c_runtime/exit/test2/test2.cpp diff --git a/src/pal/tests/palsuite/c_runtime/exp/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/exp/test1/CMakeLists.txt index 9cdd4ec5ed..3377ed22f2 100644 --- a/src/pal/tests/palsuite/c_runtime/exp/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/exp/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_exp_test1 diff --git a/src/pal/tests/palsuite/c_runtime/exp/test1/test1.c b/src/pal/tests/palsuite/c_runtime/exp/test1/test1.cpp index 20e071aa68..20e071aa68 100644 --- a/src/pal/tests/palsuite/c_runtime/exp/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/exp/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/expf/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/expf/CMakeLists.txt new file mode 100644 index 0000000000..5e1ef7f28b --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/expf/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +add_subdirectory(test1) diff --git a/src/pal/tests/palsuite/c_runtime/expf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/expf/test1/CMakeLists.txt new file mode 100644 index 0000000000..fb12b65c2f --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/expf/test1/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test1.c +) + +add_executable(paltest_expf_test1 + ${SOURCES} +) + +add_dependencies(paltest_expf_test1 coreclrpal) + +target_link_libraries(paltest_expf_test1 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/expf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/expf/test1/test1.c new file mode 100644 index 0000000000..32f4e8d26c --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/expf/test1/test1.c @@ -0,0 +1,137 @@ +// 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: test1.c +** +** Purpose: Tests expf with a normal set of values. +** +**===================================================================*/ + +#include <palsuite.h> + +// binary32 (float) has a machine epsilon of 2^-23 (approx. 1.19e-07). However, this +// is slightly too accurate when writing tests meant to run against libm implementations +// for various platforms. 2^-21 (approx. 4.76e-07) seems to be as accurate as we can get. +// +// The tests themselves will take PAL_EPSILON and adjust it according to the expected result +// so that the delta used for comparison will compare the most significant digits and ignore +// any digits that are outside the double precision range (6-9 digits). + +// For example, a test with an expect result in the format of 0.xxxxxxxxx will use PAL_EPSILON +// for the variance, while an expected result in the format of 0.0xxxxxxxxx will use +// PAL_EPSILON / 10 and and expected result in the format of x.xxxxxx will use PAL_EPSILON * 10. +#define PAL_EPSILON 4.76837158e-07 + +#define PAL_NAN sqrtf(-1.0f) +#define PAL_POSINF -logf(0.0f) +#define PAL_NEGINF logf(0.0f) + +/** + * Helper test structure + */ +struct test +{ + float value; /* value to test the function with */ + float expected; /* expected result */ + float variance; /* maximum delta between the expected and actual result */ +}; + +/** + * validate + * + * test validation function + */ +void __cdecl validate(float value, float expected, float variance) +{ + float result = expf(value); + + /* + * The test is valid when the difference between result + * and expected is less than or equal to variance + */ + float delta = fabsf(result - expected); + + if (delta > variance) + { + Fail("expf(%g) returned %10.9g when it should have returned %10.9g", + value, result, expected); + } +} + +/** + * validate + * + * test validation function for values returning NaN + */ +void __cdecl validate_isnan(float value) +{ + float result = expf(value); + + if (!_isnanf(result)) + { + Fail("expf(%g) returned %10.9g when it should have returned %10.9g", + value, result, PAL_NAN); + } +} + +/** + * main + * + * executable entry point + */ +int __cdecl main(int argc, char **argv) +{ + struct test tests[] = + { + /* value expected variance */ + { PAL_NEGINF, 0, PAL_EPSILON }, + { -3.14159265f, 0.0432139183f, PAL_EPSILON / 10 }, // value: -(pi) + { -2.71828183f, 0.0659880358f, PAL_EPSILON / 10 }, // value: -(e) + { -2.30258509f, 0.1f, PAL_EPSILON }, // value: -(ln(10)) + { -1.57079633f, 0.207879576f, PAL_EPSILON }, // value: -(pi / 2) + { -1.44269504f, 0.236290088f, PAL_EPSILON }, // value: -(logf2(e)) + { -1.41421356f, 0.243116734f, PAL_EPSILON }, // value: -(sqrtf(2)) + { -1.12837917f, 0.323557264f, PAL_EPSILON }, // value: -(2 / sqrtf(pi)) + { -1, 0.367879441f, PAL_EPSILON }, // value: -(1) + { -0.785398163f, 0.455938128f, PAL_EPSILON }, // value: -(pi / 4) + { -0.707106781f, 0.493068691f, PAL_EPSILON }, // value: -(1 / sqrtf(2)) + { -0.693147181f, 0.5f, PAL_EPSILON }, // value: -(ln(2)) + { -0.636619772f, 0.529077808f, PAL_EPSILON }, // value: -(2 / pi) + { -0.434294482f, 0.647721485f, PAL_EPSILON }, // value: -(log10f(e)) + { -0.318309886f, 0.727377349f, PAL_EPSILON }, // value: -(1 / pi) + { 0, 1, PAL_EPSILON * 10 }, + { 0.318309886f, 1.37480223f, PAL_EPSILON * 10 }, // value: 1 / pi + { 0.434294482f, 1.54387344f, PAL_EPSILON * 10 }, // value: log10f(e) + { 0.636619772f, 1.89008116f, PAL_EPSILON * 10 }, // value: 2 / pi + { 0.693147181f, 2, PAL_EPSILON * 10 }, // value: ln(2) + { 0.707106781f, 2.02811498f, PAL_EPSILON * 10 }, // value: 1 / sqrtf(2) + { 0.785398163f, 2.19328005f, PAL_EPSILON * 10 }, // value: pi / 4 + { 1, 2.71828183f, PAL_EPSILON * 10 }, // expected: e + { 1.12837917f, 3.09064302f, PAL_EPSILON * 10 }, // value: 2 / sqrtf(pi) + { 1.41421356f, 4.11325038f, PAL_EPSILON * 10 }, // value: sqrtf(2) + { 1.44269504f, 4.23208611f, PAL_EPSILON * 10 }, // value: logf2(e) + { 1.57079633f, 4.81047738f, PAL_EPSILON * 10 }, // value: pi / 2 + { 2.30258509f, 10, PAL_EPSILON * 100 }, // value: ln(10) + { 2.71828183f, 15.1542622f, PAL_EPSILON * 100 }, // value: e + { 3.14159265f, 23.1406926f, PAL_EPSILON * 100 }, // value: pi + { PAL_POSINF, PAL_POSINF, 0 }, + }; + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) + { + validate(tests[i].value, tests[i].expected, tests[i].variance); + } + + validate_isnan(PAL_NAN); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/expf/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/expf/test1/testinfo.dat new file mode 100644 index 0000000000..c35928501e --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/expf/test1/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = expf +Name = Test #1 for expf +Type = DEFAULT +EXE1 = test1 +Description +=Tests expf with a normal set of values. diff --git a/src/pal/tests/palsuite/c_runtime/fabs/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fabs/test1/CMakeLists.txt index ab27230ac2..fa01a34dd9 100644 --- a/src/pal/tests/palsuite/c_runtime/fabs/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fabs/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_fabs_test1 diff --git a/src/pal/tests/palsuite/c_runtime/fabs/test1/test1.c b/src/pal/tests/palsuite/c_runtime/fabs/test1/test1.cpp index 0a74d5c1c5..0a74d5c1c5 100644 --- a/src/pal/tests/palsuite/c_runtime/fabs/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/fabs/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fabsf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fabsf/test1/CMakeLists.txt index 06512ebd7c..a1823e25e5 100644 --- a/src/pal/tests/palsuite/c_runtime/fabsf/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fabsf/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_fabsf_test1 diff --git a/src/pal/tests/palsuite/c_runtime/fabsf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/fabsf/test1/test1.cpp index 0b020729b8..0b020729b8 100644 --- a/src/pal/tests/palsuite/c_runtime/fabsf/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/fabsf/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fclose/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fclose/test1/CMakeLists.txt index 55ed7c674e..64cfef0e18 100644 --- a/src/pal/tests/palsuite/c_runtime/fclose/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fclose/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_fclose_test1 diff --git a/src/pal/tests/palsuite/c_runtime/fclose/test1/test1.c b/src/pal/tests/palsuite/c_runtime/fclose/test1/test1.cpp index 0a8463823d..0a8463823d 100644 --- a/src/pal/tests/palsuite/c_runtime/fclose/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/fclose/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fclose/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fclose/test2/CMakeLists.txt index 178dc7d19a..3b5538608f 100644 --- a/src/pal/tests/palsuite/c_runtime/fclose/test2/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fclose/test2/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test2.c + test2.cpp ) add_executable(paltest_fclose_test2 diff --git a/src/pal/tests/palsuite/c_runtime/fclose/test2/test2.c b/src/pal/tests/palsuite/c_runtime/fclose/test2/test2.cpp index f4da535535..f4da535535 100644 --- a/src/pal/tests/palsuite/c_runtime/fclose/test2/test2.c +++ b/src/pal/tests/palsuite/c_runtime/fclose/test2/test2.cpp diff --git a/src/pal/tests/palsuite/c_runtime/feof/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/feof/test1/CMakeLists.txt index ee1389deb0..9f689503e6 100644 --- a/src/pal/tests/palsuite/c_runtime/feof/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/feof/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_feof_test1 diff --git a/src/pal/tests/palsuite/c_runtime/feof/test1/test1.c b/src/pal/tests/palsuite/c_runtime/feof/test1/test1.cpp index ba018aa91d..ba018aa91d 100644 --- a/src/pal/tests/palsuite/c_runtime/feof/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/feof/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/ferror/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/ferror/test1/CMakeLists.txt index 2ab12b5db3..cd1fe52381 100644 --- a/src/pal/tests/palsuite/c_runtime/ferror/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/ferror/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_ferror_test1 diff --git a/src/pal/tests/palsuite/c_runtime/ferror/test1/test1.c b/src/pal/tests/palsuite/c_runtime/ferror/test1/test1.cpp index 516f2531ed..516f2531ed 100644 --- a/src/pal/tests/palsuite/c_runtime/ferror/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/ferror/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/ferror/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/ferror/test2/CMakeLists.txt index 077dde0bc6..05bd7fd2f1 100644 --- a/src/pal/tests/palsuite/c_runtime/ferror/test2/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/ferror/test2/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test2.c + test2.cpp ) add_executable(paltest_ferror_test2 diff --git a/src/pal/tests/palsuite/c_runtime/ferror/test2/test2.c b/src/pal/tests/palsuite/c_runtime/ferror/test2/test2.cpp index fdf9e032c8..fdf9e032c8 100644 --- a/src/pal/tests/palsuite/c_runtime/ferror/test2/test2.c +++ b/src/pal/tests/palsuite/c_runtime/ferror/test2/test2.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fflush/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fflush/test1/CMakeLists.txt index 743f1d2111..58c7c5a3a4 100644 --- a/src/pal/tests/palsuite/c_runtime/fflush/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fflush/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_fflush_test1 diff --git a/src/pal/tests/palsuite/c_runtime/fflush/test1/test1.c b/src/pal/tests/palsuite/c_runtime/fflush/test1/test1.cpp index 7baf9ba5b9..7baf9ba5b9 100644 --- a/src/pal/tests/palsuite/c_runtime/fflush/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/fflush/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fgets/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fgets/test1/CMakeLists.txt index 672d910c85..d327d6882a 100644 --- a/src/pal/tests/palsuite/c_runtime/fgets/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fgets/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_fgets_test1 diff --git a/src/pal/tests/palsuite/c_runtime/fgets/test1/test1.c b/src/pal/tests/palsuite/c_runtime/fgets/test1/test1.cpp index 5e0e62dece..5e0e62dece 100644 --- a/src/pal/tests/palsuite/c_runtime/fgets/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/fgets/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fgets/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fgets/test2/CMakeLists.txt index d39401536b..23bcdef686 100644 --- a/src/pal/tests/palsuite/c_runtime/fgets/test2/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fgets/test2/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test2.c + test2.cpp ) add_executable(paltest_fgets_test2 diff --git a/src/pal/tests/palsuite/c_runtime/fgets/test2/test2.c b/src/pal/tests/palsuite/c_runtime/fgets/test2/test2.cpp index fa37cdbc13..fa37cdbc13 100644 --- a/src/pal/tests/palsuite/c_runtime/fgets/test2/test2.c +++ b/src/pal/tests/palsuite/c_runtime/fgets/test2/test2.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fgets/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fgets/test3/CMakeLists.txt index 50f0901ee1..0833ad0130 100644 --- a/src/pal/tests/palsuite/c_runtime/fgets/test3/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fgets/test3/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test3.c + test3.cpp ) add_executable(paltest_fgets_test3 diff --git a/src/pal/tests/palsuite/c_runtime/fgets/test3/test3.c b/src/pal/tests/palsuite/c_runtime/fgets/test3/test3.cpp index 525ba9327f..525ba9327f 100644 --- a/src/pal/tests/palsuite/c_runtime/fgets/test3/test3.c +++ b/src/pal/tests/palsuite/c_runtime/fgets/test3/test3.cpp diff --git a/src/pal/tests/palsuite/c_runtime/floor/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/floor/test1/CMakeLists.txt index dbc5abde5b..3222ed8ba3 100644 --- a/src/pal/tests/palsuite/c_runtime/floor/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/floor/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_floor_test1 diff --git a/src/pal/tests/palsuite/c_runtime/floor/test1/test1.c b/src/pal/tests/palsuite/c_runtime/floor/test1/test1.cpp index dba320919b..dba320919b 100644 --- a/src/pal/tests/palsuite/c_runtime/floor/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/floor/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/floorf/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/floorf/CMakeLists.txt new file mode 100644 index 0000000000..5e1ef7f28b --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/floorf/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +add_subdirectory(test1) diff --git a/src/pal/tests/palsuite/c_runtime/floorf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/floorf/test1/CMakeLists.txt new file mode 100644 index 0000000000..f6e24adcd9 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/floorf/test1/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test1.c +) + +add_executable(paltest_floorf_test1 + ${SOURCES} +) + +add_dependencies(paltest_floorf_test1 coreclrpal) + +target_link_libraries(paltest_floorf_test1 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/floorf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/floorf/test1/test1.c new file mode 100644 index 0000000000..57dca21382 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/floorf/test1/test1.c @@ -0,0 +1,131 @@ +// 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: test1.c +** +** Purpose: Tests floorf with simple positive and negative values. Also tests +** extreme cases like extremely small values and positive and +** negative infinity. Makes sure that calling floorf on NaN returns +** NaN +** +**==========================================================================*/ + +#include <palsuite.h> + +// binary32 (float) has a machine epsilon of 2^-23 (approx. 1.19e-07). However, this +// is slightly too accurate when writing tests meant to run against libm implementations +// for various platforms. 2^-21 (approx. 4.76e-07) seems to be as accurate as we can get. +// +// The tests themselves will take PAL_EPSILON and adjust it according to the expected result +// so that the delta used for comparison will compare the most significant digits and ignore +// any digits that are outside the double precision range (6-9 digits). + +// For example, a test with an expect result in the format of 0.xxxxxxxxx will use PAL_EPSILON +// for the variance, while an expected result in the format of 0.0xxxxxxxxx will use +// PAL_EPSILON / 10 and and expected result in the format of x.xxxxxx will use PAL_EPSILON * 10. +#define PAL_EPSILON 4.76837158e-07 + +#define PAL_NAN sqrtf(-1.0f) +#define PAL_POSINF -logf(0.0f) +#define PAL_NEGINF logf(0.0f) + +/** + * Helper test structure + */ +struct test +{ + float value; /* value to test the function with */ + float expected; /* expected result */ + float variance; /* maximum delta between the expected and actual result */ +}; + +/** + * validate + * + * test validation function + */ +void __cdecl validate(float value, float expected, float variance) +{ + float result = floorf(value); + + /* + * The test is valid when the difference between result + * and expected is less than or equal to variance + */ + float delta = fabsf(result - expected); + + if (delta > variance) + { + Fail("floorf(%g) returned %10.9g when it should have returned %10.9g", + value, result, expected); + } +} + +/** + * validate + * + * test validation function for values returning NaN + */ +void __cdecl validate_isnan(float value) +{ + float result = floorf(value); + + if (!_isnanf(result)) + { + Fail("floorf(%g) returned %10.9g when it should have returned %10.9g", + value, result, PAL_NAN); + } +} + +/** + * main + * + * executable entry point + */ +int __cdecl main(int argc, char *argv[]) +{ + struct test tests[] = + { + /* value expected variance */ + { 0.318309886f, 0, PAL_EPSILON }, // value: 1 / pi + { 0.434294482f, 0, PAL_EPSILON }, // value: log10f(e) + { 0.636619772f, 0, PAL_EPSILON }, // value: 2 / pi + { 0.693147181f, 0, PAL_EPSILON }, // value: ln(2) + { 0.707106781f, 0, PAL_EPSILON }, // value: 1 / sqrtf(2) + { 0.785398163f, 0, PAL_EPSILON }, // value: pi / 4 + { 1.12837917f, 1, PAL_EPSILON * 10 }, // value: 2 / sqrtf(pi) + { 1.41421356f, 1, PAL_EPSILON * 10 }, // value: sqrtf(2) + { 1.44269504f, 1, PAL_EPSILON * 10 }, // value: logf2(e) + { 1.57079633f, 1, PAL_EPSILON * 10 }, // value: pi / 2 + { 2.30258509f, 2, PAL_EPSILON * 10 }, // value: ln(10) + { 2.71828183f, 2, PAL_EPSILON * 10 }, // value: e + { 3.14159265f, 3, PAL_EPSILON * 10 }, // value: pi + { PAL_POSINF, PAL_POSINF, 0 } + }; + + /* PAL initialization */ + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + validate( 0, 0, PAL_EPSILON); + validate(-0.0f, 0, PAL_EPSILON); + + validate( 1, 1, PAL_EPSILON * 10); + validate(-1.0f, -1, PAL_EPSILON * 10); + + for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) + { + validate( tests[i].value, tests[i].expected, tests[i].variance); + validate(-tests[i].value, -(tests[i].expected + 1), tests[i].variance); + } + + validate_isnan(PAL_NAN); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/floorf/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/floorf/test1/testinfo.dat new file mode 100644 index 0000000000..006540141a --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/floorf/test1/testinfo.dat @@ -0,0 +1,13 @@ +# 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 = floorf +Name = Positive Test for floorf +TYPE = DEFAULT +EXE1 = test1 +Description += Passes to floorf() a series of value, checking that += each one return to correct value. diff --git a/src/pal/tests/palsuite/c_runtime/fmod/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fmod/test1/CMakeLists.txt index c76df1f0bf..33fbfb2653 100644 --- a/src/pal/tests/palsuite/c_runtime/fmod/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fmod/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_fmod_test1 diff --git a/src/pal/tests/palsuite/c_runtime/fmod/test1/test1.c b/src/pal/tests/palsuite/c_runtime/fmod/test1/test1.cpp index fd69ca52cb..fd69ca52cb 100644 --- a/src/pal/tests/palsuite/c_runtime/fmod/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/fmod/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fmodf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fmodf/test1/CMakeLists.txt index d1ea238a98..487b3adda4 100644 --- a/src/pal/tests/palsuite/c_runtime/fmodf/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fmodf/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_fmodf_test1 diff --git a/src/pal/tests/palsuite/c_runtime/fmodf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/fmodf/test1/test1.cpp index 31b45d3606..31b45d3606 100644 --- a/src/pal/tests/palsuite/c_runtime/fmodf/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/fmodf/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fopen/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fopen/test1/CMakeLists.txt index 6578c43659..7603fc623e 100644 --- a/src/pal/tests/palsuite/c_runtime/fopen/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fopen/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_fopen_test1 diff --git a/src/pal/tests/palsuite/c_runtime/fopen/test1/test1.c b/src/pal/tests/palsuite/c_runtime/fopen/test1/test1.cpp index 565b4eb77d..565b4eb77d 100644 --- a/src/pal/tests/palsuite/c_runtime/fopen/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/fopen/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fopen/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fopen/test2/CMakeLists.txt index 4458ed21d8..b8569921de 100644 --- a/src/pal/tests/palsuite/c_runtime/fopen/test2/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fopen/test2/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test2.c + test2.cpp ) add_executable(paltest_fopen_test2 diff --git a/src/pal/tests/palsuite/c_runtime/fopen/test2/test2.c b/src/pal/tests/palsuite/c_runtime/fopen/test2/test2.cpp index 4026efe89a..4026efe89a 100644 --- a/src/pal/tests/palsuite/c_runtime/fopen/test2/test2.c +++ b/src/pal/tests/palsuite/c_runtime/fopen/test2/test2.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fopen/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fopen/test3/CMakeLists.txt index 2c80f72ae7..5b28caf4ba 100644 --- a/src/pal/tests/palsuite/c_runtime/fopen/test3/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fopen/test3/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test3.c + test3.cpp ) add_executable(paltest_fopen_test3 diff --git a/src/pal/tests/palsuite/c_runtime/fopen/test3/test3.c b/src/pal/tests/palsuite/c_runtime/fopen/test3/test3.cpp index f3af42dc8a..f3af42dc8a 100644 --- a/src/pal/tests/palsuite/c_runtime/fopen/test3/test3.c +++ b/src/pal/tests/palsuite/c_runtime/fopen/test3/test3.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fopen/test4/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fopen/test4/CMakeLists.txt index 92e0ef0bd8..db5779f282 100644 --- a/src/pal/tests/palsuite/c_runtime/fopen/test4/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fopen/test4/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test4.c + test4.cpp ) add_executable(paltest_fopen_test4 diff --git a/src/pal/tests/palsuite/c_runtime/fopen/test4/test4.c b/src/pal/tests/palsuite/c_runtime/fopen/test4/test4.cpp index 04683d52c5..04683d52c5 100644 --- a/src/pal/tests/palsuite/c_runtime/fopen/test4/test4.c +++ b/src/pal/tests/palsuite/c_runtime/fopen/test4/test4.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fopen/test5/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fopen/test5/CMakeLists.txt index 82529b9aab..6341e4a7d2 100644 --- a/src/pal/tests/palsuite/c_runtime/fopen/test5/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fopen/test5/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test5.c + test5.cpp ) add_executable(paltest_fopen_test5 diff --git a/src/pal/tests/palsuite/c_runtime/fopen/test5/test5.c b/src/pal/tests/palsuite/c_runtime/fopen/test5/test5.cpp index 0a760314e1..0a760314e1 100644 --- a/src/pal/tests/palsuite/c_runtime/fopen/test5/test5.c +++ b/src/pal/tests/palsuite/c_runtime/fopen/test5/test5.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fopen/test6/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fopen/test6/CMakeLists.txt index 9a01cfb9a8..39cf9158bb 100644 --- a/src/pal/tests/palsuite/c_runtime/fopen/test6/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fopen/test6/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test6.c + test6.cpp ) add_executable(paltest_fopen_test6 diff --git a/src/pal/tests/palsuite/c_runtime/fopen/test6/test6.c b/src/pal/tests/palsuite/c_runtime/fopen/test6/test6.cpp index 03b6067fdd..03b6067fdd 100644 --- a/src/pal/tests/palsuite/c_runtime/fopen/test6/test6.c +++ b/src/pal/tests/palsuite/c_runtime/fopen/test6/test6.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fopen/test7/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fopen/test7/CMakeLists.txt index 168a5aff53..ee22e347d6 100644 --- a/src/pal/tests/palsuite/c_runtime/fopen/test7/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fopen/test7/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test7.c + test7.cpp ) add_executable(paltest_fopen_test7 diff --git a/src/pal/tests/palsuite/c_runtime/fopen/test7/test7.c b/src/pal/tests/palsuite/c_runtime/fopen/test7/test7.cpp index 3ef8602ddb..3ef8602ddb 100644 --- a/src/pal/tests/palsuite/c_runtime/fopen/test7/test7.c +++ b/src/pal/tests/palsuite/c_runtime/fopen/test7/test7.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/fprintf.h b/src/pal/tests/palsuite/c_runtime/fprintf/fprintf.h index 380eb0a0b3..87ee0d1232 100644 --- a/src/pal/tests/palsuite/c_runtime/fprintf/fprintf.h +++ b/src/pal/tests/palsuite/c_runtime/fprintf/fprintf.h @@ -11,7 +11,7 @@ function with this as a return type. #ifndef __FPRINTF_H__ #define __FPRINTF_H__ -void DoStrTest(char *formatstr, char* param, char *checkstr) +void DoStrTest(const char *formatstr, char* param, const char *checkstr) { FILE *fp; char buf[256] = { 0 }; @@ -34,7 +34,7 @@ void DoStrTest(char *formatstr, char* param, char *checkstr) fclose(fp); } -void DoWStrTest(char *formatstr, WCHAR* param, char *checkstr) +void DoWStrTest(const char *formatstr, WCHAR* param, const char *checkstr) { FILE *fp; char buf[256] = { 0 }; @@ -58,7 +58,7 @@ void DoWStrTest(char *formatstr, WCHAR* param, char *checkstr) } -void DoCharTest(char *formatstr, char param, char *checkstr) +void DoCharTest(const char *formatstr, char param, const char *checkstr) { FILE *fp; char buf[256] = { 0 }; @@ -81,7 +81,7 @@ void DoCharTest(char *formatstr, char param, char *checkstr) fclose(fp); } -void DoWCharTest(char *formatstr, WCHAR param, char *checkstr) +void DoWCharTest(const char *formatstr, WCHAR param, const char *checkstr) { FILE *fp; char buf[256] = { 0 }; @@ -104,7 +104,7 @@ void DoWCharTest(char *formatstr, WCHAR param, char *checkstr) fclose(fp); } -void DoNumTest(char *formatstr, int value, char *checkstr) +void DoNumTest(const char *formatstr, int value, const char *checkstr) { FILE *fp; char buf[256] = { 0 }; @@ -127,7 +127,7 @@ void DoNumTest(char *formatstr, int value, char *checkstr) fclose(fp); } -void DoI64Test(char *formatstr, INT64 value, char *valuestr, char *checkstr1, char *checkstr2) +void DoI64Test(const char *formatstr, INT64 value, char *valuestr, const char *checkstr1, const char *checkstr2) { FILE *fp; char buf[256] = { 0 }; @@ -151,7 +151,7 @@ void DoI64Test(char *formatstr, INT64 value, char *valuestr, char *checkstr1, ch fclose(fp); } -void DoDoubleTest(char *formatstr, double value, char *checkstr1, char *checkstr2) +void DoDoubleTest(const char *formatstr, double value, const char *checkstr1, const char *checkstr2) { FILE *fp; char buf[256] = { 0 }; diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fprintf/test1/CMakeLists.txt index ab4176563d..60ffd49cf5 100644 --- a/src/pal/tests/palsuite/c_runtime/fprintf/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fprintf/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_fprintf_test1 diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/fprintf/test1/test1.cpp index d55fc2534c..d55fc2534c 100644 --- a/src/pal/tests/palsuite/c_runtime/fprintf/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/fprintf/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test10/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fprintf/test10/CMakeLists.txt index f718ad7934..3fb57c217c 100644 --- a/src/pal/tests/palsuite/c_runtime/fprintf/test10/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fprintf/test10/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test10.c + test10.cpp ) add_executable(paltest_fprintf_test10 diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test10/test10.c b/src/pal/tests/palsuite/c_runtime/fprintf/test10/test10.cpp index 5988e8da74..5988e8da74 100644 --- a/src/pal/tests/palsuite/c_runtime/fprintf/test10/test10.c +++ b/src/pal/tests/palsuite/c_runtime/fprintf/test10/test10.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test11/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fprintf/test11/CMakeLists.txt index 6ccd58ddd2..d325ce225e 100644 --- a/src/pal/tests/palsuite/c_runtime/fprintf/test11/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fprintf/test11/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test11.c + test11.cpp ) add_executable(paltest_fprintf_test11 diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test11/test11.c b/src/pal/tests/palsuite/c_runtime/fprintf/test11/test11.cpp index 01880552b7..01880552b7 100644 --- a/src/pal/tests/palsuite/c_runtime/fprintf/test11/test11.c +++ b/src/pal/tests/palsuite/c_runtime/fprintf/test11/test11.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test12/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fprintf/test12/CMakeLists.txt index 17bc7f100b..8bd3970e80 100644 --- a/src/pal/tests/palsuite/c_runtime/fprintf/test12/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fprintf/test12/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test12.c + test12.cpp ) add_executable(paltest_fprintf_test12 diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test12/test12.c b/src/pal/tests/palsuite/c_runtime/fprintf/test12/test12.cpp index 0292e15014..0292e15014 100644 --- a/src/pal/tests/palsuite/c_runtime/fprintf/test12/test12.c +++ b/src/pal/tests/palsuite/c_runtime/fprintf/test12/test12.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test13/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fprintf/test13/CMakeLists.txt index c6eb0f9075..702058b797 100644 --- a/src/pal/tests/palsuite/c_runtime/fprintf/test13/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fprintf/test13/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test13.c + test13.cpp ) add_executable(paltest_fprintf_test13 diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test13/test13.c b/src/pal/tests/palsuite/c_runtime/fprintf/test13/test13.cpp index e171aeacce..e171aeacce 100644 --- a/src/pal/tests/palsuite/c_runtime/fprintf/test13/test13.c +++ b/src/pal/tests/palsuite/c_runtime/fprintf/test13/test13.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test14/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fprintf/test14/CMakeLists.txt index 6bb281bc62..b92ede7c87 100644 --- a/src/pal/tests/palsuite/c_runtime/fprintf/test14/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fprintf/test14/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test14.c + test14.cpp ) add_executable(paltest_fprintf_test14 diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test14/test14.c b/src/pal/tests/palsuite/c_runtime/fprintf/test14/test14.cpp index 5d7d77387d..5d7d77387d 100644 --- a/src/pal/tests/palsuite/c_runtime/fprintf/test14/test14.c +++ b/src/pal/tests/palsuite/c_runtime/fprintf/test14/test14.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test15/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fprintf/test15/CMakeLists.txt index ce1a8b6111..20f1e42aab 100644 --- a/src/pal/tests/palsuite/c_runtime/fprintf/test15/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fprintf/test15/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test15.c + test15.cpp ) add_executable(paltest_fprintf_test15 diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test15/test15.c b/src/pal/tests/palsuite/c_runtime/fprintf/test15/test15.cpp index d024bdbd8a..d024bdbd8a 100644 --- a/src/pal/tests/palsuite/c_runtime/fprintf/test15/test15.c +++ b/src/pal/tests/palsuite/c_runtime/fprintf/test15/test15.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test16/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fprintf/test16/CMakeLists.txt index 011cd13fb1..8d72421210 100644 --- a/src/pal/tests/palsuite/c_runtime/fprintf/test16/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fprintf/test16/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test16.c + test16.cpp ) add_executable(paltest_fprintf_test16 diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test16/test16.c b/src/pal/tests/palsuite/c_runtime/fprintf/test16/test16.cpp index 079faeaf59..079faeaf59 100644 --- a/src/pal/tests/palsuite/c_runtime/fprintf/test16/test16.c +++ b/src/pal/tests/palsuite/c_runtime/fprintf/test16/test16.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test17/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fprintf/test17/CMakeLists.txt index 4516f4b769..82d1f84f31 100644 --- a/src/pal/tests/palsuite/c_runtime/fprintf/test17/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fprintf/test17/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test17.c + test17.cpp ) add_executable(paltest_fprintf_test17 diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test17/test17.c b/src/pal/tests/palsuite/c_runtime/fprintf/test17/test17.cpp index 7bd817d7db..7bd817d7db 100644 --- a/src/pal/tests/palsuite/c_runtime/fprintf/test17/test17.c +++ b/src/pal/tests/palsuite/c_runtime/fprintf/test17/test17.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test18/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fprintf/test18/CMakeLists.txt index fc035020ca..1ca54e42b7 100644 --- a/src/pal/tests/palsuite/c_runtime/fprintf/test18/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fprintf/test18/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test18.c + test18.cpp ) add_executable(paltest_fprintf_test18 diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test18/test18.c b/src/pal/tests/palsuite/c_runtime/fprintf/test18/test18.cpp index 6582c41e0f..6582c41e0f 100644 --- a/src/pal/tests/palsuite/c_runtime/fprintf/test18/test18.c +++ b/src/pal/tests/palsuite/c_runtime/fprintf/test18/test18.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test19/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fprintf/test19/CMakeLists.txt index 3781b426f2..2c66239801 100644 --- a/src/pal/tests/palsuite/c_runtime/fprintf/test19/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fprintf/test19/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test19.c + test19.cpp ) add_executable(paltest_fprintf_test19 diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test19/test19.c b/src/pal/tests/palsuite/c_runtime/fprintf/test19/test19.cpp index 9d9a28c325..9d9a28c325 100644 --- a/src/pal/tests/palsuite/c_runtime/fprintf/test19/test19.c +++ b/src/pal/tests/palsuite/c_runtime/fprintf/test19/test19.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fprintf/test2/CMakeLists.txt index 0ef44b6b7d..ae1d9dc64d 100644 --- a/src/pal/tests/palsuite/c_runtime/fprintf/test2/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fprintf/test2/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test2.c + test2.cpp ) add_executable(paltest_fprintf_test2 diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test2/test2.c b/src/pal/tests/palsuite/c_runtime/fprintf/test2/test2.cpp index 1ed7f3fd23..1ed7f3fd23 100644 --- a/src/pal/tests/palsuite/c_runtime/fprintf/test2/test2.c +++ b/src/pal/tests/palsuite/c_runtime/fprintf/test2/test2.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fprintf/test3/CMakeLists.txt index adfd36fce7..4b10c4c407 100644 --- a/src/pal/tests/palsuite/c_runtime/fprintf/test3/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fprintf/test3/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test3.c + test3.cpp ) add_executable(paltest_fprintf_test3 diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test3/test3.c b/src/pal/tests/palsuite/c_runtime/fprintf/test3/test3.cpp index 6185135581..6185135581 100644 --- a/src/pal/tests/palsuite/c_runtime/fprintf/test3/test3.c +++ b/src/pal/tests/palsuite/c_runtime/fprintf/test3/test3.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test4/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fprintf/test4/CMakeLists.txt index 7d471b1b9c..292bdb6625 100644 --- a/src/pal/tests/palsuite/c_runtime/fprintf/test4/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fprintf/test4/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test4.c + test4.cpp ) add_executable(paltest_fprintf_test4 diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test4/test4.c b/src/pal/tests/palsuite/c_runtime/fprintf/test4/test4.cpp index 51ec1f099c..51ec1f099c 100644 --- a/src/pal/tests/palsuite/c_runtime/fprintf/test4/test4.c +++ b/src/pal/tests/palsuite/c_runtime/fprintf/test4/test4.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test5/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fprintf/test5/CMakeLists.txt index 1e3a568513..370ed3329a 100644 --- a/src/pal/tests/palsuite/c_runtime/fprintf/test5/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fprintf/test5/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test5.c + test5.cpp ) add_executable(paltest_fprintf_test5 diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test5/test5.c b/src/pal/tests/palsuite/c_runtime/fprintf/test5/test5.cpp index c53e3f45b4..c53e3f45b4 100644 --- a/src/pal/tests/palsuite/c_runtime/fprintf/test5/test5.c +++ b/src/pal/tests/palsuite/c_runtime/fprintf/test5/test5.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test6/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fprintf/test6/CMakeLists.txt index 89620dd453..bd1cbda924 100644 --- a/src/pal/tests/palsuite/c_runtime/fprintf/test6/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fprintf/test6/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test6.c + test6.cpp ) add_executable(paltest_fprintf_test6 diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test6/test6.c b/src/pal/tests/palsuite/c_runtime/fprintf/test6/test6.cpp index 0a8bc6b103..0a8bc6b103 100644 --- a/src/pal/tests/palsuite/c_runtime/fprintf/test6/test6.c +++ b/src/pal/tests/palsuite/c_runtime/fprintf/test6/test6.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test7/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fprintf/test7/CMakeLists.txt index 3dc10dd6dc..38429e7900 100644 --- a/src/pal/tests/palsuite/c_runtime/fprintf/test7/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fprintf/test7/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test7.c + test7.cpp ) add_executable(paltest_fprintf_test7 diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test7/test7.c b/src/pal/tests/palsuite/c_runtime/fprintf/test7/test7.cpp index 088e328de5..088e328de5 100644 --- a/src/pal/tests/palsuite/c_runtime/fprintf/test7/test7.c +++ b/src/pal/tests/palsuite/c_runtime/fprintf/test7/test7.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test8/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fprintf/test8/CMakeLists.txt index f6dd984af9..990eca26b0 100644 --- a/src/pal/tests/palsuite/c_runtime/fprintf/test8/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fprintf/test8/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test8.c + test8.cpp ) add_executable(paltest_fprintf_test8 diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test8/test8.c b/src/pal/tests/palsuite/c_runtime/fprintf/test8/test8.cpp index c781abc968..c781abc968 100644 --- a/src/pal/tests/palsuite/c_runtime/fprintf/test8/test8.c +++ b/src/pal/tests/palsuite/c_runtime/fprintf/test8/test8.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test9/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fprintf/test9/CMakeLists.txt index 62aa85e6ff..715d38a431 100644 --- a/src/pal/tests/palsuite/c_runtime/fprintf/test9/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fprintf/test9/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test9.c + test9.cpp ) add_executable(paltest_fprintf_test9 diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test9/test9.c b/src/pal/tests/palsuite/c_runtime/fprintf/test9/test9.cpp index 3b06daec48..3b06daec48 100644 --- a/src/pal/tests/palsuite/c_runtime/fprintf/test9/test9.c +++ b/src/pal/tests/palsuite/c_runtime/fprintf/test9/test9.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fputs/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fputs/test1/CMakeLists.txt index e4a92d5966..d0f1aca0e6 100644 --- a/src/pal/tests/palsuite/c_runtime/fputs/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fputs/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_fputs_test1 diff --git a/src/pal/tests/palsuite/c_runtime/fputs/test1/test1.c b/src/pal/tests/palsuite/c_runtime/fputs/test1/test1.cpp index b90ea082e9..b90ea082e9 100644 --- a/src/pal/tests/palsuite/c_runtime/fputs/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/fputs/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fputs/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fputs/test2/CMakeLists.txt index 6e939f3346..9242ea16e5 100644 --- a/src/pal/tests/palsuite/c_runtime/fputs/test2/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fputs/test2/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test2.c + test2.cpp ) add_executable(paltest_fputs_test2 diff --git a/src/pal/tests/palsuite/c_runtime/fputs/test2/test2.c b/src/pal/tests/palsuite/c_runtime/fputs/test2/test2.cpp index b8e2f410bb..b8e2f410bb 100644 --- a/src/pal/tests/palsuite/c_runtime/fputs/test2/test2.c +++ b/src/pal/tests/palsuite/c_runtime/fputs/test2/test2.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fread/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fread/test1/CMakeLists.txt index a2e09579b1..1bd84b5c62 100644 --- a/src/pal/tests/palsuite/c_runtime/fread/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fread/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_fread_test1 diff --git a/src/pal/tests/palsuite/c_runtime/fread/test1/test1.c b/src/pal/tests/palsuite/c_runtime/fread/test1/test1.cpp index b706b2e91c..b706b2e91c 100644 --- a/src/pal/tests/palsuite/c_runtime/fread/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/fread/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fread/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fread/test2/CMakeLists.txt index 0538e0c3af..93e0394832 100644 --- a/src/pal/tests/palsuite/c_runtime/fread/test2/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fread/test2/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test2.c + test2.cpp ) add_executable(paltest_fread_test2 diff --git a/src/pal/tests/palsuite/c_runtime/fread/test2/test2.c b/src/pal/tests/palsuite/c_runtime/fread/test2/test2.cpp index d7262a9321..d7262a9321 100644 --- a/src/pal/tests/palsuite/c_runtime/fread/test2/test2.c +++ b/src/pal/tests/palsuite/c_runtime/fread/test2/test2.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fread/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fread/test3/CMakeLists.txt index f3c636f3df..285608bc3d 100644 --- a/src/pal/tests/palsuite/c_runtime/fread/test3/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fread/test3/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test3.c + test3.cpp ) add_executable(paltest_fread_test3 diff --git a/src/pal/tests/palsuite/c_runtime/fread/test3/test3.c b/src/pal/tests/palsuite/c_runtime/fread/test3/test3.cpp index 8c79bee582..8c79bee582 100644 --- a/src/pal/tests/palsuite/c_runtime/fread/test3/test3.c +++ b/src/pal/tests/palsuite/c_runtime/fread/test3/test3.cpp diff --git a/src/pal/tests/palsuite/c_runtime/free/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/free/test1/CMakeLists.txt index bd94cb5733..92ee9896c7 100644 --- a/src/pal/tests/palsuite/c_runtime/free/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/free/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_free_test1 diff --git a/src/pal/tests/palsuite/c_runtime/free/test1/test1.c b/src/pal/tests/palsuite/c_runtime/free/test1/test1.cpp index 4ff8dfb094..4ff8dfb094 100644 --- a/src/pal/tests/palsuite/c_runtime/free/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/free/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fseek/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fseek/test1/CMakeLists.txt index fb55bd1051..59ee8b4563 100644 --- a/src/pal/tests/palsuite/c_runtime/fseek/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fseek/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_fseek_test1 diff --git a/src/pal/tests/palsuite/c_runtime/fseek/test1/test1.c b/src/pal/tests/palsuite/c_runtime/fseek/test1/test1.c deleted file mode 100644 index 8496289a01..0000000000 --- a/src/pal/tests/palsuite/c_runtime/fseek/test1/test1.c +++ /dev/null @@ -1,193 +0,0 @@ -// 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: test1.c -** -** Purpose: Call fseek to move a file pointer to the start of a file, -** a position offset from the start, a position offset from the -** current position, and a position offset from the end of the -** file. Check that the file pointer is at the correct position -** after each seek. -** -** -**==========================================================================*/ - -#include <palsuite.h> - -const char filename[] = "testfile.txt"; - -static BOOL Cleanup(HANDLE hFile) -{ - BOOL result= TRUE; - - if (fclose(hFile)) - { - Trace("fseek: ERROR -> Unable to close file \"%s\".\n", - filename); - result= FALSE; - } - if (!DeleteFileA(filename)) - { - result= FALSE; - Trace("fseek: ERROR -> Unable to delete file \"%s\". ", - "GetLastError returned %u.\n", - filename, - GetLastError()); - } - return result; -} - -int __cdecl main(int argc, char **argv) -{ - char outBuf[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - char inBuf[20]; - FILE * fp; - int size = ( sizeof(outBuf)/sizeof(char) ) - 1; - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - - /*create the file*/ - fp = fopen(filename, "w"); - if (fp == NULL) - { - Fail("Unable to open a file for write.\n"); - } - if(fprintf(fp, outBuf) != size) - { - Trace("Unable to write to %s.\n", filename); - Cleanup(fp); - Fail(""); - } - - if (fclose(fp) != 0) - { - Trace("Unable to close newly written file.\n"); - if (!DeleteFileA(filename)) - { - Trace("fseek: ERROR -> Unable to delete file \"%s\". ", - "GetLastError returned %u.\n", - filename, - GetLastError()); - } - Fail(""); - } - - fp = fopen(filename, "r"); - if (fp == NULL) - { - if (!DeleteFileA(filename)) - { - Trace("_putw: ERROR -> Unable to delete file \"%s\". ", - "GetLastError returned %u.\n", - filename, - GetLastError()); - } - Fail("Unable to open a file for read.\n"); - } - - /*seek to the start*/ - if (fseek(fp, 0, SEEK_SET) != 0) - { - Cleanup(fp); - Fail("fseek failed when seeking the start of a file.\n"); - } - if (fgets(inBuf, 11, fp) != inBuf) - { - Cleanup(fp); - Fail("Unable to read from file after using fseek to move to the start.\n"); - } - if (strncmp(inBuf, outBuf, 10) != 0) - { - Cleanup(fp); - Fail("fseek was asked to seek the start of a file," - "but didn't get there.\n"); - } - - /*Seek with an offset from the start*/ - - if (fseek(fp, 10, SEEK_SET) != 0) - { - Cleanup(fp); - Fail("fseek failed when called with SEEK_SET and a positive offset.\n"); - } - - if (fgets(inBuf, 6, fp) != inBuf) - { - Cleanup(fp); - Fail("fgets failed after feek was called with SEEK_SET" - "and a positive offset.\n"); - } - - - if (strncmp(inBuf, "ABCDE", 5) != 0) - { - Cleanup(fp); - Fail("fseek did not move to the correct position when passed SEEK_SET" - " and a positive offset.\n"); - } - - /*now move backwards and read the same string*/ - if (fseek(fp, -5, SEEK_CUR) != 0) - { - Cleanup(fp); - Fail("fseek failed when passed SEEK_CUR and a negative offset.\n"); - } - - if (fgets(inBuf, 6, fp) != inBuf) - { - Cleanup(fp); - Fail("fgets failed after fseek was called with SEEK_CUR and a " - "negative offset.\n"); - } - - if (strncmp(inBuf, "ABCDE", 5) != 0) - { - Cleanup(fp); - Fail("fseek did not move to the correct position when called with" - " SEEK_CUR and a negative offset.\n"); - } - - /*Try seeking relative to the end of the file.*/ - if (fseek(fp, -10, SEEK_END) != 0) - { - Cleanup(fp); - Fail("fseek failed when called with SEEK_END and a negative" - " offset.\n"); - } - if (fgets(inBuf, 2, fp) != inBuf) - { - Cleanup(fp); - Fail("fgets failed after fseek was called with SEEK_END and a " - "negative offset\n"); - } - - if (strncmp(inBuf, "Q", 1) != 0) - { - Cleanup(fp); - Fail("fseek did not move to the correct position when called with " - "SEEK_END and a negative offset.\n"); - } - - - /*close the file*/ - if(!Cleanup(fp)) - { - Fail(""); - } - - PAL_Terminate(); - return PASS; -} - - - - - - diff --git a/src/pal/tests/palsuite/c_runtime/fseek/test1/test1.cpp b/src/pal/tests/palsuite/c_runtime/fseek/test1/test1.cpp new file mode 100644 index 0000000000..dd1e87ea8d --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/fseek/test1/test1.cpp @@ -0,0 +1,193 @@ +// 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: test1.c +** +** Purpose: Call fseek to move a file pointer to the start of a file, +** a position offset from the start, a position offset from the +** current position, and a position offset from the end of the +** file. Check that the file pointer is at the correct position +** after each seek. +** +** +**==========================================================================*/ + +#include <palsuite.h> + +const char filename[] = "testfile.txt"; + +static BOOL Cleanup(HANDLE hFile) +{ + BOOL result= TRUE; + + if (fclose((PAL_FILE*)hFile)) + { + Trace("fseek: ERROR -> Unable to close file \"%s\".\n", + filename); + result= FALSE; + } + if (!DeleteFileA(filename)) + { + result= FALSE; + Trace("fseek: ERROR -> Unable to delete file \"%s\". ", + "GetLastError returned %u.\n", + filename, + GetLastError()); + } + return result; +} + +int __cdecl main(int argc, char **argv) +{ + char outBuf[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + char inBuf[20]; + FILE * fp; + int size = ( sizeof(outBuf)/sizeof(char) ) - 1; + + if (PAL_Initialize(argc, argv)) + { + return FAIL; + } + + + /*create the file*/ + fp = fopen(filename, "w"); + if (fp == NULL) + { + Fail("Unable to open a file for write.\n"); + } + if(fprintf(fp, outBuf) != size) + { + Trace("Unable to write to %s.\n", filename); + Cleanup(fp); + Fail(""); + } + + if (fclose(fp) != 0) + { + Trace("Unable to close newly written file.\n"); + if (!DeleteFileA(filename)) + { + Trace("fseek: ERROR -> Unable to delete file \"%s\". ", + "GetLastError returned %u.\n", + filename, + GetLastError()); + } + Fail(""); + } + + fp = fopen(filename, "r"); + if (fp == NULL) + { + if (!DeleteFileA(filename)) + { + Trace("_putw: ERROR -> Unable to delete file \"%s\". ", + "GetLastError returned %u.\n", + filename, + GetLastError()); + } + Fail("Unable to open a file for read.\n"); + } + + /*seek to the start*/ + if (fseek(fp, 0, SEEK_SET) != 0) + { + Cleanup(fp); + Fail("fseek failed when seeking the start of a file.\n"); + } + if (fgets(inBuf, 11, fp) != inBuf) + { + Cleanup(fp); + Fail("Unable to read from file after using fseek to move to the start.\n"); + } + if (strncmp(inBuf, outBuf, 10) != 0) + { + Cleanup(fp); + Fail("fseek was asked to seek the start of a file," + "but didn't get there.\n"); + } + + /*Seek with an offset from the start*/ + + if (fseek(fp, 10, SEEK_SET) != 0) + { + Cleanup(fp); + Fail("fseek failed when called with SEEK_SET and a positive offset.\n"); + } + + if (fgets(inBuf, 6, fp) != inBuf) + { + Cleanup(fp); + Fail("fgets failed after feek was called with SEEK_SET" + "and a positive offset.\n"); + } + + + if (strncmp(inBuf, "ABCDE", 5) != 0) + { + Cleanup(fp); + Fail("fseek did not move to the correct position when passed SEEK_SET" + " and a positive offset.\n"); + } + + /*now move backwards and read the same string*/ + if (fseek(fp, -5, SEEK_CUR) != 0) + { + Cleanup(fp); + Fail("fseek failed when passed SEEK_CUR and a negative offset.\n"); + } + + if (fgets(inBuf, 6, fp) != inBuf) + { + Cleanup(fp); + Fail("fgets failed after fseek was called with SEEK_CUR and a " + "negative offset.\n"); + } + + if (strncmp(inBuf, "ABCDE", 5) != 0) + { + Cleanup(fp); + Fail("fseek did not move to the correct position when called with" + " SEEK_CUR and a negative offset.\n"); + } + + /*Try seeking relative to the end of the file.*/ + if (fseek(fp, -10, SEEK_END) != 0) + { + Cleanup(fp); + Fail("fseek failed when called with SEEK_END and a negative" + " offset.\n"); + } + if (fgets(inBuf, 2, fp) != inBuf) + { + Cleanup(fp); + Fail("fgets failed after fseek was called with SEEK_END and a " + "negative offset\n"); + } + + if (strncmp(inBuf, "Q", 1) != 0) + { + Cleanup(fp); + Fail("fseek did not move to the correct position when called with " + "SEEK_END and a negative offset.\n"); + } + + + /*close the file*/ + if(!Cleanup(fp)) + { + Fail(""); + } + + PAL_Terminate(); + return PASS; +} + + + + + + diff --git a/src/pal/tests/palsuite/c_runtime/ftell/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/ftell/test1/CMakeLists.txt index 7ea9a51111..a1f350d0c2 100644 --- a/src/pal/tests/palsuite/c_runtime/ftell/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/ftell/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - ftell.c + ftell.cpp ) add_executable(paltest_ftell_test1 diff --git a/src/pal/tests/palsuite/c_runtime/ftell/test1/ftell.c b/src/pal/tests/palsuite/c_runtime/ftell/test1/ftell.cpp index 66e0854847..66e0854847 100644 --- a/src/pal/tests/palsuite/c_runtime/ftell/test1/ftell.c +++ b/src/pal/tests/palsuite/c_runtime/ftell/test1/ftell.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/fwprintf.h b/src/pal/tests/palsuite/c_runtime/fwprintf/fwprintf.h index 36756636cf..eed0e76484 100644 --- a/src/pal/tests/palsuite/c_runtime/fwprintf/fwprintf.h +++ b/src/pal/tests/palsuite/c_runtime/fwprintf/fwprintf.h @@ -14,7 +14,7 @@ #ifndef __fwprintf_H__ #define __fwprintf_H__ -void DoStrTest(WCHAR *formatstr, char* param, char *checkstr) +void DoStrTest(const WCHAR *formatstr, char* param, const char *checkstr) { FILE *fp; char buf[256] = { 0 }; @@ -45,7 +45,7 @@ void DoStrTest(WCHAR *formatstr, char* param, char *checkstr) fclose(fp); } -void DoWStrTest(WCHAR *formatstr, WCHAR* param, char *checkstr) +void DoWStrTest(const WCHAR *formatstr, WCHAR* param, const char *checkstr) { FILE *fp; char buf[256] = { 0 }; @@ -77,8 +77,8 @@ void DoWStrTest(WCHAR *formatstr, WCHAR* param, char *checkstr) } -void DoPointerTest(WCHAR *formatstr, void* param, char* paramstr, - char *checkstr1, char *checkstr2) +void DoPointerTest(const WCHAR *formatstr, void* param, char* paramstr, + const char *checkstr1, const char *checkstr2) { FILE *fp; char buf[256] = { 0 }; @@ -119,7 +119,7 @@ void DoPointerTest(WCHAR *formatstr, void* param, char* paramstr, -void DoCountTest(WCHAR *formatstr, int param, char *checkstr) +void DoCountTest(const WCHAR *formatstr, int param, const char *checkstr) { FILE *fp; char buf[512] = { 0 }; @@ -162,7 +162,7 @@ void DoCountTest(WCHAR *formatstr, int param, char *checkstr) } } -void DoShortCountTest(WCHAR *formatstr, int param, char *checkstr) +void DoShortCountTest(const WCHAR *formatstr, int param, const char *checkstr) { FILE *fp; char buf[512] = { 0 }; @@ -206,7 +206,7 @@ void DoShortCountTest(WCHAR *formatstr, int param, char *checkstr) } -void DoCharTest(WCHAR *formatstr, char param, char *checkstr) +void DoCharTest(const WCHAR *formatstr, char param, const char *checkstr) { FILE *fp; char buf[256] = { 0 }; @@ -237,7 +237,7 @@ void DoCharTest(WCHAR *formatstr, char param, char *checkstr) fclose(fp); } -void DoWCharTest(WCHAR *formatstr, WCHAR param, char *checkstr) +void DoWCharTest(const WCHAR *formatstr, WCHAR param, const char *checkstr) { FILE *fp; char buf[256] = { 0 }; @@ -268,7 +268,7 @@ void DoWCharTest(WCHAR *formatstr, WCHAR param, char *checkstr) fclose(fp); } -void DoNumTest(WCHAR *formatstr, int value, char *checkstr) +void DoNumTest(const WCHAR *formatstr, int value, const char *checkstr) { FILE *fp; char buf[256] = { 0 }; @@ -299,8 +299,8 @@ void DoNumTest(WCHAR *formatstr, int value, char *checkstr) fclose(fp); } -void DoI64Test(WCHAR *formatstr, INT64 value, char *valuestr, char *checkstr1, - char *checkstr2) +void DoI64Test(const WCHAR *formatstr, INT64 value, char *valuestr, const char *checkstr1, + const char *checkstr2) { FILE *fp; char buf[256] = { 0 }; @@ -332,8 +332,8 @@ void DoI64Test(WCHAR *formatstr, INT64 value, char *valuestr, char *checkstr1, fclose(fp); } -void DoDoubleTest(WCHAR *formatstr, double value, char *checkstr1, - char *checkstr2) +void DoDoubleTest(const WCHAR *formatstr, double value, const char *checkstr1, + const char *checkstr2) { FILE *fp; char buf[256] = { 0 }; @@ -367,8 +367,8 @@ void DoDoubleTest(WCHAR *formatstr, double value, char *checkstr1, } -void DoArgumentPrecTest(WCHAR *formatstr, int precision, void *param, - char *paramstr, char *checkstr1, char *checkstr2) +void DoArgumentPrecTest(const WCHAR *formatstr, int precision, void *param, + char *paramstr, const char *checkstr1, const char *checkstr2) { FILE *fp; char buf[256]; @@ -409,8 +409,8 @@ void DoArgumentPrecTest(WCHAR *formatstr, int precision, void *param, } -void DoArgumentPrecDoubleTest(WCHAR *formatstr, int precision, double param, - char *checkstr1, char *checkstr2) +void DoArgumentPrecDoubleTest(const WCHAR *formatstr, int precision, double param, + const char *checkstr1, const char *checkstr2) { FILE *fp; char buf[256]; diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test1/CMakeLists.txt index ce4271edb2..519860b877 100644 --- a/src/pal/tests/palsuite/c_runtime/fwprintf/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_fwprintf_test1 diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test1/test1.cpp index 8a171db52a..8a171db52a 100644 --- a/src/pal/tests/palsuite/c_runtime/fwprintf/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test10/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test10/CMakeLists.txt index a8323b4fc7..e604e03dff 100644 --- a/src/pal/tests/palsuite/c_runtime/fwprintf/test10/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test10/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test10.c + test10.cpp ) add_executable(paltest_fwprintf_test10 diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test10/test10.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test10/test10.cpp index 3aa2c45c7c..3aa2c45c7c 100644 --- a/src/pal/tests/palsuite/c_runtime/fwprintf/test10/test10.c +++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test10/test10.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test11/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test11/CMakeLists.txt index 1b7987400a..18be522823 100644 --- a/src/pal/tests/palsuite/c_runtime/fwprintf/test11/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test11/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test11.c + test11.cpp ) add_executable(paltest_fwprintf_test11 diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test11/test11.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test11/test11.cpp index 5867cd64fb..5867cd64fb 100644 --- a/src/pal/tests/palsuite/c_runtime/fwprintf/test11/test11.c +++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test11/test11.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test12/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test12/CMakeLists.txt index 1e43a4c906..6ea739b28f 100644 --- a/src/pal/tests/palsuite/c_runtime/fwprintf/test12/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test12/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test12.c + test12.cpp ) add_executable(paltest_fwprintf_test12 diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test12/test12.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test12/test12.cpp index 48a6123423..48a6123423 100644 --- a/src/pal/tests/palsuite/c_runtime/fwprintf/test12/test12.c +++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test12/test12.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test13/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test13/CMakeLists.txt index c84dc3ea41..8505ccbd82 100644 --- a/src/pal/tests/palsuite/c_runtime/fwprintf/test13/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test13/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test13.c + test13.cpp ) add_executable(paltest_fwprintf_test13 diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test13/test13.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test13/test13.cpp index 6eabec6c77..6eabec6c77 100644 --- a/src/pal/tests/palsuite/c_runtime/fwprintf/test13/test13.c +++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test13/test13.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test14/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test14/CMakeLists.txt index 97824c76b7..548e60fdb8 100644 --- a/src/pal/tests/palsuite/c_runtime/fwprintf/test14/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test14/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test14.c + test14.cpp ) add_executable(paltest_fwprintf_test14 diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test14/test14.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test14/test14.cpp index 001cf72689..001cf72689 100644 --- a/src/pal/tests/palsuite/c_runtime/fwprintf/test14/test14.c +++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test14/test14.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test15/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test15/CMakeLists.txt index 6786c5b774..c5b53461a7 100644 --- a/src/pal/tests/palsuite/c_runtime/fwprintf/test15/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test15/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test15.c + test15.cpp ) add_executable(paltest_fwprintf_test15 diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test15/test15.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test15/test15.cpp index 9dfe82eccc..9dfe82eccc 100644 --- a/src/pal/tests/palsuite/c_runtime/fwprintf/test15/test15.c +++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test15/test15.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test16/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test16/CMakeLists.txt index be14870863..51af0a0d60 100644 --- a/src/pal/tests/palsuite/c_runtime/fwprintf/test16/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test16/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test16.c + test16.cpp ) add_executable(paltest_fwprintf_test16 diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test16/test16.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test16/test16.cpp index 1969be1824..1969be1824 100644 --- a/src/pal/tests/palsuite/c_runtime/fwprintf/test16/test16.c +++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test16/test16.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test17/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test17/CMakeLists.txt index b390d15620..9ed8a390e7 100644 --- a/src/pal/tests/palsuite/c_runtime/fwprintf/test17/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test17/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test17.c + test17.cpp ) add_executable(paltest_fwprintf_test17 diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test17/test17.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test17/test17.cpp index 66b12716d0..66b12716d0 100644 --- a/src/pal/tests/palsuite/c_runtime/fwprintf/test17/test17.c +++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test17/test17.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test18/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test18/CMakeLists.txt index 6f6d79bce5..3e3ba4efc7 100644 --- a/src/pal/tests/palsuite/c_runtime/fwprintf/test18/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test18/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test18.c + test18.cpp ) add_executable(paltest_fwprintf_test18 diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test18/test18.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test18/test18.cpp index a33dea39b3..a33dea39b3 100644 --- a/src/pal/tests/palsuite/c_runtime/fwprintf/test18/test18.c +++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test18/test18.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test19/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test19/CMakeLists.txt index bc10825ce1..fbb7370ba3 100644 --- a/src/pal/tests/palsuite/c_runtime/fwprintf/test19/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test19/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test19.c + test19.cpp ) add_executable(paltest_fwprintf_test19 diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test19/test19.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test19/test19.c deleted file mode 100644 index 4600de7fa9..0000000000 --- a/src/pal/tests/palsuite/c_runtime/fwprintf/test19/test19.c +++ /dev/null @@ -1,81 +0,0 @@ -// 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: test19.c -** -** Purpose: Tests the variable length precision argument. -** This test is modeled after the sprintf series. -** -** -**==========================================================================*/ - -#include <palsuite.h> -#include "../fwprintf.h" - -/* - * Depends on memcmp, strlen, fopen, fseek and fgets. - */ - - - -int __cdecl main(int argc, char *argv[]) -{ - int n = -1; - - if (PAL_Initialize(argc, argv) != 0) - { - return(FAIL); - } - - DoArgumentPrecTest(convert("%.*s"), 2, convert("bar"), "bar", "ba", "ba"); - DoArgumentPrecTest(convert("%.*S"), 2, "bar", "bar", "ba", "ba"); - DoArgumentPrecTest(convert("foo %.*n"), 3, &n, "pointer to int", "foo ", - "foo "); - if (n != 4) - { - Fail("ERROR: Expected count parameter to resolve to %d, got %X\n", - 4, n); - } - - DoArgumentPrecTest(convert("%.*c"), 0, (void*)'a', "a", "a", "a"); - DoArgumentPrecTest(convert("%.*c"), 4, (void*)'a', "a", "a", "a"); - DoArgumentPrecTest(convert("%.*C"), 0, (void*)'a', "a", "a", "a"); - DoArgumentPrecTest(convert("%.*C"), 4, (void*)'a', "a", "a", "a"); - DoArgumentPrecTest(convert("%.*d"), 1, (void*)42, "42", "42", "42"); - DoArgumentPrecTest(convert("%.*d"), 3, (void*)42, "42", "042", "042"); - DoArgumentPrecTest(convert("%.*i"), 1, (void*)42, "42", "42", "42"); - DoArgumentPrecTest(convert("%.*i"), 3, (void*)42, "42", "042", "042"); - DoArgumentPrecTest(convert("%.*o"), 1, (void*)42, "42", "52", "52"); - DoArgumentPrecTest(convert("%.*o"), 3, (void*)42, "42", "052", "052"); - DoArgumentPrecTest(convert("%.*u"), 1, (void*)42, "42", "42", "42"); - DoArgumentPrecTest(convert("%.*u"), 3, (void*)42, "42", "042", "042"); - DoArgumentPrecTest(convert("%.*x"), 1, (void*)0x42, "0x42", "42", "42"); - DoArgumentPrecTest(convert("%.*x"), 3, (void*)0x42, "0x42", "042", "042"); - DoArgumentPrecTest(convert("%.*X"), 1, (void*)0x42, "0x42", "42", "42"); - DoArgumentPrecTest(convert("%.*X"), 3, (void*)0x42, "0x42", "042", "042"); - - - DoArgumentPrecDoubleTest(convert("%.*e"), 1, 2.01, "2.0e+000", "2.0e+00"); - DoArgumentPrecDoubleTest(convert("%.*e"), 3, 2.01, "2.010e+000", - "2.010e+00"); - DoArgumentPrecDoubleTest(convert("%.*E"), 1, 2.01, "2.0E+000", "2.0E+00"); - DoArgumentPrecDoubleTest(convert("%.*E"), 3, 2.01, "2.010E+000", - "2.010E+00"); - DoArgumentPrecDoubleTest(convert("%.*f"), 1, 2.01, "2.0", "2.0"); - DoArgumentPrecDoubleTest(convert("%.*f"), 3, 2.01, "2.010", "2.010"); - DoArgumentPrecDoubleTest(convert("%.*g"), 1, 256.01, "3e+002", "3e+02"); - DoArgumentPrecDoubleTest(convert("%.*g"), 3, 256.01, "256", "256"); - DoArgumentPrecDoubleTest(convert("%.*g"), 4, 256.01, "256", "256"); - DoArgumentPrecDoubleTest(convert("%.*g"), 6, 256.01, "256.01", "256.01"); - DoArgumentPrecDoubleTest(convert("%.*G"), 1, 256.01, "3E+002", "3E+02"); - DoArgumentPrecDoubleTest(convert("%.*G"), 3, 256.01, "256", "256"); - DoArgumentPrecDoubleTest(convert("%.*G"), 4, 256.01, "256", "256"); - DoArgumentPrecDoubleTest(convert("%.*G"), 6, 256.01, "256.01", "256.01"); - - PAL_Terminate(); - - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test19/test19.cpp b/src/pal/tests/palsuite/c_runtime/fwprintf/test19/test19.cpp new file mode 100644 index 0000000000..a407c9f4bd --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test19/test19.cpp @@ -0,0 +1,81 @@ +// 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: test19.c +** +** Purpose: Tests the variable length precision argument. +** This test is modeled after the sprintf series. +** +** +**==========================================================================*/ + +#include <palsuite.h> +#include "../fwprintf.h" + +/* + * Depends on memcmp, strlen, fopen, fseek and fgets. + */ + + + +int __cdecl main(int argc, char *argv[]) +{ + int n = -1; + + if (PAL_Initialize(argc, argv) != 0) + { + return(FAIL); + } + + DoArgumentPrecTest(convert("%.*s"), 2, (void*)convert("bar"), "bar", "ba", "ba"); + DoArgumentPrecTest(convert("%.*S"), 2, (void*)"bar", "bar", "ba", "ba"); + DoArgumentPrecTest(convert("foo %.*n"), 3, (void*)&n, "pointer to int", "foo ", + "foo "); + if (n != 4) + { + Fail("ERROR: Expected count parameter to resolve to %d, got %X\n", + 4, n); + } + + DoArgumentPrecTest(convert("%.*c"), 0, (void*)'a', "a", "a", "a"); + DoArgumentPrecTest(convert("%.*c"), 4, (void*)'a', "a", "a", "a"); + DoArgumentPrecTest(convert("%.*C"), 0, (void*)'a', "a", "a", "a"); + DoArgumentPrecTest(convert("%.*C"), 4, (void*)'a', "a", "a", "a"); + DoArgumentPrecTest(convert("%.*d"), 1, (void*)42, "42", "42", "42"); + DoArgumentPrecTest(convert("%.*d"), 3, (void*)42, "42", "042", "042"); + DoArgumentPrecTest(convert("%.*i"), 1, (void*)42, "42", "42", "42"); + DoArgumentPrecTest(convert("%.*i"), 3, (void*)42, "42", "042", "042"); + DoArgumentPrecTest(convert("%.*o"), 1, (void*)42, "42", "52", "52"); + DoArgumentPrecTest(convert("%.*o"), 3, (void*)42, "42", "052", "052"); + DoArgumentPrecTest(convert("%.*u"), 1, (void*)42, "42", "42", "42"); + DoArgumentPrecTest(convert("%.*u"), 3, (void*)42, "42", "042", "042"); + DoArgumentPrecTest(convert("%.*x"), 1, (void*)0x42, "0x42", "42", "42"); + DoArgumentPrecTest(convert("%.*x"), 3, (void*)0x42, "0x42", "042", "042"); + DoArgumentPrecTest(convert("%.*X"), 1, (void*)0x42, "0x42", "42", "42"); + DoArgumentPrecTest(convert("%.*X"), 3, (void*)0x42, "0x42", "042", "042"); + + + DoArgumentPrecDoubleTest(convert("%.*e"), 1, 2.01, "2.0e+000", "2.0e+00"); + DoArgumentPrecDoubleTest(convert("%.*e"), 3, 2.01, "2.010e+000", + "2.010e+00"); + DoArgumentPrecDoubleTest(convert("%.*E"), 1, 2.01, "2.0E+000", "2.0E+00"); + DoArgumentPrecDoubleTest(convert("%.*E"), 3, 2.01, "2.010E+000", + "2.010E+00"); + DoArgumentPrecDoubleTest(convert("%.*f"), 1, 2.01, "2.0", "2.0"); + DoArgumentPrecDoubleTest(convert("%.*f"), 3, 2.01, "2.010", "2.010"); + DoArgumentPrecDoubleTest(convert("%.*g"), 1, 256.01, "3e+002", "3e+02"); + DoArgumentPrecDoubleTest(convert("%.*g"), 3, 256.01, "256", "256"); + DoArgumentPrecDoubleTest(convert("%.*g"), 4, 256.01, "256", "256"); + DoArgumentPrecDoubleTest(convert("%.*g"), 6, 256.01, "256.01", "256.01"); + DoArgumentPrecDoubleTest(convert("%.*G"), 1, 256.01, "3E+002", "3E+02"); + DoArgumentPrecDoubleTest(convert("%.*G"), 3, 256.01, "256", "256"); + DoArgumentPrecDoubleTest(convert("%.*G"), 4, 256.01, "256", "256"); + DoArgumentPrecDoubleTest(convert("%.*G"), 6, 256.01, "256.01", "256.01"); + + PAL_Terminate(); + + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test2/CMakeLists.txt index 64314651c0..e65a396862 100644 --- a/src/pal/tests/palsuite/c_runtime/fwprintf/test2/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test2/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test2.c + test2.cpp ) add_executable(paltest_fwprintf_test2 diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test2/test2.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test2/test2.cpp index ecd3c513df..ecd3c513df 100644 --- a/src/pal/tests/palsuite/c_runtime/fwprintf/test2/test2.c +++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test2/test2.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test3/CMakeLists.txt index 6906722cde..53c46369de 100644 --- a/src/pal/tests/palsuite/c_runtime/fwprintf/test3/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test3/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test3.c + test3.cpp ) add_executable(paltest_fwprintf_test3 diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test3/test3.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test3/test3.cpp index d718a19067..d718a19067 100644 --- a/src/pal/tests/palsuite/c_runtime/fwprintf/test3/test3.c +++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test3/test3.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test4/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test4/CMakeLists.txt index b91bc87195..9dbb46283e 100644 --- a/src/pal/tests/palsuite/c_runtime/fwprintf/test4/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test4/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test4.c + test4.cpp ) add_executable(paltest_fwprintf_test4 diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test4/test4.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test4/test4.cpp index 96fb472c3e..96fb472c3e 100644 --- a/src/pal/tests/palsuite/c_runtime/fwprintf/test4/test4.c +++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test4/test4.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test5/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test5/CMakeLists.txt index 53bf482b6f..4e72e3ca88 100644 --- a/src/pal/tests/palsuite/c_runtime/fwprintf/test5/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test5/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test5.c + test5.cpp ) add_executable(paltest_fwprintf_test5 diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test5/test5.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test5/test5.cpp index 9d95989090..9d95989090 100644 --- a/src/pal/tests/palsuite/c_runtime/fwprintf/test5/test5.c +++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test5/test5.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test6/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test6/CMakeLists.txt index bf7d7cccb8..d57f07fafa 100644 --- a/src/pal/tests/palsuite/c_runtime/fwprintf/test6/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test6/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test6.c + test6.cpp ) add_executable(paltest_fwprintf_test6 diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test6/test6.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test6/test6.cpp index 160ff524e0..160ff524e0 100644 --- a/src/pal/tests/palsuite/c_runtime/fwprintf/test6/test6.c +++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test6/test6.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test7/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test7/CMakeLists.txt index 68bcc9ca65..314ca353e5 100644 --- a/src/pal/tests/palsuite/c_runtime/fwprintf/test7/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test7/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test7.c + test7.cpp ) add_executable(paltest_fwprintf_test7 diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test7/test7.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test7/test7.cpp index c5515a8640..c5515a8640 100644 --- a/src/pal/tests/palsuite/c_runtime/fwprintf/test7/test7.c +++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test7/test7.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test8/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test8/CMakeLists.txt index e07cbb9119..e818df2eb2 100644 --- a/src/pal/tests/palsuite/c_runtime/fwprintf/test8/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test8/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test8.c + test8.cpp ) add_executable(paltest_fwprintf_test8 diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test8/test8.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test8/test8.cpp index efc81a954a..efc81a954a 100644 --- a/src/pal/tests/palsuite/c_runtime/fwprintf/test8/test8.c +++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test8/test8.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test9/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test9/CMakeLists.txt index 898da1a64f..28b6b86921 100644 --- a/src/pal/tests/palsuite/c_runtime/fwprintf/test9/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test9/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test9.c + test9.cpp ) add_executable(paltest_fwprintf_test9 diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test9/test9.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test9/test9.cpp index 23db2d8971..23db2d8971 100644 --- a/src/pal/tests/palsuite/c_runtime/fwprintf/test9/test9.c +++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test9/test9.cpp diff --git a/src/pal/tests/palsuite/c_runtime/fwrite/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwrite/test1/CMakeLists.txt index 701e56acb5..5c8b7449f2 100644 --- a/src/pal/tests/palsuite/c_runtime/fwrite/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/fwrite/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_fwrite_test1 diff --git a/src/pal/tests/palsuite/c_runtime/fwrite/test1/test1.c b/src/pal/tests/palsuite/c_runtime/fwrite/test1/test1.cpp index 392522879f..392522879f 100644 --- a/src/pal/tests/palsuite/c_runtime/fwrite/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/fwrite/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/getc/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/getc/test1/CMakeLists.txt index 2a29e8af0a..68ecaa9abb 100644 --- a/src/pal/tests/palsuite/c_runtime/getc/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/getc/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - getc.c + getc.cpp ) add_executable(paltest_getc_test1 diff --git a/src/pal/tests/palsuite/c_runtime/getc/test1/getc.c b/src/pal/tests/palsuite/c_runtime/getc/test1/getc.cpp index dfe10d6160..dfe10d6160 100644 --- a/src/pal/tests/palsuite/c_runtime/getc/test1/getc.c +++ b/src/pal/tests/palsuite/c_runtime/getc/test1/getc.cpp diff --git a/src/pal/tests/palsuite/c_runtime/getenv/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/getenv/test1/CMakeLists.txt index 6243c032ab..9c52c2890e 100644 --- a/src/pal/tests/palsuite/c_runtime/getenv/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/getenv/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_getenv_test1 diff --git a/src/pal/tests/palsuite/c_runtime/getenv/test1/test1.c b/src/pal/tests/palsuite/c_runtime/getenv/test1/test1.cpp index 0fb9025c8f..0fb9025c8f 100644 --- a/src/pal/tests/palsuite/c_runtime/getenv/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/getenv/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/getenv/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/getenv/test2/CMakeLists.txt index 7a301a5ca6..971a836239 100644 --- a/src/pal/tests/palsuite/c_runtime/getenv/test2/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/getenv/test2/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test2.c + test2.cpp ) add_executable(paltest_getenv_test2 diff --git a/src/pal/tests/palsuite/c_runtime/getenv/test2/test2.c b/src/pal/tests/palsuite/c_runtime/getenv/test2/test2.cpp index 26f245fcce..26f245fcce 100644 --- a/src/pal/tests/palsuite/c_runtime/getenv/test2/test2.c +++ b/src/pal/tests/palsuite/c_runtime/getenv/test2/test2.cpp diff --git a/src/pal/tests/palsuite/c_runtime/getenv/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/getenv/test3/CMakeLists.txt index 2cbe472221..620ccd1003 100644 --- a/src/pal/tests/palsuite/c_runtime/getenv/test3/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/getenv/test3/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test3.c + test3.cpp ) add_executable(paltest_getenv_test3 diff --git a/src/pal/tests/palsuite/c_runtime/getenv/test3/test3.c b/src/pal/tests/palsuite/c_runtime/getenv/test3/test3.cpp index 1eefd9d40c..1eefd9d40c 100644 --- a/src/pal/tests/palsuite/c_runtime/getenv/test3/test3.c +++ b/src/pal/tests/palsuite/c_runtime/getenv/test3/test3.cpp diff --git a/src/pal/tests/palsuite/c_runtime/isalnum/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/isalnum/test1/CMakeLists.txt index 3879bb7902..af65f32cbf 100644 --- a/src/pal/tests/palsuite/c_runtime/isalnum/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/isalnum/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_isalnum_test1 diff --git a/src/pal/tests/palsuite/c_runtime/isalnum/test1/test1.c b/src/pal/tests/palsuite/c_runtime/isalnum/test1/test1.cpp index d9cdfcadf6..d9cdfcadf6 100644 --- a/src/pal/tests/palsuite/c_runtime/isalnum/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/isalnum/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/isalpha/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/isalpha/test1/CMakeLists.txt index 44fb72d7fe..82f19ad383 100644 --- a/src/pal/tests/palsuite/c_runtime/isalpha/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/isalpha/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_isalpha_test1 diff --git a/src/pal/tests/palsuite/c_runtime/isalpha/test1/test1.c b/src/pal/tests/palsuite/c_runtime/isalpha/test1/test1.cpp index b494d14a92..b494d14a92 100644 --- a/src/pal/tests/palsuite/c_runtime/isalpha/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/isalpha/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/isdigit/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/isdigit/test1/CMakeLists.txt index dd03b238e1..b96b7aa706 100644 --- a/src/pal/tests/palsuite/c_runtime/isdigit/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/isdigit/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_isdigit_test1 diff --git a/src/pal/tests/palsuite/c_runtime/isdigit/test1/test1.c b/src/pal/tests/palsuite/c_runtime/isdigit/test1/test1.cpp index ad2344827f..ad2344827f 100644 --- a/src/pal/tests/palsuite/c_runtime/isdigit/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/isdigit/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/islower/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/islower/test1/CMakeLists.txt index b7f5ad069f..d071d4bb65 100644 --- a/src/pal/tests/palsuite/c_runtime/islower/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/islower/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_islower_test1 diff --git a/src/pal/tests/palsuite/c_runtime/islower/test1/test1.c b/src/pal/tests/palsuite/c_runtime/islower/test1/test1.cpp index c8e877b705..c8e877b705 100644 --- a/src/pal/tests/palsuite/c_runtime/islower/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/islower/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/isprint/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/isprint/test1/CMakeLists.txt index 365777ab5a..91410a02ab 100644 --- a/src/pal/tests/palsuite/c_runtime/isprint/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/isprint/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - isprint.c + isprint.cpp ) add_executable(paltest_isprint_test1 diff --git a/src/pal/tests/palsuite/c_runtime/isprint/test1/isprint.c b/src/pal/tests/palsuite/c_runtime/isprint/test1/isprint.cpp index 54db666bf2..54db666bf2 100644 --- a/src/pal/tests/palsuite/c_runtime/isprint/test1/isprint.c +++ b/src/pal/tests/palsuite/c_runtime/isprint/test1/isprint.cpp diff --git a/src/pal/tests/palsuite/c_runtime/isprint/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/isprint/test2/CMakeLists.txt index a7ad75cc04..53ad94273c 100644 --- a/src/pal/tests/palsuite/c_runtime/isprint/test2/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/isprint/test2/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test2.c + test2.cpp ) add_executable(paltest_isprint_test2 diff --git a/src/pal/tests/palsuite/c_runtime/isprint/test2/test2.c b/src/pal/tests/palsuite/c_runtime/isprint/test2/test2.cpp index 2170c47a14..2170c47a14 100644 --- a/src/pal/tests/palsuite/c_runtime/isprint/test2/test2.c +++ b/src/pal/tests/palsuite/c_runtime/isprint/test2/test2.cpp diff --git a/src/pal/tests/palsuite/c_runtime/isspace/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/isspace/test1/CMakeLists.txt index 34ad70d328..c3cc525145 100644 --- a/src/pal/tests/palsuite/c_runtime/isspace/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/isspace/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_isspace_test1 diff --git a/src/pal/tests/palsuite/c_runtime/isspace/test1/test1.c b/src/pal/tests/palsuite/c_runtime/isspace/test1/test1.cpp index 6cd1ce878b..6cd1ce878b 100644 --- a/src/pal/tests/palsuite/c_runtime/isspace/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/isspace/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/isupper/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/isupper/test1/CMakeLists.txt index c7fc71c43b..e1cfa6609d 100644 --- a/src/pal/tests/palsuite/c_runtime/isupper/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/isupper/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_isupper_test1 diff --git a/src/pal/tests/palsuite/c_runtime/isupper/test1/test1.c b/src/pal/tests/palsuite/c_runtime/isupper/test1/test1.cpp index b88bcc4a7e..b88bcc4a7e 100644 --- a/src/pal/tests/palsuite/c_runtime/isupper/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/isupper/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/iswdigit/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/iswdigit/test1/CMakeLists.txt index b35dd5ed6d..4074abbe76 100644 --- a/src/pal/tests/palsuite/c_runtime/iswdigit/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/iswdigit/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_iswdigit_test1 diff --git a/src/pal/tests/palsuite/c_runtime/iswdigit/test1/test1.c b/src/pal/tests/palsuite/c_runtime/iswdigit/test1/test1.cpp index 1cf94c5d13..1cf94c5d13 100644 --- a/src/pal/tests/palsuite/c_runtime/iswdigit/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/iswdigit/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/iswprint/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/iswprint/test1/CMakeLists.txt index 5e436c3ca2..d21c232133 100644 --- a/src/pal/tests/palsuite/c_runtime/iswprint/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/iswprint/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_iswprint_test1 diff --git a/src/pal/tests/palsuite/c_runtime/iswprint/test1/test1.c b/src/pal/tests/palsuite/c_runtime/iswprint/test1/test1.cpp index 08a985b2d6..08a985b2d6 100644 --- a/src/pal/tests/palsuite/c_runtime/iswprint/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/iswprint/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/iswspace/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/iswspace/test1/CMakeLists.txt index 1368e55ccc..1f9a54fb17 100644 --- a/src/pal/tests/palsuite/c_runtime/iswspace/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/iswspace/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_iswspace_test1 diff --git a/src/pal/tests/palsuite/c_runtime/iswspace/test1/test1.c b/src/pal/tests/palsuite/c_runtime/iswspace/test1/test1.cpp index c58997812e..c58997812e 100644 --- a/src/pal/tests/palsuite/c_runtime/iswspace/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/iswspace/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/iswupper/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/iswupper/test1/CMakeLists.txt index 8b8fae6d72..1da5fbaa75 100644 --- a/src/pal/tests/palsuite/c_runtime/iswupper/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/iswupper/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_iswupper_test1 diff --git a/src/pal/tests/palsuite/c_runtime/iswupper/test1/test1.c b/src/pal/tests/palsuite/c_runtime/iswupper/test1/test1.cpp index a01686be44..a01686be44 100644 --- a/src/pal/tests/palsuite/c_runtime/iswupper/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/iswupper/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/iswxdigit/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/iswxdigit/test1/CMakeLists.txt index 3a726eced9..ae55976128 100644 --- a/src/pal/tests/palsuite/c_runtime/iswxdigit/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/iswxdigit/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_iswxdigit_test1 diff --git a/src/pal/tests/palsuite/c_runtime/iswxdigit/test1/test1.c b/src/pal/tests/palsuite/c_runtime/iswxdigit/test1/test1.cpp index 73ad495856..73ad495856 100644 --- a/src/pal/tests/palsuite/c_runtime/iswxdigit/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/iswxdigit/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/isxdigit/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/isxdigit/test1/CMakeLists.txt index 8919b36e42..4fd46c93d8 100644 --- a/src/pal/tests/palsuite/c_runtime/isxdigit/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/isxdigit/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_isxdigit_test1 diff --git a/src/pal/tests/palsuite/c_runtime/isxdigit/test1/test1.c b/src/pal/tests/palsuite/c_runtime/isxdigit/test1/test1.cpp index be25af233c..be25af233c 100644 --- a/src/pal/tests/palsuite/c_runtime/isxdigit/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/isxdigit/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/labs/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/labs/test1/CMakeLists.txt index cf0f0999a9..2ffb3cd641 100644 --- a/src/pal/tests/palsuite/c_runtime/labs/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/labs/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_labs_test1 diff --git a/src/pal/tests/palsuite/c_runtime/labs/test1/test1.c b/src/pal/tests/palsuite/c_runtime/labs/test1/test1.cpp index 41f85226e1..41f85226e1 100644 --- a/src/pal/tests/palsuite/c_runtime/labs/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/labs/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/llabs/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/llabs/test1/CMakeLists.txt index 8f5bdbe097..3adc3cc737 100644 --- a/src/pal/tests/palsuite/c_runtime/llabs/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/llabs/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_llabs_test1 diff --git a/src/pal/tests/palsuite/c_runtime/llabs/test1/test1.c b/src/pal/tests/palsuite/c_runtime/llabs/test1/test1.cpp index 044e22f134..044e22f134 100644 --- a/src/pal/tests/palsuite/c_runtime/llabs/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/llabs/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/localtime/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/localtime/test1/CMakeLists.txt index 25acf48749..698699f821 100644 --- a/src/pal/tests/palsuite/c_runtime/localtime/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/localtime/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_localtime_test1 diff --git a/src/pal/tests/palsuite/c_runtime/localtime/test1/test1.c b/src/pal/tests/palsuite/c_runtime/localtime/test1/test1.cpp index a993a17f69..a993a17f69 100644 --- a/src/pal/tests/palsuite/c_runtime/localtime/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/localtime/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/log/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/log/test1/CMakeLists.txt index dd19002904..c8f991b997 100644 --- a/src/pal/tests/palsuite/c_runtime/log/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/log/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_log_test1 diff --git a/src/pal/tests/palsuite/c_runtime/log/test1/test1.c b/src/pal/tests/palsuite/c_runtime/log/test1/test1.cpp index eea592dd45..eea592dd45 100644 --- a/src/pal/tests/palsuite/c_runtime/log/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/log/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/log10/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/log10/test1/CMakeLists.txt index 31e750df3e..31025fbd04 100644 --- a/src/pal/tests/palsuite/c_runtime/log10/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/log10/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_log10_test1 diff --git a/src/pal/tests/palsuite/c_runtime/log10/test1/test1.c b/src/pal/tests/palsuite/c_runtime/log10/test1/test1.cpp index 13711a752e..13711a752e 100644 --- a/src/pal/tests/palsuite/c_runtime/log10/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/log10/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/log10f/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/log10f/CMakeLists.txt new file mode 100644 index 0000000000..5e1ef7f28b --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/log10f/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +add_subdirectory(test1) diff --git a/src/pal/tests/palsuite/c_runtime/log10f/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/log10f/test1/CMakeLists.txt new file mode 100644 index 0000000000..b2c0835451 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/log10f/test1/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test1.c +) + +add_executable(paltest_log10f_test1 + ${SOURCES} +) + +add_dependencies(paltest_log10f_test1 coreclrpal) + +target_link_libraries(paltest_log10f_test1 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/log10f/test1/test1.c b/src/pal/tests/palsuite/c_runtime/log10f/test1/test1.c new file mode 100644 index 0000000000..e7c8c2f28b --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/log10f/test1/test1.c @@ -0,0 +1,144 @@ +// 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: test1.c +** +** Purpose: Test to ensure that log10f returns correct values. +** +** Dependencies: PAL_Initialize +** PAL_Terminate +** Fail +** fabs +** _isnanf +** +**===========================================================================*/ + +#include <palsuite.h> + +// binary32 (float) has a machine epsilon of 2^-23 (approx. 1.19e-07). However, this +// is slightly too accurate when writing tests meant to run against libm implementations +// for various platforms. 2^-21 (approx. 4.76e-07) seems to be as accurate as we can get. +// +// The tests themselves will take PAL_EPSILON and adjust it according to the expected result +// so that the delta used for comparison will compare the most significant digits and ignore +// any digits that are outside the double precision range (6-9 digits). + +// For example, a test with an expect result in the format of 0.xxxxxxxxx will use PAL_EPSILON +// for the variance, while an expected result in the format of 0.0xxxxxxxxx will use +// PAL_EPSILON / 10 and and expected result in the format of x.xxxxxx will use PAL_EPSILON * 10. +#define PAL_EPSILON 4.76837158e-07 + +#define PAL_NAN sqrtf(-1.0f) +#define PAL_POSINF -logf(0.0f) +#define PAL_NEGINF logf(0.0f) + +/** + * Helper test structure + */ +struct test +{ + float value; /* value to test the function with */ + float expected; /* expected result */ + float variance; /* maximum delta between the expected and actual result */ +}; + +/** + * validate + * + * test validation function + */ +void __cdecl validate(float value, float expected, float variance) +{ + float result = log10f(value); + + /* + * The test is valid when the difference between result + * and expected is less than or equal to variance + */ + float delta = fabsf(result - expected); + + if (delta > variance) + { + Fail("log10f(%g) returned %10.9g when it should have returned %10.9g", + value, result, expected); + } +} + +/** + * validate + * + * test validation function for values returning NaN + */ +void __cdecl validate_isnan(float value) +{ + float result = log10f(value); + + if (!_isnanf(result)) + { + Fail("log10f(%g) returned %10.9g when it should have returned %10.9g", + value, result, PAL_NAN); + } +} + +/** + * main + * + * executable entry point + */ +int __cdecl main(int argc, char **argv) +{ + struct test tests[] = + { + /* value expected variance */ + { 0, PAL_NEGINF, 0 }, + { 0.000721784159f, -3.14159265f, PAL_EPSILON * 10 }, // expected: -(pi) + { 0.00191301410f, -2.71828183f, PAL_EPSILON * 10 }, // expected: -(e) + { 0.00498212830f, -2.30258509f, PAL_EPSILON * 10 }, // expected: -(ln(10)) + { 0.0268660410f, -1.57079633f, PAL_EPSILON * 10 }, // expected: -(pi / 2) + { 0.0360831928f, -1.44269504f, PAL_EPSILON * 10 }, // expected: -(logf2(e)) + { 0.0385288847f, -1.41421356f, PAL_EPSILON * 10 }, // expected: -(sqrtf(2)) + { 0.0744082059f, -1.12837917f, PAL_EPSILON * 10 }, // expected: -(2 / sqrtf(pi)) + { 0.1f, -1, PAL_EPSILON * 10 }, // expected: -(1) + { 0.163908636f, -0.785398163f, PAL_EPSILON }, // expected: -(pi / 4) + { 0.196287760f, -0.707106781f, PAL_EPSILON }, // expected: -(1 / sqrtf(2)) + { 0.202699566f, -0.693147181f, PAL_EPSILON }, // expected: -(ln(2)) + { 0.230876765f, -0.636619772f, PAL_EPSILON }, // expected: -(2 / pi) + { 0.367879441f, -0.434294482f, PAL_EPSILON }, // expected: -(log10f(e)) + { 0.480496373f, -0.318309886f, PAL_EPSILON }, // expected: -(1 / pi) + { 1, 0, PAL_EPSILON }, + { 2.08118116f, 0.318309886f, PAL_EPSILON }, // expected: 1 / pi + { 2.71828183f, 0.434294482f, PAL_EPSILON }, // expected: log10f(e) value: e + { 4.33131503f, 0.636619772f, PAL_EPSILON }, // expected: 2 / pi + { 4.93340967f, 0.693147181f, PAL_EPSILON }, // expected: ln(2) + { 5.09456117f, 0.707106781f, PAL_EPSILON }, // expected: 1 / sqrtf(2) + { 6.10095980f, 0.785398163f, PAL_EPSILON }, // expected: pi / 4 + { 10, 1, PAL_EPSILON * 10 }, + { 13.4393779f, 1.12837917f, PAL_EPSILON * 10 }, // expected: 2 / sqrtf(pi) + { 25.9545535f, 1.41421356f, PAL_EPSILON * 10 }, // expected: sqrtf(2) + { 27.7137338f, 1.44269504f, PAL_EPSILON * 10 }, // expected: logf2(e) + { 37.2217105f, 1.57079633f, PAL_EPSILON * 10 }, // expected: pi / 2 + { 200.717432f, 2.30258509f, PAL_EPSILON * 10 }, // expected: ln(10) + { 522.735300f, 2.71828183f, PAL_EPSILON * 10 }, // expected: e + { 1385.45573f, 3.14159265f, PAL_EPSILON * 10 }, // expected: pi + { PAL_POSINF, PAL_POSINF, 0 }, + }; + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) + { + validate(tests[i].value, tests[i].expected, tests[i].variance); + } + + validate_isnan(PAL_NEGINF); + validate_isnan(PAL_NAN); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/log10f/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/log10f/test1/testinfo.dat new file mode 100644 index 0000000000..175ee3ab09 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/log10f/test1/testinfo.dat @@ -0,0 +1,17 @@ +# 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 = log10f +Name = Positive Test for log10f +TYPE = DEFAULT +EXE1 = test1 +Description += Passes a series of values to the log10f() function, += checking each for the expected result. Also checks += for proper handling of out-of-range values. + + + diff --git a/src/pal/tests/palsuite/c_runtime/logf/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/logf/CMakeLists.txt new file mode 100644 index 0000000000..5e1ef7f28b --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/logf/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +add_subdirectory(test1) diff --git a/src/pal/tests/palsuite/c_runtime/logf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/logf/test1/CMakeLists.txt new file mode 100644 index 0000000000..550f572bc7 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/logf/test1/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test1.c +) + +add_executable(paltest_logf_test1 + ${SOURCES} +) + +add_dependencies(paltest_logf_test1 coreclrpal) + +target_link_libraries(paltest_logf_test1 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/logf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/logf/test1/test1.c new file mode 100644 index 0000000000..499778e992 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/logf/test1/test1.c @@ -0,0 +1,139 @@ +// 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: test1.c +** +** Purpose: Tests logf with a normal set of values. +** +**===================================================================*/ + +#include <palsuite.h> + +// binary32 (float) has a machine epsilon of 2^-23 (approx. 1.19e-07). However, this +// is slightly too accurate when writing tests meant to run against libm implementations +// for various platforms. 2^-21 (approx. 4.76e-07) seems to be as accurate as we can get. +// +// The tests themselves will take PAL_EPSILON and adjust it according to the expected result +// so that the delta used for comparison will compare the most significant digits and ignore +// any digits that are outside the double precision range (6-9 digits). + +// For example, a test with an expect result in the format of 0.xxxxxxxxx will use PAL_EPSILON +// for the variance, while an expected result in the format of 0.0xxxxxxxxx will use +// PAL_EPSILON / 10 and and expected result in the format of x.xxxxxx will use PAL_EPSILON * 10. +#define PAL_EPSILON 4.76837158e-07 + +#define PAL_NAN sqrtf(-1.0f) +#define PAL_POSINF -logf(0.0f) +#define PAL_NEGINF logf(0.0f) + +/** + * Helper test structure + */ +struct test +{ + float value; /* value to test the function with */ + float expected; /* expected result */ + float variance; /* maximum delta between the expected and actual result */ +}; + +/** + * validate + * + * test validation function + */ +void __cdecl validate(float value, float expected, float variance) +{ + float result = logf(value); + + /* + * The test is valid when the difference between result + * and expected is less than or equal to variance + */ + float delta = fabsf(result - expected); + + if (delta > variance) + { + Fail("logf(%g) returned %10.9g when it should have returned %10.9g", + value, result, expected); + } +} + +/** + * validate + * + * test validation function for values returning NaN + */ +void __cdecl validate_isnan(float value) +{ + float result = logf(value); + + if (!_isnanf(result)) + { + Fail("logf(%g) returned %10.9g when it should have returned %10.9g", + value, result, PAL_NAN); + } +} + +/** + * main + * + * executable entry point + */ +int __cdecl main(int argc, char **argv) +{ + struct test tests[] = + { + /* value expected variance */ + { 0, PAL_NEGINF, 0 }, + { 0.0432139183f, -3.14159265f, PAL_EPSILON * 10 }, // expected: -(pi) + { 0.0659880358f, -2.71828183f, PAL_EPSILON * 10 }, // expected: -(e) + { 0.1f, -2.30258509f, PAL_EPSILON * 10 }, // expected: -(ln(10)) + { 0.207879576f, -1.57079633f, PAL_EPSILON * 10 }, // expected: -(pi / 2) + { 0.236290088f, -1.44269504f, PAL_EPSILON * 10 }, // expected: -(logf2(e)) + { 0.243116734f, -1.41421356f, PAL_EPSILON * 10 }, // expected: -(sqrtf(2)) + { 0.323557264f, -1.12837917f, PAL_EPSILON * 10 }, // expected: -(2 / sqrtf(pi)) + { 0.367879441f, -1, PAL_EPSILON * 10 }, // expected: -(1) + { 0.455938128f, -0.785398163f, PAL_EPSILON }, // expected: -(pi / 4) + { 0.493068691f, -0.707106781f, PAL_EPSILON }, // expected: -(1 / sqrtf(2)) + { 0.5f, -0.693147181f, PAL_EPSILON }, // expected: -(ln(2)) + { 0.529077808f, -0.636619772f, PAL_EPSILON }, // expected: -(2 / pi) + { 0.647721485f, -0.434294482f, PAL_EPSILON }, // expected: -(log10f(e)) + { 0.727377349f, -0.318309886f, PAL_EPSILON }, // expected: -(1 / pi) + { 1, 0, PAL_EPSILON }, + { 1.37480223f, 0.318309886f, PAL_EPSILON }, // expected: 1 / pi + { 1.54387344f, 0.434294482f, PAL_EPSILON }, // expected: log10f(e) + { 1.89008116f, 0.636619772f, PAL_EPSILON }, // expected: 2 / pi + { 2, 0.693147181f, PAL_EPSILON }, // expected: ln(2) + { 2.02811498f, 0.707106781f, PAL_EPSILON }, // expected: 1 / sqrtf(2) + { 2.19328005f, 0.785398163f, PAL_EPSILON }, // expected: pi / 4 + { 2.71828183f, 1, PAL_EPSILON * 10 }, // value: e + { 3.09064302f, 1.12837917f, PAL_EPSILON * 10 }, // expected: 2 / sqrtf(pi) + { 4.11325038f, 1.41421356f, PAL_EPSILON * 10 }, // expected: sqrtf(2) + { 4.23208611f, 1.44269504f, PAL_EPSILON * 10 }, // expected: logf2(e) + { 4.81047738f, 1.57079633f, PAL_EPSILON * 10 }, // expected: pi / 2 + { 10, 2.30258509f, PAL_EPSILON * 10 }, // expected: ln(10) + { 15.1542622f, 2.71828183f, PAL_EPSILON * 10 }, // expected: e + { 23.1406926f, 3.14159265f, PAL_EPSILON * 10 }, // expected: pi + { PAL_POSINF, PAL_POSINF, 0 }, + }; + + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) + { + validate(tests[i].value, tests[i].expected, tests[i].variance); + } + + validate_isnan(PAL_NEGINF); + validate_isnan(PAL_NAN); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/logf/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/logf/test1/testinfo.dat new file mode 100644 index 0000000000..aadfee6c11 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/logf/test1/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 = logf +Name = Positive Test for logf +TYPE = DEFAULT +EXE1 = test1 +Description += Passes a series of values to the logf() function, += checking each for the expected result. Also checks += for proper handling of out-of-range values. diff --git a/src/pal/tests/palsuite/c_runtime/malloc/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/malloc/test1/CMakeLists.txt index 4a388ad3d7..f475730973 100644 --- a/src/pal/tests/palsuite/c_runtime/malloc/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/malloc/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_malloc_test1 diff --git a/src/pal/tests/palsuite/c_runtime/malloc/test1/test1.c b/src/pal/tests/palsuite/c_runtime/malloc/test1/test1.cpp index 7ea4dd068f..7ea4dd068f 100644 --- a/src/pal/tests/palsuite/c_runtime/malloc/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/malloc/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/malloc/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/malloc/test2/CMakeLists.txt index abbed2aa62..663e104d0e 100644 --- a/src/pal/tests/palsuite/c_runtime/malloc/test2/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/malloc/test2/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test2.c + test2.cpp ) add_executable(paltest_malloc_test2 diff --git a/src/pal/tests/palsuite/c_runtime/malloc/test2/test2.c b/src/pal/tests/palsuite/c_runtime/malloc/test2/test2.cpp index 5deee0eddb..5deee0eddb 100644 --- a/src/pal/tests/palsuite/c_runtime/malloc/test2/test2.c +++ b/src/pal/tests/palsuite/c_runtime/malloc/test2/test2.cpp diff --git a/src/pal/tests/palsuite/c_runtime/memchr/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/memchr/test1/CMakeLists.txt index 4e33a8fc04..959fd2a3bc 100644 --- a/src/pal/tests/palsuite/c_runtime/memchr/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/memchr/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_memchr_test1 diff --git a/src/pal/tests/palsuite/c_runtime/memchr/test1/test1.c b/src/pal/tests/palsuite/c_runtime/memchr/test1/test1.cpp index 043a6789d8..043a6789d8 100644 --- a/src/pal/tests/palsuite/c_runtime/memchr/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/memchr/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/memcmp/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/memcmp/test1/CMakeLists.txt index b61f208f34..43d8fdd7f7 100644 --- a/src/pal/tests/palsuite/c_runtime/memcmp/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/memcmp/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_memcmp_test1 diff --git a/src/pal/tests/palsuite/c_runtime/memcmp/test1/test1.c b/src/pal/tests/palsuite/c_runtime/memcmp/test1/test1.cpp index 7b63173e22..7b63173e22 100644 --- a/src/pal/tests/palsuite/c_runtime/memcmp/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/memcmp/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/memcpy/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/memcpy/test1/CMakeLists.txt index d846bfc62d..14db0df60e 100644 --- a/src/pal/tests/palsuite/c_runtime/memcpy/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/memcpy/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_memcpy_test1 diff --git a/src/pal/tests/palsuite/c_runtime/memcpy/test1/test1.c b/src/pal/tests/palsuite/c_runtime/memcpy/test1/test1.cpp index 9da98d6573..9da98d6573 100644 --- a/src/pal/tests/palsuite/c_runtime/memcpy/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/memcpy/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/memmove/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/memmove/test1/CMakeLists.txt index cf50ec01b7..db6f65e48b 100644 --- a/src/pal/tests/palsuite/c_runtime/memmove/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/memmove/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_memmove_test1 diff --git a/src/pal/tests/palsuite/c_runtime/memmove/test1/test1.c b/src/pal/tests/palsuite/c_runtime/memmove/test1/test1.c deleted file mode 100644 index c1af871f4a..0000000000 --- a/src/pal/tests/palsuite/c_runtime/memmove/test1/test1.c +++ /dev/null @@ -1,116 +0,0 @@ -// 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: test1.c -** -** Purpose: Test that memmove correctly copies text from one buffer -** to another even when the buffers overlap. -** -** -**==========================================================================*/ - -#include <palsuite.h> - -int __cdecl main(int argc, char **argv) -{ - char testA[11] = "abcdefghij"; - char testB[15] = "aabbccddeeffgg"; - char testC[15] = "aabbccddeeffgg"; - char testD[15] = "aabbccddeeffgg"; - char insString[3] = "zzz"; - char *retVal; - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - /* move a string onto itself */ - retVal = (char *)memmove(testA + 2, testA, 8); - if (retVal != testA + 2) - { - Fail("The return value should have been the value of the destination" - "pointer, but wasn't\n"); - } - - /*Check the most likely error*/ - if (memcmp(testA, "ababababab", 11) == 0) - { - Fail("memmove should have saved the characters in the region of" - " overlap between source and destination, but didn't.\n"); - } - - if (memcmp(testA, "ababcdefgh", 11) != 0) - { - /* not sure what exactly went wrong. */ - Fail("memmove was called on a region containing the characters" - " \"abcdefghij\". It was to move the first 8 positions to" - " the last 8 positions, giving the result \"ababcdefgh\". " - " Instead, it gave the result \"%s\".\n", testA); - } - - /* move a string to the front of testB */ - retVal = (char *)memmove(testB, insString, 3); - if(retVal != testB) - { - Fail("memmove: The function did not return the correct " - "string.\n"); - } - - if(memcmp(testB, "zzzbccddeeffgg",15) != 0) - { - Fail("memmove: The function failed to move the string " - "correctly.\n"); - } - - - /* move a string to the middle of testC */ - retVal = memmove(testC+5, insString, 3); - if(retVal != testC+5) - { - Fail("memmove: The function did not return the correct " - "string.\n"); - } - - if(memcmp(testC, "aabbczzzeeffgg",15) != 0) - { - Fail("memmove: The function failed to move the string " - "correctly.\n"); - } - - - /* move a string to the end of testD */ - retVal = memmove(testD+11, insString, 3); - if(retVal != testD+11) - { - Fail("memmove: The function did not return the correct " - "string.\n"); - } - - if(memcmp(testD, "aabbccddeefzzz",15) != 0) - { - Fail("memmove: The function failed to move the string " - "correctly.\n"); - } - - PAL_Terminate(); - return PASS; - -} - - - - - - - - - - - - - - diff --git a/src/pal/tests/palsuite/c_runtime/memmove/test1/test1.cpp b/src/pal/tests/palsuite/c_runtime/memmove/test1/test1.cpp new file mode 100644 index 0000000000..8279d67139 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/memmove/test1/test1.cpp @@ -0,0 +1,116 @@ +// 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: test1.c +** +** Purpose: Test that memmove correctly copies text from one buffer +** to another even when the buffers overlap. +** +** +**==========================================================================*/ + +#include <palsuite.h> + +int __cdecl main(int argc, char **argv) +{ + char testA[11] = "abcdefghij"; + char testB[15] = "aabbccddeeffgg"; + char testC[15] = "aabbccddeeffgg"; + char testD[15] = "aabbccddeeffgg"; + char insString[4] = "zzz"; + char *retVal; + + if (PAL_Initialize(argc, argv)) + { + return FAIL; + } + + /* move a string onto itself */ + retVal = (char *)memmove(testA + 2, testA, 8); + if (retVal != testA + 2) + { + Fail("The return value should have been the value of the destination" + "pointer, but wasn't\n"); + } + + /*Check the most likely error*/ + if (memcmp(testA, "ababababab", 11) == 0) + { + Fail("memmove should have saved the characters in the region of" + " overlap between source and destination, but didn't.\n"); + } + + if (memcmp(testA, "ababcdefgh", 11) != 0) + { + /* not sure what exactly went wrong. */ + Fail("memmove was called on a region containing the characters" + " \"abcdefghij\". It was to move the first 8 positions to" + " the last 8 positions, giving the result \"ababcdefgh\". " + " Instead, it gave the result \"%s\".\n", testA); + } + + /* move a string to the front of testB */ + retVal = (char *)memmove(testB, insString, 3); + if(retVal != testB) + { + Fail("memmove: The function did not return the correct " + "string.\n"); + } + + if(memcmp(testB, "zzzbccddeeffgg",15) != 0) + { + Fail("memmove: The function failed to move the string " + "correctly.\n"); + } + + + /* move a string to the middle of testC */ + retVal = (char*)memmove(testC+5, insString, 3); + if(retVal != testC+5) + { + Fail("memmove: The function did not return the correct " + "string.\n"); + } + + if(memcmp(testC, "aabbczzzeeffgg",15) != 0) + { + Fail("memmove: The function failed to move the string " + "correctly.\n"); + } + + + /* move a string to the end of testD */ + retVal = (char*)memmove(testD+11, insString, 3); + if(retVal != testD+11) + { + Fail("memmove: The function did not return the correct " + "string.\n"); + } + + if(memcmp(testD, "aabbccddeefzzz",15) != 0) + { + Fail("memmove: The function failed to move the string " + "correctly.\n"); + } + + PAL_Terminate(); + return PASS; + +} + + + + + + + + + + + + + + diff --git a/src/pal/tests/palsuite/c_runtime/memset/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/memset/test1/CMakeLists.txt index 78b5a6bc00..bc3d6251cb 100644 --- a/src/pal/tests/palsuite/c_runtime/memset/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/memset/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_memset_test1 diff --git a/src/pal/tests/palsuite/c_runtime/memset/test1/test1.c b/src/pal/tests/palsuite/c_runtime/memset/test1/test1.cpp index 67cde8756b..67cde8756b 100644 --- a/src/pal/tests/palsuite/c_runtime/memset/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/memset/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/modf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/modf/test1/CMakeLists.txt index 4b65ba7a6f..3fe7bc7c46 100644 --- a/src/pal/tests/palsuite/c_runtime/modf/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/modf/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_modf_test1 diff --git a/src/pal/tests/palsuite/c_runtime/modf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/modf/test1/test1.cpp index 389d079253..389d079253 100644 --- a/src/pal/tests/palsuite/c_runtime/modf/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/modf/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/modff/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/modff/test1/CMakeLists.txt index 812cd1c47b..10e5e99267 100644 --- a/src/pal/tests/palsuite/c_runtime/modff/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/modff/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_modff_test1 diff --git a/src/pal/tests/palsuite/c_runtime/modff/test1/test1.c b/src/pal/tests/palsuite/c_runtime/modff/test1/test1.cpp index 6b7a50be39..6b7a50be39 100644 --- a/src/pal/tests/palsuite/c_runtime/modff/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/modff/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/pow/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/pow/test1/CMakeLists.txt index 69ba02af17..f94210d5b7 100644 --- a/src/pal/tests/palsuite/c_runtime/pow/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/pow/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_pow_test1 diff --git a/src/pal/tests/palsuite/c_runtime/pow/test1/test1.c b/src/pal/tests/palsuite/c_runtime/pow/test1/test1.cpp index 0a05cd5a47..0a05cd5a47 100644 --- a/src/pal/tests/palsuite/c_runtime/pow/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/pow/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/powf/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/powf/CMakeLists.txt new file mode 100644 index 0000000000..5e1ef7f28b --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/powf/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +add_subdirectory(test1) diff --git a/src/pal/tests/palsuite/c_runtime/powf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/powf/test1/CMakeLists.txt new file mode 100644 index 0000000000..8ea040f9a4 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/powf/test1/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test1.c +) + +add_executable(paltest_powf_test1 + ${SOURCES} +) + +add_dependencies(paltest_powf_test1 coreclrpal) + +target_link_libraries(paltest_powf_test1 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/powf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/powf/test1/test1.c new file mode 100644 index 0000000000..ca738e8c8d --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/powf/test1/test1.c @@ -0,0 +1,229 @@ +// 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: test1.c +** +** Purpose: Tests that atan2f returns correct values for a subset of values. +** Tests with positive and negative values of x and y to ensure +** atan2f is returning results from the correct quadrant. +** +**===================================================================*/ + +#include <palsuite.h> + +// binary32 (float) has a machine epsilon of 2^-23 (approx. 1.19e-07). However, this +// is slightly too accurate when writing tests meant to run against libm implementations +// for various platforms. 2^-21 (approx. 4.76e-07) seems to be as accurate as we can get. +// +// The tests themselves will take PAL_EPSILON and adjust it according to the expected result +// so that the delta used for comparison will compare the most significant digits and ignore +// any digits that are outside the double precision range (6-9 digits). + +// For example, a test with an expect result in the format of 0.xxxxxxxxx will use PAL_EPSILON +// for the variance, while an expected result in the format of 0.0xxxxxxxxx will use +// PAL_EPSILON / 10 and and expected result in the format of x.xxxxxx will use PAL_EPSILON * 10. +#define PAL_EPSILON 4.76837158e-07 + +#define PAL_NAN sqrtf(-1.0f) +#define PAL_POSINF -logf(0.0f) +#define PAL_NEGINF logf(0.0f) + +/** + * Helper test structure + */ +struct test +{ + float x; /* first component of the value to test the function with */ + float y; /* second component of the value to test the function with */ + float expected; /* expected result */ + float variance; /* maximum delta between the expected and actual result */ +}; + +/** + * validate + * + * test validation function + */ +void __cdecl validate(float x, float y, float expected, float variance) +{ + float result = powf(x, y); + + /* + * The test is valid when the difference between result + * and expected is less than or equal to variance + */ + float delta = fabsf(result - expected); + + if (delta > variance) + { + Fail("powf(%g, %g) returned %10.9g when it should have returned %10.9g", + x, y, result, expected); + } +} + +/** + * validate + * + * test validation function for values returning NaN + */ +void __cdecl validate_isnan(float x, float y) +{ + float result = powf(x, y); + + if (!_isnanf(result)) + { + Fail("powf(%g, %g) returned %10.9g when it should have returned %10.9g", + x, y, result, PAL_NAN); + } +} + +/** + * main + * + * executable entry point + */ +int __cdecl main(int argc, char **argv) +{ + struct test tests[] = + { + /* x y expected variance */ + { PAL_NEGINF, PAL_NEGINF, 0, PAL_EPSILON }, + { PAL_NEGINF, PAL_POSINF, PAL_POSINF, 0 }, + + { -10, PAL_NEGINF, 0, PAL_EPSILON }, + { -10, -1, -0.1f, PAL_EPSILON }, + { -10, 0, 1, PAL_EPSILON * 10 }, + { -10, 1, -10, PAL_EPSILON * 100 }, + { -10, PAL_POSINF, PAL_POSINF, 0 }, + + { -2.71828183f, PAL_NEGINF, 0, PAL_EPSILON }, // x: -(e) + { -2.71828183f, -1, -0.367879441f, PAL_EPSILON }, // x: -(e) + { -2.71828183f, 0, 1, PAL_EPSILON * 10 }, // x: -(e) + { -2.71828183f, 1, -2.71828183f, PAL_EPSILON * 10 }, // x: -(e) expected: e + { -2.71828183f, PAL_POSINF, PAL_POSINF, 0 }, // x: -(e) + + { -0.0, PAL_NEGINF, PAL_POSINF, 0 }, + { -0.0, -1, PAL_NEGINF, 0 }, + { -0.0f, -0.0f, 1, PAL_EPSILON * 10 }, + { -0.0f, 0, 1, PAL_EPSILON * 10 }, + { -0.0, 1, -0.0, PAL_EPSILON }, + { -0.0, PAL_POSINF, 0, PAL_EPSILON }, + + { 0.0, PAL_NEGINF, PAL_POSINF, 0 }, + { 0.0, -1, PAL_POSINF, 0 }, + { 0, -0.0f, 1, PAL_EPSILON * 10 }, + { 0, 0, 1, PAL_EPSILON * 10 }, + { 0.0, 1, 0, PAL_EPSILON }, + { 0.0, PAL_POSINF, 0, PAL_EPSILON }, + + { 1, PAL_NEGINF, 1, PAL_EPSILON * 10 }, + { 1, PAL_POSINF, 1, PAL_EPSILON * 10 }, + + { 2.71828183f, PAL_NEGINF, 0, PAL_EPSILON }, + { 2.71828183f, -3.14159265f, 0.0432139183f, PAL_EPSILON / 10 }, // x: e y: -(pi) + { 2.71828183f, -2.71828183f, 0.0659880358f, PAL_EPSILON / 10 }, // x: e y: -(e) + { 2.71828183f, -2.30258509f, 0.1f, PAL_EPSILON }, // x: e y: -(ln(10)) + { 2.71828183f, -1.57079633f, 0.207879576f, PAL_EPSILON }, // x: e y: -(pi / 2) + { 2.71828183f, -1.44269504f, 0.236290088f, PAL_EPSILON }, // x: e y: -(logf2(e)) + { 2.71828183f, -1.41421356f, 0.243116734f, PAL_EPSILON }, // x: e y: -(sqrtf(2)) + { 2.71828183f, -1.12837917f, 0.323557264f, PAL_EPSILON }, // x: e y: -(2 / sqrtf(pi)) + { 2.71828183f, -1, 0.367879441f, PAL_EPSILON }, // x: e y: -(1) + { 2.71828183f, -0.785398163f, 0.455938128f, PAL_EPSILON }, // x: e y: -(pi / 4) + { 2.71828183f, -0.707106781f, 0.493068691f, PAL_EPSILON }, // x: e y: -(1 / sqrtf(2)) + { 2.71828183f, -0.693147181f, 0.5f, PAL_EPSILON }, // x: e y: -(ln(2)) + { 2.71828183f, -0.636619772f, 0.529077808f, PAL_EPSILON }, // x: e y: -(2 / pi) + { 2.71828183f, -0.434294482f, 0.647721485f, PAL_EPSILON }, // x: e y: -(log10f(e)) + { 2.71828183f, -0.318309886f, 0.727377349f, PAL_EPSILON }, // x: e y: -(1 / pi) + { 2.71828183f, 0, 1, PAL_EPSILON * 10 }, // x: e + { 2.71828183f, 0.318309886f, 1.37480223f, PAL_EPSILON * 10 }, // x: e y: 1 / pi + { 2.71828183f, 0.434294482f, 1.54387344f, PAL_EPSILON * 10 }, // x: e y: log10f(e) + { 2.71828183f, 0.636619772f, 1.89008116f, PAL_EPSILON * 10 }, // x: e y: 2 / pi + { 2.71828183f, 0.693147181f, 2, PAL_EPSILON * 10 }, // x: e y: ln(2) + { 2.71828183f, 0.707106781f, 2.02811498f, PAL_EPSILON * 10 }, // x: e y: 1 / sqrtf(2) + { 2.71828183f, 0.785398163f, 2.19328005f, PAL_EPSILON * 10 }, // x: e y: pi / 4 + { 2.71828183f, 1, 2.71828183f, PAL_EPSILON * 10 }, // x: e expected: e + { 2.71828183f, 1.12837917f, 3.09064302f, PAL_EPSILON * 10 }, // x: e y: 2 / sqrtf(pi) + { 2.71828183f, 1.41421356f, 4.11325038f, PAL_EPSILON * 10 }, // x: e y: sqrtf(2) + { 2.71828183f, 1.44269504f, 4.23208611f, PAL_EPSILON * 10 }, // x: e y: logf2(e) + { 2.71828183f, 1.57079633f, 4.81047738f, PAL_EPSILON * 10 }, // x: e y: pi / 2 + { 2.71828183f, 2.30258509f, 10, PAL_EPSILON * 100 }, // x: e y: ln(10) + { 2.71828183f, 2.71828183f, 15.1542622f, PAL_EPSILON * 100 }, // x: e y: e + { 2.71828183f, 3.14159265f, 23.1406926f, PAL_EPSILON * 100 }, // x: e y: pi + { 2.71828183f, PAL_POSINF, PAL_POSINF, 0 }, // x: e + + { 10, PAL_NEGINF, 0, 0 }, + { 10, -3.14159265f, 0.000721784159f, PAL_EPSILON / 1000 }, // y: -(pi) + { 10, -2.71828183f, 0.00191301410f, PAL_EPSILON / 100 }, // y: -(e) + { 10, -2.30258509f, 0.00498212830f, PAL_EPSILON / 100 }, // y: -(ln(10)) + { 10, -1.57079633f, 0.0268660410f, PAL_EPSILON / 10 }, // y: -(pi / 2) + { 10, -1.44269504f, 0.0360831928f, PAL_EPSILON / 10 }, // y: -(logf2(e)) + { 10, -1.41421356f, 0.0385288847f, PAL_EPSILON / 10 }, // y: -(sqrtf(2)) + { 10, -1.12837917f, 0.0744082059f, PAL_EPSILON / 10 }, // y: -(2 / sqrtf(pi)) + { 10, -1, 0.1f, PAL_EPSILON }, // y: -(1) + { 10, -0.785398163f, 0.163908636f, PAL_EPSILON }, // y: -(pi / 4) + { 10, -0.707106781f, 0.196287760f, PAL_EPSILON }, // y: -(1 / sqrtf(2)) + { 10, -0.693147181f, 0.202699566f, PAL_EPSILON }, // y: -(ln(2)) + { 10, -0.636619772f, 0.230876765f, PAL_EPSILON }, // y: -(2 / pi) + { 10, -0.434294482f, 0.367879441f, PAL_EPSILON }, // y: -(log10f(e)) + { 10, -0.318309886f, 0.480496373f, PAL_EPSILON }, // y: -(1 / pi) + { 10, 0, 1, PAL_EPSILON * 10 }, + { 10, 0.318309886f, 2.08118116f, PAL_EPSILON * 10 }, // y: 1 / pi + { 10, 0.434294482f, 2.71828183f, PAL_EPSILON * 10 }, // y: log10f(e) expected: e + { 10, 0.636619772f, 4.33131503f, PAL_EPSILON * 10 }, // y: 2 / pi + { 10, 0.693147181f, 4.93340967f, PAL_EPSILON * 10 }, // y: ln(2) + { 10, 0.707106781f, 5.09456117f, PAL_EPSILON * 10 }, // y: 1 / sqrtf(2) + { 10, 0.785398163f, 6.10095980f, PAL_EPSILON * 10 }, // y: pi / 4 + { 10, 1, 10, PAL_EPSILON * 100 }, + { 10, 1.12837917f, 13.4393779f, PAL_EPSILON * 100 }, // y: 2 / sqrtf(pi) + { 10, 1.41421356f, 25.9545535f, PAL_EPSILON * 100 }, // y: sqrtf(2) + { 10, 1.44269504f, 27.7137338f, PAL_EPSILON * 100 }, // y: logf2(e) + { 10, 1.57079633f, 37.2217105f, PAL_EPSILON * 100 }, // y: pi / 2 + { 10, 2.30258509f, 200.717432f, PAL_EPSILON * 1000 }, // y: ln(10) + { 10, 2.71828183f, 522.735300f, PAL_EPSILON * 1000 }, // y: e + { 10, 3.14159265f, 1385.45573f, PAL_EPSILON * 10000 }, // y: pi + { 10, PAL_POSINF, PAL_POSINF, 0 }, + + { PAL_POSINF, PAL_NEGINF, 0, PAL_EPSILON }, + { PAL_POSINF, PAL_POSINF, PAL_POSINF, 0 }, + }; + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) + { + validate(tests[i].x, tests[i].y, tests[i].expected, tests[i].variance); + } + + validate_isnan(-10, -1.57079633f); // y: -(pi / 2) + validate_isnan(-10, -0.785398163f); // y: -(pi / 4) + validate_isnan(-10, 0.785398163f); // y: pi / 4 + validate_isnan(-10, 1.57079633f); // y: pi / 2 + + validate_isnan(-2.71828183f, -1.57079633f); // x: -(e) y: -(pi / 2) + validate_isnan(-2.71828183f, -0.785398163f); // x: -(e) y: -(pi / 4) + validate_isnan(-2.71828183f, 0.785398163f); // x: -(e) y: pi / 4 + validate_isnan(-2.71828183f, 1.57079633f); // x: -(e) y: pi / 2 + + validate_isnan(-1, PAL_NEGINF); + validate_isnan(-1, PAL_POSINF); + + validate_isnan(PAL_NAN, -0.0); + validate_isnan(PAL_NAN, 0); + + validate_isnan(PAL_NEGINF, PAL_NAN); + validate_isnan(PAL_NAN, PAL_NEGINF); + + validate_isnan(PAL_POSINF, PAL_NAN); + validate_isnan(PAL_NAN, PAL_POSINF); + + validate_isnan(PAL_NAN, PAL_NAN); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/powf/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/powf/test1/testinfo.dat new file mode 100644 index 0000000000..778c042025 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/powf/test1/testinfo.dat @@ -0,0 +1,17 @@ +# 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 = powf +Name = Call powf with some std input/output. +TYPE = DEFAULT +EXE1 = test1 +Description += Call the powf function with various num/expfonent pairs += that should produce std answers. + + + + diff --git a/src/pal/tests/palsuite/c_runtime/printf/printf.h b/src/pal/tests/palsuite/c_runtime/printf/printf.h index 2eaa984bad..8ef725f305 100644 --- a/src/pal/tests/palsuite/c_runtime/printf/printf.h +++ b/src/pal/tests/palsuite/c_runtime/printf/printf.h @@ -14,7 +14,7 @@ #ifndef __printf_H__ #define __printf_H__ -void DoStrTest(char *formatstr, char* param, char *checkstr) +void DoStrTest(const char *formatstr, char* param, const char *checkstr) { int ret; @@ -26,7 +26,7 @@ void DoStrTest(char *formatstr, char* param, char *checkstr) } } -void DoWStrTest(char *formatstr, WCHAR* param, char *checkstr) +void DoWStrTest(const char *formatstr, WCHAR* param, const char *checkstr) { int ret; @@ -38,8 +38,8 @@ void DoWStrTest(char *formatstr, WCHAR* param, char *checkstr) } } -void DoPointerTest(char *formatstr, void* param, char* paramstr, - char *checkstr1) +void DoPointerTest(const char *formatstr, void* param, char* paramstr, + const char *checkstr1) { int ret; @@ -51,7 +51,7 @@ void DoPointerTest(char *formatstr, void* param, char* paramstr, } } -void DoCountTest(char *formatstr, int param, char *checkstr) +void DoCountTest(const char *formatstr, int param, const char *checkstr) { int ret; int n = -1; @@ -70,7 +70,7 @@ void DoCountTest(char *formatstr, int param, char *checkstr) } } -void DoShortCountTest(char *formatstr, int param, char *checkstr) +void DoShortCountTest(const char *formatstr, int param, const char *checkstr) { int ret; short int n = -1; @@ -90,7 +90,7 @@ void DoShortCountTest(char *formatstr, int param, char *checkstr) } -void DoCharTest(char *formatstr, char param, char *checkstr) +void DoCharTest(const char *formatstr, char param, const char *checkstr) { int ret; @@ -102,7 +102,7 @@ void DoCharTest(char *formatstr, char param, char *checkstr) } } -void DoWCharTest(char *formatstr, WCHAR param, char *checkstr) +void DoWCharTest(const char *formatstr, WCHAR param, const char *checkstr) { int ret; @@ -114,7 +114,7 @@ void DoWCharTest(char *formatstr, WCHAR param, char *checkstr) } } -void DoNumTest(char *formatstr, int param, char *checkstr) +void DoNumTest(const char *formatstr, int param, const char *checkstr) { int ret; @@ -126,8 +126,8 @@ void DoNumTest(char *formatstr, int param, char *checkstr) } } -void DoI64Test(char *formatstr, INT64 param, char *valuestr, - char *checkstr1) +void DoI64Test(const char *formatstr, INT64 param, char *valuestr, + const char *checkstr1) { int ret; @@ -139,8 +139,8 @@ void DoI64Test(char *formatstr, INT64 param, char *valuestr, } } -void DoDoubleTest(char *formatstr, double param, - char *checkstr1, char *checkstr2) +void DoDoubleTest(const char *formatstr, double param, + const char *checkstr1, const char *checkstr2) { int ret; @@ -152,8 +152,8 @@ void DoDoubleTest(char *formatstr, double param, } } -void DoArgumentPrecTest(char *formatstr, int precision, void *param, - char *paramstr, char *checkstr1, char *checkstr2) +void DoArgumentPrecTest(const char *formatstr, int precision, void *param, + char *paramstr, const char *checkstr1, const char *checkstr2) { int ret; @@ -165,8 +165,8 @@ void DoArgumentPrecTest(char *formatstr, int precision, void *param, } } -void DoArgumentPrecDoubleTest(char *formatstr, int precision, double param, - char *checkstr1, char *checkstr2) +void DoArgumentPrecDoubleTest(const char *formatstr, int precision, double param, + const char *checkstr1, const char *checkstr2) { int ret; diff --git a/src/pal/tests/palsuite/c_runtime/printf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/printf/test1/CMakeLists.txt index bea9151ed7..2dace14f90 100644 --- a/src/pal/tests/palsuite/c_runtime/printf/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/printf/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_printf_test1 diff --git a/src/pal/tests/palsuite/c_runtime/printf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/printf/test1/test1.cpp index 31b7014343..31b7014343 100644 --- a/src/pal/tests/palsuite/c_runtime/printf/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/printf/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/printf/test10/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/printf/test10/CMakeLists.txt index 89ff2e0190..75e30c8599 100644 --- a/src/pal/tests/palsuite/c_runtime/printf/test10/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/printf/test10/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test10.c + test10.cpp ) add_executable(paltest_printf_test10 diff --git a/src/pal/tests/palsuite/c_runtime/printf/test10/test10.c b/src/pal/tests/palsuite/c_runtime/printf/test10/test10.cpp index 5e69175b07..5e69175b07 100644 --- a/src/pal/tests/palsuite/c_runtime/printf/test10/test10.c +++ b/src/pal/tests/palsuite/c_runtime/printf/test10/test10.cpp diff --git a/src/pal/tests/palsuite/c_runtime/printf/test11/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/printf/test11/CMakeLists.txt index 349f154a8d..4ee12dc21d 100644 --- a/src/pal/tests/palsuite/c_runtime/printf/test11/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/printf/test11/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test11.c + test11.cpp ) add_executable(paltest_printf_test11 diff --git a/src/pal/tests/palsuite/c_runtime/printf/test11/test11.c b/src/pal/tests/palsuite/c_runtime/printf/test11/test11.cpp index 788be8b2db..788be8b2db 100644 --- a/src/pal/tests/palsuite/c_runtime/printf/test11/test11.c +++ b/src/pal/tests/palsuite/c_runtime/printf/test11/test11.cpp diff --git a/src/pal/tests/palsuite/c_runtime/printf/test12/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/printf/test12/CMakeLists.txt index 0d32ee1690..3b2e39d640 100644 --- a/src/pal/tests/palsuite/c_runtime/printf/test12/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/printf/test12/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test12.c + test12.cpp ) add_executable(paltest_printf_test12 diff --git a/src/pal/tests/palsuite/c_runtime/printf/test12/test12.c b/src/pal/tests/palsuite/c_runtime/printf/test12/test12.cpp index b4006f2405..b4006f2405 100644 --- a/src/pal/tests/palsuite/c_runtime/printf/test12/test12.c +++ b/src/pal/tests/palsuite/c_runtime/printf/test12/test12.cpp diff --git a/src/pal/tests/palsuite/c_runtime/printf/test13/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/printf/test13/CMakeLists.txt index 348d25b22d..b6af021d48 100644 --- a/src/pal/tests/palsuite/c_runtime/printf/test13/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/printf/test13/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test13.c + test13.cpp ) add_executable(paltest_printf_test13 diff --git a/src/pal/tests/palsuite/c_runtime/printf/test13/test13.c b/src/pal/tests/palsuite/c_runtime/printf/test13/test13.cpp index ccd16b50d2..ccd16b50d2 100644 --- a/src/pal/tests/palsuite/c_runtime/printf/test13/test13.c +++ b/src/pal/tests/palsuite/c_runtime/printf/test13/test13.cpp diff --git a/src/pal/tests/palsuite/c_runtime/printf/test14/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/printf/test14/CMakeLists.txt index 659ea78cc6..5a6cf8a180 100644 --- a/src/pal/tests/palsuite/c_runtime/printf/test14/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/printf/test14/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test14.c + test14.cpp ) add_executable(paltest_printf_test14 diff --git a/src/pal/tests/palsuite/c_runtime/printf/test14/test14.c b/src/pal/tests/palsuite/c_runtime/printf/test14/test14.cpp index 10577db67d..10577db67d 100644 --- a/src/pal/tests/palsuite/c_runtime/printf/test14/test14.c +++ b/src/pal/tests/palsuite/c_runtime/printf/test14/test14.cpp diff --git a/src/pal/tests/palsuite/c_runtime/printf/test15/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/printf/test15/CMakeLists.txt index 9e4e310304..b1466a387d 100644 --- a/src/pal/tests/palsuite/c_runtime/printf/test15/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/printf/test15/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test15.c + test15.cpp ) add_executable(paltest_printf_test15 diff --git a/src/pal/tests/palsuite/c_runtime/printf/test15/test15.c b/src/pal/tests/palsuite/c_runtime/printf/test15/test15.cpp index 2acfc436a3..2acfc436a3 100644 --- a/src/pal/tests/palsuite/c_runtime/printf/test15/test15.c +++ b/src/pal/tests/palsuite/c_runtime/printf/test15/test15.cpp diff --git a/src/pal/tests/palsuite/c_runtime/printf/test16/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/printf/test16/CMakeLists.txt index 7e477a3059..c81da10ec9 100644 --- a/src/pal/tests/palsuite/c_runtime/printf/test16/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/printf/test16/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test16.c + test16.cpp ) add_executable(paltest_printf_test16 diff --git a/src/pal/tests/palsuite/c_runtime/printf/test16/test16.c b/src/pal/tests/palsuite/c_runtime/printf/test16/test16.cpp index 50c952f959..50c952f959 100644 --- a/src/pal/tests/palsuite/c_runtime/printf/test16/test16.c +++ b/src/pal/tests/palsuite/c_runtime/printf/test16/test16.cpp diff --git a/src/pal/tests/palsuite/c_runtime/printf/test17/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/printf/test17/CMakeLists.txt index c18450c2aa..9d40e54ca6 100644 --- a/src/pal/tests/palsuite/c_runtime/printf/test17/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/printf/test17/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test17.c + test17.cpp ) add_executable(paltest_printf_test17 diff --git a/src/pal/tests/palsuite/c_runtime/printf/test17/test17.c b/src/pal/tests/palsuite/c_runtime/printf/test17/test17.cpp index 96ddd5c1e4..96ddd5c1e4 100644 --- a/src/pal/tests/palsuite/c_runtime/printf/test17/test17.c +++ b/src/pal/tests/palsuite/c_runtime/printf/test17/test17.cpp diff --git a/src/pal/tests/palsuite/c_runtime/printf/test18/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/printf/test18/CMakeLists.txt index b0468314a3..6ab11f4be1 100644 --- a/src/pal/tests/palsuite/c_runtime/printf/test18/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/printf/test18/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test18.c + test18.cpp ) add_executable(paltest_printf_test18 diff --git a/src/pal/tests/palsuite/c_runtime/printf/test18/test18.c b/src/pal/tests/palsuite/c_runtime/printf/test18/test18.cpp index 6c05e40f42..6c05e40f42 100644 --- a/src/pal/tests/palsuite/c_runtime/printf/test18/test18.c +++ b/src/pal/tests/palsuite/c_runtime/printf/test18/test18.cpp diff --git a/src/pal/tests/palsuite/c_runtime/printf/test19/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/printf/test19/CMakeLists.txt index efd47563d4..f022938e32 100644 --- a/src/pal/tests/palsuite/c_runtime/printf/test19/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/printf/test19/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test19.c + test19.cpp ) add_executable(paltest_printf_test19 diff --git a/src/pal/tests/palsuite/c_runtime/printf/test19/test19.c b/src/pal/tests/palsuite/c_runtime/printf/test19/test19.c deleted file mode 100644 index 1e09398f7c..0000000000 --- a/src/pal/tests/palsuite/c_runtime/printf/test19/test19.c +++ /dev/null @@ -1,76 +0,0 @@ -// 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: test19.c -** -** Purpose: Test #19 for the printf function. Tests the variable length -** precision argument. -** -** -**==========================================================================*/ - - -#include <palsuite.h> -#include "../printf.h" - - - - -int __cdecl main(int argc, char *argv[]) -{ - int n = -1; - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - DoArgumentPrecTest("%.*s", 2, "bar", "bar", "ba", "ba"); - DoArgumentPrecTest("%.*S", 2, convert("bar"), "bar", "ba", "ba"); - - DoArgumentPrecTest("%.*n", 3, &n, "pointer to int", "", ""); - if (n != 0) - { - Fail("ERROR: Expected count parameter to resolve to %d, got %X\n", - 0, n); - } - - DoArgumentPrecTest("%.*c", 0, (void*)'a', "a", "a", "a"); - DoArgumentPrecTest("%.*c", 4, (void*)'a', "a", "a", "a"); - DoArgumentPrecTest("%.*C", 0, (void*)'a', "a", "a", "a"); - DoArgumentPrecTest("%.*C", 4, (void*)'a', "a", "a", "a"); - DoArgumentPrecTest("%.*d", 1, (void*)42, "42", "42", "42"); - DoArgumentPrecTest("%.*d", 3, (void*)42, "42", "042", "042"); - DoArgumentPrecTest("%.*i", 1, (void*)42, "42", "42", "42"); - DoArgumentPrecTest("%.*i", 3, (void*)42, "42", "042", "042"); - DoArgumentPrecTest("%.*o", 1, (void*)42, "42", "52", "52"); - DoArgumentPrecTest("%.*o", 3, (void*)42, "42", "052", "052"); - DoArgumentPrecTest("%.*u", 1, (void*)42, "42", "42", "42"); - DoArgumentPrecTest("%.*u", 3, (void*)42, "42", "042", "042"); - DoArgumentPrecTest("%.*x", 1, (void*)0x42, "0x42", "42", "42"); - DoArgumentPrecTest("%.*x", 3, (void*)0x42, "0x42", "042", "042"); - DoArgumentPrecTest("%.*X", 1, (void*)0x42, "0x42", "42", "42"); - DoArgumentPrecTest("%.*X", 3, (void*)0x42, "0x42", "042", "042"); - - - DoArgumentPrecDoubleTest("%.*e", 1, 2.01, "2.0e+000", "2.0e+00"); - DoArgumentPrecDoubleTest("%.*e", 3, 2.01, "2.010e+000", "2.010e+00"); - DoArgumentPrecDoubleTest("%.*E", 1, 2.01, "2.0E+000", "2.0E+00"); - DoArgumentPrecDoubleTest("%.*E", 3, 2.01, "2.010E+000", "2.010E+00"); - DoArgumentPrecDoubleTest("%.*f", 1, 2.01, "2.0", "2.0"); - DoArgumentPrecDoubleTest("%.*f", 3, 2.01, "2.010", "2.010"); - DoArgumentPrecDoubleTest("%.*g", 1, 256.01, "3e+002", "3e+02"); - DoArgumentPrecDoubleTest("%.*g", 3, 256.01, "256", "256"); - DoArgumentPrecDoubleTest("%.*g", 4, 256.01, "256", "256"); - DoArgumentPrecDoubleTest("%.*g", 6, 256.01, "256.01", "256.01"); - DoArgumentPrecDoubleTest("%.*G", 1, 256.01, "3E+002", "3E+02"); - DoArgumentPrecDoubleTest("%.*G", 3, 256.01, "256", "256"); - DoArgumentPrecDoubleTest("%.*G", 4, 256.01, "256", "256"); - DoArgumentPrecDoubleTest("%.*G", 6, 256.01, "256.01", "256.01"); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/printf/test19/test19.cpp b/src/pal/tests/palsuite/c_runtime/printf/test19/test19.cpp new file mode 100644 index 0000000000..a3ce0e7ad8 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/printf/test19/test19.cpp @@ -0,0 +1,76 @@ +// 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: test19.c +** +** Purpose: Test #19 for the printf function. Tests the variable length +** precision argument. +** +** +**==========================================================================*/ + + +#include <palsuite.h> +#include "../printf.h" + + + + +int __cdecl main(int argc, char *argv[]) +{ + int n = -1; + + if (PAL_Initialize(argc, argv)) + { + return FAIL; + } + + DoArgumentPrecTest("%.*s", 2, (void*)"bar", "bar", "ba", "ba"); + DoArgumentPrecTest("%.*S", 2, (void*)convert("bar"), "bar", "ba", "ba"); + + DoArgumentPrecTest("%.*n", 3, (void*)&n, "pointer to int", "", ""); + if (n != 0) + { + Fail("ERROR: Expected count parameter to resolve to %d, got %X\n", + 0, n); + } + + DoArgumentPrecTest("%.*c", 0, (void*)'a', "a", "a", "a"); + DoArgumentPrecTest("%.*c", 4, (void*)'a', "a", "a", "a"); + DoArgumentPrecTest("%.*C", 0, (void*)'a', "a", "a", "a"); + DoArgumentPrecTest("%.*C", 4, (void*)'a', "a", "a", "a"); + DoArgumentPrecTest("%.*d", 1, (void*)42, "42", "42", "42"); + DoArgumentPrecTest("%.*d", 3, (void*)42, "42", "042", "042"); + DoArgumentPrecTest("%.*i", 1, (void*)42, "42", "42", "42"); + DoArgumentPrecTest("%.*i", 3, (void*)42, "42", "042", "042"); + DoArgumentPrecTest("%.*o", 1, (void*)42, "42", "52", "52"); + DoArgumentPrecTest("%.*o", 3, (void*)42, "42", "052", "052"); + DoArgumentPrecTest("%.*u", 1, (void*)42, "42", "42", "42"); + DoArgumentPrecTest("%.*u", 3, (void*)42, "42", "042", "042"); + DoArgumentPrecTest("%.*x", 1, (void*)0x42, "0x42", "42", "42"); + DoArgumentPrecTest("%.*x", 3, (void*)0x42, "0x42", "042", "042"); + DoArgumentPrecTest("%.*X", 1, (void*)0x42, "0x42", "42", "42"); + DoArgumentPrecTest("%.*X", 3, (void*)0x42, "0x42", "042", "042"); + + + DoArgumentPrecDoubleTest("%.*e", 1, 2.01, "2.0e+000", "2.0e+00"); + DoArgumentPrecDoubleTest("%.*e", 3, 2.01, "2.010e+000", "2.010e+00"); + DoArgumentPrecDoubleTest("%.*E", 1, 2.01, "2.0E+000", "2.0E+00"); + DoArgumentPrecDoubleTest("%.*E", 3, 2.01, "2.010E+000", "2.010E+00"); + DoArgumentPrecDoubleTest("%.*f", 1, 2.01, "2.0", "2.0"); + DoArgumentPrecDoubleTest("%.*f", 3, 2.01, "2.010", "2.010"); + DoArgumentPrecDoubleTest("%.*g", 1, 256.01, "3e+002", "3e+02"); + DoArgumentPrecDoubleTest("%.*g", 3, 256.01, "256", "256"); + DoArgumentPrecDoubleTest("%.*g", 4, 256.01, "256", "256"); + DoArgumentPrecDoubleTest("%.*g", 6, 256.01, "256.01", "256.01"); + DoArgumentPrecDoubleTest("%.*G", 1, 256.01, "3E+002", "3E+02"); + DoArgumentPrecDoubleTest("%.*G", 3, 256.01, "256", "256"); + DoArgumentPrecDoubleTest("%.*G", 4, 256.01, "256", "256"); + DoArgumentPrecDoubleTest("%.*G", 6, 256.01, "256.01", "256.01"); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/printf/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/printf/test2/CMakeLists.txt index c303a69134..e92b6b09f3 100644 --- a/src/pal/tests/palsuite/c_runtime/printf/test2/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/printf/test2/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test2.c + test2.cpp ) add_executable(paltest_printf_test2 diff --git a/src/pal/tests/palsuite/c_runtime/printf/test2/test2.c b/src/pal/tests/palsuite/c_runtime/printf/test2/test2.cpp index e766ef4a90..e766ef4a90 100644 --- a/src/pal/tests/palsuite/c_runtime/printf/test2/test2.c +++ b/src/pal/tests/palsuite/c_runtime/printf/test2/test2.cpp diff --git a/src/pal/tests/palsuite/c_runtime/printf/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/printf/test3/CMakeLists.txt index 8bc7479797..fcfd779a0c 100644 --- a/src/pal/tests/palsuite/c_runtime/printf/test3/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/printf/test3/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test3.c + test3.cpp ) add_executable(paltest_printf_test3 diff --git a/src/pal/tests/palsuite/c_runtime/printf/test3/test3.c b/src/pal/tests/palsuite/c_runtime/printf/test3/test3.cpp index 5cc530948c..5cc530948c 100644 --- a/src/pal/tests/palsuite/c_runtime/printf/test3/test3.c +++ b/src/pal/tests/palsuite/c_runtime/printf/test3/test3.cpp diff --git a/src/pal/tests/palsuite/c_runtime/printf/test4/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/printf/test4/CMakeLists.txt index 55e5700fe3..7311bbea69 100644 --- a/src/pal/tests/palsuite/c_runtime/printf/test4/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/printf/test4/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test4.c + test4.cpp ) add_executable(paltest_printf_test4 diff --git a/src/pal/tests/palsuite/c_runtime/printf/test4/test4.c b/src/pal/tests/palsuite/c_runtime/printf/test4/test4.cpp index bcdc201d4f..bcdc201d4f 100644 --- a/src/pal/tests/palsuite/c_runtime/printf/test4/test4.c +++ b/src/pal/tests/palsuite/c_runtime/printf/test4/test4.cpp diff --git a/src/pal/tests/palsuite/c_runtime/printf/test5/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/printf/test5/CMakeLists.txt index d091bca2dc..bfe185c44f 100644 --- a/src/pal/tests/palsuite/c_runtime/printf/test5/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/printf/test5/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test5.c + test5.cpp ) add_executable(paltest_printf_test5 diff --git a/src/pal/tests/palsuite/c_runtime/printf/test5/test5.c b/src/pal/tests/palsuite/c_runtime/printf/test5/test5.cpp index 9f8baa74da..9f8baa74da 100644 --- a/src/pal/tests/palsuite/c_runtime/printf/test5/test5.c +++ b/src/pal/tests/palsuite/c_runtime/printf/test5/test5.cpp diff --git a/src/pal/tests/palsuite/c_runtime/printf/test6/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/printf/test6/CMakeLists.txt index c004e353e9..842ebfedc6 100644 --- a/src/pal/tests/palsuite/c_runtime/printf/test6/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/printf/test6/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test6.c + test6.cpp ) add_executable(paltest_printf_test6 diff --git a/src/pal/tests/palsuite/c_runtime/printf/test6/test6.c b/src/pal/tests/palsuite/c_runtime/printf/test6/test6.cpp index edc65b6b9b..edc65b6b9b 100644 --- a/src/pal/tests/palsuite/c_runtime/printf/test6/test6.c +++ b/src/pal/tests/palsuite/c_runtime/printf/test6/test6.cpp diff --git a/src/pal/tests/palsuite/c_runtime/printf/test7/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/printf/test7/CMakeLists.txt index ff6b647ccd..16e39198ba 100644 --- a/src/pal/tests/palsuite/c_runtime/printf/test7/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/printf/test7/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test7.c + test7.cpp ) add_executable(paltest_printf_test7 diff --git a/src/pal/tests/palsuite/c_runtime/printf/test7/test7.c b/src/pal/tests/palsuite/c_runtime/printf/test7/test7.cpp index 3aeb58f7dc..3aeb58f7dc 100644 --- a/src/pal/tests/palsuite/c_runtime/printf/test7/test7.c +++ b/src/pal/tests/palsuite/c_runtime/printf/test7/test7.cpp diff --git a/src/pal/tests/palsuite/c_runtime/printf/test8/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/printf/test8/CMakeLists.txt index 5ee387f5b8..4a40fee6d9 100644 --- a/src/pal/tests/palsuite/c_runtime/printf/test8/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/printf/test8/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test8.c + test8.cpp ) add_executable(paltest_printf_test8 diff --git a/src/pal/tests/palsuite/c_runtime/printf/test8/test8.c b/src/pal/tests/palsuite/c_runtime/printf/test8/test8.cpp index daa4674b92..daa4674b92 100644 --- a/src/pal/tests/palsuite/c_runtime/printf/test8/test8.c +++ b/src/pal/tests/palsuite/c_runtime/printf/test8/test8.cpp diff --git a/src/pal/tests/palsuite/c_runtime/printf/test9/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/printf/test9/CMakeLists.txt index baf46c1065..df8f75d2fd 100644 --- a/src/pal/tests/palsuite/c_runtime/printf/test9/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/printf/test9/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test9.c + test9.cpp ) add_executable(paltest_printf_test9 diff --git a/src/pal/tests/palsuite/c_runtime/printf/test9/test9.c b/src/pal/tests/palsuite/c_runtime/printf/test9/test9.cpp index 22c60d04f2..22c60d04f2 100644 --- a/src/pal/tests/palsuite/c_runtime/printf/test9/test9.c +++ b/src/pal/tests/palsuite/c_runtime/printf/test9/test9.cpp diff --git a/src/pal/tests/palsuite/c_runtime/qsort/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/qsort/test1/CMakeLists.txt index 105a727e91..ff215b8dc6 100644 --- a/src/pal/tests/palsuite/c_runtime/qsort/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/qsort/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_qsort_test1 diff --git a/src/pal/tests/palsuite/c_runtime/qsort/test1/test1.c b/src/pal/tests/palsuite/c_runtime/qsort/test1/test1.cpp index c65fb18e68..c65fb18e68 100644 --- a/src/pal/tests/palsuite/c_runtime/qsort/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/qsort/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/qsort/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/qsort/test2/CMakeLists.txt index 09e3f6db1e..cdd9642779 100644 --- a/src/pal/tests/palsuite/c_runtime/qsort/test2/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/qsort/test2/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test2.c + test2.cpp ) add_executable(paltest_qsort_test2 diff --git a/src/pal/tests/palsuite/c_runtime/qsort/test2/test2.c b/src/pal/tests/palsuite/c_runtime/qsort/test2/test2.cpp index 8110dcd2c2..8110dcd2c2 100644 --- a/src/pal/tests/palsuite/c_runtime/qsort/test2/test2.c +++ b/src/pal/tests/palsuite/c_runtime/qsort/test2/test2.cpp diff --git a/src/pal/tests/palsuite/c_runtime/rand_srand/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/rand_srand/test1/CMakeLists.txt index 939914662a..6728f402ff 100644 --- a/src/pal/tests/palsuite/c_runtime/rand_srand/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/rand_srand/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_rand_srand_test1 diff --git a/src/pal/tests/palsuite/c_runtime/rand_srand/test1/test1.c b/src/pal/tests/palsuite/c_runtime/rand_srand/test1/test1.cpp index 34154cb6d2..34154cb6d2 100644 --- a/src/pal/tests/palsuite/c_runtime/rand_srand/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/rand_srand/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/realloc/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/realloc/test1/CMakeLists.txt index 0a9f34fc3b..62830a0fe8 100644 --- a/src/pal/tests/palsuite/c_runtime/realloc/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/realloc/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_realloc_test1 diff --git a/src/pal/tests/palsuite/c_runtime/realloc/test1/test1.c b/src/pal/tests/palsuite/c_runtime/realloc/test1/test1.c deleted file mode 100644 index d0dd128cc1..0000000000 --- a/src/pal/tests/palsuite/c_runtime/realloc/test1/test1.c +++ /dev/null @@ -1,66 +0,0 @@ -// 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: test1.c -** -** Purpose: Uses realloc to allocate and realloate memory, checking -** that memory contents are copied when the memory is reallocated. -** -** -**==========================================================================*/ - -#include <palsuite.h> - -int __cdecl main(int argc, char **argv) -{ - char *testA; - const int len1 = 10; - const char str1[] = "aaaaaaaaaa"; - - const int len2 = 20; - const char str2[] = "bbbbbbbbbbbbbbbbbbbb"; - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - /* this should work like malloc */ - testA = (char *)realloc(NULL, len1*sizeof(char)); - memcpy(testA, str1, len1); - if (testA == NULL) - { - Fail("We ran out of memory (unlikely), or realloc is broken.\n"); - } - - if (memcmp(testA, str1, len1) != 0) - { - Fail("realloc doesn't properly allocate new memory.\n"); - } - - testA = (char *)realloc(testA, len2*sizeof(char)); - if (memcmp(testA, str1, len1) != 0) - { - Fail("realloc doesn't move the contents of the original memory " - "block to the newly allocated block.\n"); - } - - memcpy(testA, str2, len2); - if (memcmp(testA, str2, len2) != 0) - { - Fail("Couldn't write to memory allocated by realloc.\n"); - } - - /* free the buffer */ - testA = realloc(testA, 0); - if (testA != NULL) - { - Fail("Realloc didn't return NULL when called with a length " - "of zero.\n"); - } - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/realloc/test1/test1.cpp b/src/pal/tests/palsuite/c_runtime/realloc/test1/test1.cpp new file mode 100644 index 0000000000..64a9270eab --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/realloc/test1/test1.cpp @@ -0,0 +1,66 @@ +// 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: test1.c +** +** Purpose: Uses realloc to allocate and realloate memory, checking +** that memory contents are copied when the memory is reallocated. +** +** +**==========================================================================*/ + +#include <palsuite.h> + +int __cdecl main(int argc, char **argv) +{ + char *testA; + const int len1 = 10; + const char str1[] = "aaaaaaaaaa"; + + const int len2 = 20; + const char str2[] = "bbbbbbbbbbbbbbbbbbbb"; + + if (PAL_Initialize(argc, argv)) + { + return FAIL; + } + + /* this should work like malloc */ + testA = (char *)realloc(NULL, len1*sizeof(char)); + memcpy(testA, str1, len1); + if (testA == NULL) + { + Fail("We ran out of memory (unlikely), or realloc is broken.\n"); + } + + if (memcmp(testA, str1, len1) != 0) + { + Fail("realloc doesn't properly allocate new memory.\n"); + } + + testA = (char *)realloc(testA, len2*sizeof(char)); + if (memcmp(testA, str1, len1) != 0) + { + Fail("realloc doesn't move the contents of the original memory " + "block to the newly allocated block.\n"); + } + + memcpy(testA, str2, len2); + if (memcmp(testA, str2, len2) != 0) + { + Fail("Couldn't write to memory allocated by realloc.\n"); + } + + /* free the buffer */ + testA = (char*)realloc(testA, 0); + if (testA != NULL) + { + Fail("Realloc didn't return NULL when called with a length " + "of zero.\n"); + } + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/sin/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sin/test1/CMakeLists.txt index e074337452..74a0e78f52 100644 --- a/src/pal/tests/palsuite/c_runtime/sin/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/sin/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_sin_test1 diff --git a/src/pal/tests/palsuite/c_runtime/sin/test1/test1.c b/src/pal/tests/palsuite/c_runtime/sin/test1/test1.cpp index bec58d4dd9..bec58d4dd9 100644 --- a/src/pal/tests/palsuite/c_runtime/sin/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/sin/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/sinf/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sinf/CMakeLists.txt new file mode 100644 index 0000000000..5e1ef7f28b --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sinf/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +add_subdirectory(test1) diff --git a/src/pal/tests/palsuite/c_runtime/sinf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sinf/test1/CMakeLists.txt new file mode 100644 index 0000000000..0651b43d1d --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sinf/test1/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test1.c +) + +add_executable(paltest_sinf_test1 + ${SOURCES} +) + +add_dependencies(paltest_sinf_test1 coreclrpal) + +target_link_libraries(paltest_sinf_test1 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/sinf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/sinf/test1/test1.c new file mode 100644 index 0000000000..d5bd248935 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sinf/test1/test1.c @@ -0,0 +1,130 @@ +// 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: test1.c +** +** Purpose: Test to ensure that sinf return the correct values +** +** Dependencies: PAL_Initialize +** PAL_Terminate +** Fail +** fabs +** +**===========================================================================*/ + +#include <palsuite.h> + +// binary32 (float) has a machine epsilon of 2^-23 (approx. 1.19e-07). However, this +// is slightly too accurate when writing tests meant to run against libm implementations +// for various platforms. 2^-21 (approx. 4.76e-07) seems to be as accurate as we can get. +// +// The tests themselves will take PAL_EPSILON and adjust it according to the expected result +// so that the delta used for comparison will compare the most significant digits and ignore +// any digits that are outside the double precision range (6-9 digits). + +// For example, a test with an expect result in the format of 0.xxxxxxxxx will use PAL_EPSILON +// for the variance, while an expected result in the format of 0.0xxxxxxxxx will use +// PAL_EPSILON / 10 and and expected result in the format of x.xxxxxx will use PAL_EPSILON * 10. +#define PAL_EPSILON 4.76837158e-07 + +#define PAL_NAN sqrtf(-1.0f) +#define PAL_POSINF -logf(0.0f) +#define PAL_NEGINF logf(0.0f) + +/** + * Helper test structure + */ +struct test +{ + float value; /* value to test the function with */ + float expected; /* expected result */ + float variance; /* maximum delta between the expected and actual result */ +}; + +/** + * validate + * + * test validation function + */ +void __cdecl validate(float value, float expected, float variance) +{ + float result = sinf(value); + + /* + * The test is valid when the difference between result + * and expected is less than or equal to variance + */ + float delta = fabsf(result - expected); + + if (delta > variance) + { + Fail("sinf(%g) returned %10.9g when it should have returned %10.9g", + value, result, expected); + } +} + +/** + * validate + * + * test validation function for values returning NaN + */ +void __cdecl validate_isnan(float value) +{ + float result = sinf(value); + + if (!_isnanf(result)) + { + Fail("sinf(%g) returned %10.9g when it should have returned %10.9g", + value, result, PAL_NAN); + } +} + +/** + * main + * + * executable entry point + */ +int __cdecl main(int argc, char **argv) +{ + struct test tests[] = + { + /* value expected variance */ + { 0, 0, PAL_EPSILON }, + { 0.318309886f, 0.312961796f, PAL_EPSILON }, // value: 1 / pi + { 0.434294482f, 0.420770483f, PAL_EPSILON }, // value: log10f(e) + { 0.636619772f, 0.594480769f, PAL_EPSILON }, // value: 2 / pi + { 0.693147181f, 0.638961276f, PAL_EPSILON }, // value: ln(2) + { 0.707106781f, 0.649636939f, PAL_EPSILON }, // value: 1 / sqrtf(2) + { 0.785398163f, 0.707106781f, PAL_EPSILON }, // value: pi / 4, expected: 1 / sqrtf(2) + { 1, 0.841470985f, PAL_EPSILON }, + { 1.12837917f, 0.903719457f, PAL_EPSILON }, // value: 2 / sqrtf(pi) + { 1.41421356f, 0.987765946f, PAL_EPSILON }, // value: sqrtf(2) + { 1.44269504f, 0.991806244f, PAL_EPSILON }, // value: logf2(e) + { 1.57079633f, 1, PAL_EPSILON * 10 }, // value: pi / 2 + { 2.30258509f, 0.743980337f, PAL_EPSILON }, // value: ln(10) + { 2.71828183f, 0.410781291f, PAL_EPSILON }, // value: e + { 3.14159265f, 0, PAL_EPSILON }, // value: pi + }; + + /* PAL initialization */ + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) + { + validate( tests[i].value, tests[i].expected, tests[i].variance); + validate(-tests[i].value, -tests[i].expected, tests[i].variance); + } + + validate_isnan(PAL_NEGINF); + validate_isnan(PAL_NAN); + validate_isnan(PAL_POSINF); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/sinf/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sinf/test1/testinfo.dat new file mode 100644 index 0000000000..08ff6026cb --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sinf/test1/testinfo.dat @@ -0,0 +1,13 @@ +# 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 = sinf +Name = Positive Test for sinf +TYPE = DEFAULT +EXE1 = test1 +Description += Passes to sinf() a series of angle value, checking that += each one return to correct value. diff --git a/src/pal/tests/palsuite/c_runtime/sinh/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sinh/test1/CMakeLists.txt index 66cc691d92..b0101ba808 100644 --- a/src/pal/tests/palsuite/c_runtime/sinh/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/sinh/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_sinh_test1 diff --git a/src/pal/tests/palsuite/c_runtime/sinh/test1/test1.c b/src/pal/tests/palsuite/c_runtime/sinh/test1/test1.cpp index e790b16fb4..e790b16fb4 100644 --- a/src/pal/tests/palsuite/c_runtime/sinh/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/sinh/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/sinhf/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sinhf/CMakeLists.txt new file mode 100644 index 0000000000..5e1ef7f28b --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sinhf/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +add_subdirectory(test1) diff --git a/src/pal/tests/palsuite/c_runtime/sinhf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sinhf/test1/CMakeLists.txt new file mode 100644 index 0000000000..72cce43460 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sinhf/test1/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test1.c +) + +add_executable(paltest_sinhf_test1 + ${SOURCES} +) + +add_dependencies(paltest_sinhf_test1 coreclrpal) + +target_link_libraries(paltest_sinhf_test1 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/sinhf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/sinhf/test1/test1.c new file mode 100644 index 0000000000..4e706a2f71 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sinhf/test1/test1.c @@ -0,0 +1,129 @@ +// 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: test1.c +** +** Purpose: Test to ensure that sinhf return the correct values +** +** Dependencies: PAL_Initialize +** PAL_Terminate +** Fail +** fabs +** +**===========================================================================*/ + +#include <palsuite.h> + +// binary32 (float) has a machine epsilon of 2^-23 (approx. 1.19e-07). However, this +// is slightly too accurate when writing tests meant to run against libm implementations +// for various platforms. 2^-21 (approx. 4.76e-07) seems to be as accurate as we can get. +// +// The tests themselves will take PAL_EPSILON and adjust it according to the expected result +// so that the delta used for comparison will compare the most significant digits and ignore +// any digits that are outside the double precision range (6-9 digits). + +// For example, a test with an expect result in the format of 0.xxxxxxxxx will use PAL_EPSILON +// for the variance, while an expected result in the format of 0.0xxxxxxxxx will use +// PAL_EPSILON / 10 and and expected result in the format of x.xxxxxx will use PAL_EPSILON * 10. +#define PAL_EPSILON 4.76837158e-07 + +#define PAL_NAN sqrtf(-1.0f) +#define PAL_POSINF -logf(0.0f) +#define PAL_NEGINF logf(0.0f) + +/** + * Helper test structure + */ +struct test +{ + float value; /* value to test the function with */ + float expected; /* expected result */ + float variance; /* maximum delta between the expected and actual result */ +}; + +/** + * validate + * + * test validation function + */ +void __cdecl validate(float value, float expected, float variance) +{ + float result = sinhf(value); + + /* + * The test is valid when the difference between result + * and expected is less than or equal to variance + */ + float delta = fabsf(result - expected); + + if (delta > variance) + { + Fail("sinhf(%g) returned %10.9g when it should have returned %10.9g", + value, result, expected); + } +} + +/** + * validate + * + * test validation function for values returning NaN + */ +void __cdecl validate_isnan(float value) +{ + float result = sinhf(value); + + if (!_isnanf(result)) + { + Fail("sinhf(%g) returned %10.9g when it should have returned %10.9g", + value, result, PAL_NAN); + } +} + +/** + * main + * + * executable entry point + */ +int __cdecl main(int argc, char **argv) +{ + struct test tests[] = + { + /* value expected variance */ + { 0, 0, PAL_EPSILON }, + { 0.318309886f, 0.323712439f, PAL_EPSILON }, // value: 1 / pi + { 0.434294482f, 0.448075979f, PAL_EPSILON }, // value: log10f(e) + { 0.636619772f, 0.680501678f, PAL_EPSILON }, // value: 2 / pi + { 0.693147181f, 0.75, PAL_EPSILON }, // value: ln(2) + { 0.707106781f, 0.767523145f, PAL_EPSILON }, // value: 1 / sqrtf(2) + { 0.785398163f, 0.868670961f, PAL_EPSILON }, // value: pi / 4 + { 1, 1.17520119f, PAL_EPSILON * 10 }, + { 1.12837917f, 1.38354288f, PAL_EPSILON * 10 }, // value: 2 / sqrtf(pi) + { 1.41421356f, 1.93506682f, PAL_EPSILON * 10 }, // value: sqrtf(2) + { 1.44269504f, 1.99789801f, PAL_EPSILON * 10 }, // value: logf2(e) + { 1.57079633f, 2.30129890f, PAL_EPSILON * 10 }, // value: pi / 2 + { 2.30258509f, 4.95f, PAL_EPSILON * 10 }, // value: ln(10) + { 2.71828183f, 7.54413710f, PAL_EPSILON * 10 }, // value: e + { 3.14159265f, 11.5487394f, PAL_EPSILON * 100 }, // value: pi + { PAL_POSINF, PAL_POSINF, 0 }, + }; + + /* PAL initialization */ + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) + { + validate( tests[i].value, tests[i].expected, tests[i].variance); + validate(-tests[i].value, -tests[i].expected, tests[i].variance); + } + + validate_isnan(PAL_NAN); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/sinhf/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sinhf/test1/testinfo.dat new file mode 100644 index 0000000000..cfb27f5427 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sinhf/test1/testinfo.dat @@ -0,0 +1,13 @@ +# 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 = sinhf +Name = Positive Test for sinhf +TYPE = DEFAULT +EXE1 = test1 +Description += Passes to sinhf() a series of angle value, checking that += each one return to correct value. diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf/CMakeLists.txt deleted file mode 100644 index cafb9536b0..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -add_subdirectory(test1) -add_subdirectory(test10) -add_subdirectory(test11) -add_subdirectory(test12) -add_subdirectory(test13) -add_subdirectory(test14) -add_subdirectory(test15) -add_subdirectory(test16) -add_subdirectory(test17) -add_subdirectory(test18) -add_subdirectory(test19) -add_subdirectory(test2) -add_subdirectory(test3) -add_subdirectory(test4) -add_subdirectory(test5) -add_subdirectory(test6) -add_subdirectory(test7) -add_subdirectory(test8) -add_subdirectory(test9) - diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/sprintf.h b/src/pal/tests/palsuite/c_runtime/sprintf/sprintf.h deleted file mode 100644 index 411ae66d54..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/sprintf.h +++ /dev/null @@ -1,195 +0,0 @@ -// 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: sprintf.h -** -** Purpose: Containts common testing functions for sprintf -** -** -**==========================================================================*/ - -#ifndef __SPRINTF_H__ -#define __SPRINTF_H__ - -void DoStrTest(char *formatstr, char* param, char *checkstr) -{ - char buf[256] = { 0 }; - - sprintf(buf, formatstr, param); - if (memcmp(buf, checkstr, strlen(checkstr) + 1) != 0) - { - Fail("ERROR: failed to insert string \"%s\" into \"%s\"\n" - "Expected \"%s\" got \"%s\".\n", - param, formatstr, checkstr, buf); - } -} - -void DoWStrTest(char *formatstr, WCHAR* param, char *checkstr) -{ - char buf[256] = { 0 }; - - sprintf(buf, formatstr, param); - if (memcmp(buf, checkstr, strlen(checkstr) + 1) != 0) - { - Fail("ERROR: failed to insert wide string \"%s\" into \"%s\"\n" - "Expected \"%s\" got \"%s\".\n", - convertC(param), formatstr, checkstr, buf); - } -} - -void DoPointerTest(char *formatstr, void* param, char* paramstr, - char *checkstr1) -{ - char buf[256] = { 0 }; - - sprintf(buf, formatstr, param); - if (memcmp(buf, checkstr1, strlen(checkstr1) + 1) != 0) - { - Fail("ERROR: failed to insert %s into \"%s\"\n" - "Expected \"%s\" got \"%s\".\n", - paramstr, formatstr, checkstr1, buf); - } -} - -void DoCountTest(char *formatstr, int param, char *checkstr) -{ - char buf[512] = { 0 }; - int n = -1; - - sprintf(buf, formatstr, &n); - - if (n != param) - { - Fail("ERROR: Expected count parameter to resolve to %d, got %X\n", - param, n); - } - if (memcmp(buf, checkstr, strlen(checkstr) + 1) != 0) - { - Fail("ERROR: Expected \"%s\" got \"%s\".\n", checkstr, buf); - } -} - -void DoShortCountTest(char *formatstr, int param, char *checkstr) -{ - char buf[256] = { 0 }; - short int n = -1; - - sprintf(buf, formatstr, &n); - - if (n != param) - { - Fail("ERROR: Expected count parameter to resolve to %d, got %X\n", - param, n); - } - if (memcmp(buf, checkstr, strlen(checkstr) + 1) != 0) - { - Fail("ERROR: Expected \"%s\" got \"%s\".\n", checkstr, buf); - } -} - - -void DoCharTest(char *formatstr, char param, char *checkstr) -{ - char buf[256] = { 0 }; - - sprintf(buf, formatstr, param); - if (memcmp(buf, checkstr, strlen(checkstr) + 1) != 0) - { - Fail("ERROR: failed to insert char \'%c\' (%d) into \"%s\"\n" - "Expected \"%s\" got \"%s\".\n", - param, param, formatstr, checkstr, buf); - } -} - -void DoWCharTest(char *formatstr, WCHAR param, char *checkstr) -{ - char buf[256] = { 0 }; - - sprintf(buf, formatstr, param); - if (memcmp(buf, checkstr, strlen(checkstr) + 1) != 0) - { - Fail("ERROR: failed to insert wide char \'%c\' (%d) into \"%s\"\n" - "Expected \"%s\" got \"%s\".\n", - (char)param, param, formatstr, checkstr, buf); - } -} - -void DoNumTest(char *formatstr, int value, char *checkstr) -{ - char buf[256] = { 0 }; - - sprintf(buf, formatstr, value); - if (memcmp(buf, checkstr, strlen(checkstr) + 1) != 0) - { - Fail("ERROR: failed to insert %#x into \"%s\"\n" - "Expected \"%s\" got \"%s\".\n", - value, formatstr, checkstr, buf); - } -} - -void DoI64Test(char *formatstr, INT64 value, char *valuestr, char *checkstr1) -{ - char buf[256] = { 0 }; - - sprintf(buf, formatstr, value); - if (memcmp(buf, checkstr1, strlen(checkstr1) + 1) != 0) - { - Fail("ERROR: failed to insert %s into \"%s\"\n" - "Expected \"%s\", got \"%s\".\n", - valuestr, formatstr, checkstr1, buf); - } -} - -void DoDoubleTest(char *formatstr, double value, char *checkstr1, - char *checkstr2) -{ - char buf[256] = { 0 }; - - sprintf(buf, formatstr, value); - if (memcmp(buf, checkstr1, strlen(checkstr1) + 1) != 0 && - memcmp(buf, checkstr2, strlen(checkstr2) + 1) != 0) - { - Fail("ERROR: failed to insert %f into \"%s\"\n" - "Expected \"%s\" or \"%s\", got \"%s\".\n", - value, formatstr, checkstr1, checkstr2, buf); - } -} - -void DoArgumentPrecTest(char *formatstr, int precision, void *param, - char *paramstr, char *checkstr1, char *checkstr2) -{ - char buf[256]; - - sprintf(buf, formatstr, precision, param); - if (memcmp(buf, checkstr1, strlen(checkstr1) + 1) != 0 && - memcmp(buf, checkstr2, strlen(checkstr2) + 1) != 0) - { - Fail("ERROR: failed to insert %s into \"%s\" with precision %d\n" - "Expected \"%s\" or \"%s\", got \"%s\".\n", paramstr, formatstr, - precision, checkstr1, checkstr2, buf); - } - -} - -void DoArgumentPrecDoubleTest(char *formatstr, int precision, double param, - char *checkstr1, char *checkstr2) -{ - char buf[256]; - - sprintf(buf, formatstr, precision, param); - if (memcmp(buf, checkstr1, strlen(checkstr1) + 1) != 0 && - memcmp(buf, checkstr2, strlen(checkstr2) + 1) != 0) - { - Fail("ERROR: failed to insert %f into \"%s\" with precision %d\n" - "Expected \"%s\" or \"%s\", got \"%s\".\n", param, formatstr, - precision, checkstr1, checkstr2, buf); - } - -} - -#endif - - diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf/test1/CMakeLists.txt deleted file mode 100644 index bdec045af9..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test1/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test1.c -) - -add_executable(paltest_sprintf_test1 - ${SOURCES} -) - -add_dependencies(paltest_sprintf_test1 coreclrpal) - -target_link_libraries(paltest_sprintf_test1 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/sprintf/test1/test1.c deleted file mode 100644 index 42e27f263b..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test1/test1.c +++ /dev/null @@ -1,45 +0,0 @@ -// 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: test1.c -** -** Purpose: Test #1 for the sprintf function. A single, basic, test -** case with no formatting. -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../sprintf.h" - -/* - * Depends on memcmp and strlen - */ - -int __cdecl main(int argc, char *argv[]) -{ - char checkstr[] = "hello world"; - char buf[256]; - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - - sprintf(buf, "hello world"); - - if (memcmp(checkstr, buf, strlen(checkstr)+1) != 0) - { - Fail("ERROR: expected %s, got %s\n", checkstr, buf); - } - - PAL_Terminate(); - return PASS; -} - diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf/test1/testinfo.dat deleted file mode 100644 index abe07445cc..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test1/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = sprintf -Name = Positive Test for sprintf -TYPE = DEFAULT -EXE1 = test1 -Description -= General test to see if sprintf works correctly diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test10/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf/test10/CMakeLists.txt deleted file mode 100644 index 91e9db8ccc..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test10/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test10.c -) - -add_executable(paltest_sprintf_test10 - ${SOURCES} -) - -add_dependencies(paltest_sprintf_test10 coreclrpal) - -target_link_libraries(paltest_sprintf_test10 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test10/test10.c b/src/pal/tests/palsuite/c_runtime/sprintf/test10/test10.c deleted file mode 100644 index ae7dbfb177..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test10/test10.c +++ /dev/null @@ -1,55 +0,0 @@ -// 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: test10.c -** -** Purpose: Test #10 for the sprintf function. Tests the octal specifier -** (%o). -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../sprintf.h" - -/* - * Depends on memcmp and strlen - */ - -int __cdecl main(int argc, char *argv[]) -{ - int neg = -42; - int pos = 42; - INT64 l = 42; - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - - DoNumTest("foo %o", pos, "foo 52"); - DoNumTest("foo %lo", 0xFFFF, "foo 177777"); - DoNumTest("foo %ho", 0xFFFF, "foo 177777"); - DoNumTest("foo %Lo", pos, "foo 52"); - DoI64Test("foo %I64o", l, "42", "foo 52"); - DoNumTest("foo %3o", pos, "foo 52"); - DoNumTest("foo %-3o", pos, "foo 52 "); - DoNumTest("foo %.1o", pos, "foo 52"); - DoNumTest("foo %.3o", pos, "foo 052"); - DoNumTest("foo %03o", pos, "foo 052"); - DoNumTest("foo %#o", pos, "foo 052"); - DoNumTest("foo %+o", pos, "foo 52"); - DoNumTest("foo % o", pos, "foo 52"); - DoNumTest("foo %+o", neg, "foo 37777777726"); - DoNumTest("foo % o", neg, "foo 37777777726"); - - PAL_Terminate(); - return PASS; -} - diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test10/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf/test10/testinfo.dat deleted file mode 100644 index 70b7f3ab75..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test10/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = sprintf -Name = Positive Test for sprintf -TYPE = DEFAULT -EXE1 = test10 -Description -= Tests sprintf with octal numbers diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test11/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf/test11/CMakeLists.txt deleted file mode 100644 index b14c8be04d..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test11/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test11.c -) - -add_executable(paltest_sprintf_test11 - ${SOURCES} -) - -add_dependencies(paltest_sprintf_test11 coreclrpal) - -target_link_libraries(paltest_sprintf_test11 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test11/test11.c b/src/pal/tests/palsuite/c_runtime/sprintf/test11/test11.c deleted file mode 100644 index 0b5b5ab93d..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test11/test11.c +++ /dev/null @@ -1,55 +0,0 @@ -// 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: test11.c -** -** Purpose: Test #11 for the sprintf function. Test the unsigned int -** specifier (%u). -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../sprintf.h" - -/* - * Depends on memcmp and strlen - */ - -int __cdecl main(int argc, char *argv[]) -{ - int neg = -42; - int pos = 42; - INT64 l = 42; - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - - DoNumTest("foo %u", pos, "foo 42"); - DoNumTest("foo %lu", 0xFFFF, "foo 65535"); - DoNumTest("foo %hu", 0xFFFF, "foo 65535"); - DoNumTest("foo %Lu", pos, "foo 42"); - DoI64Test("foo %I64u", l, "42", "foo 42"); - DoNumTest("foo %3u", pos, "foo 42"); - DoNumTest("foo %-3u", pos, "foo 42 "); - DoNumTest("foo %.1u", pos, "foo 42"); - DoNumTest("foo %.3u", pos, "foo 042"); - DoNumTest("foo %03u", pos, "foo 042"); - DoNumTest("foo %#u", pos, "foo 42"); - DoNumTest("foo %+u", pos, "foo 42"); - DoNumTest("foo % u", pos, "foo 42"); - DoNumTest("foo %+u", neg, "foo 4294967254"); - DoNumTest("foo % u", neg, "foo 4294967254"); - - PAL_Terminate(); - return PASS; -} - diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test11/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf/test11/testinfo.dat deleted file mode 100644 index 852bd3e7b6..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test11/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = sprintf -Name = Positive Test for sprintf -TYPE = DEFAULT -EXE1 = test11 -Description -= Tests sprintf with unsigned numbers diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test12/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf/test12/CMakeLists.txt deleted file mode 100644 index 1e517495bd..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test12/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test12.c -) - -add_executable(paltest_sprintf_test12 - ${SOURCES} -) - -add_dependencies(paltest_sprintf_test12 coreclrpal) - -target_link_libraries(paltest_sprintf_test12 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test12/test12.c b/src/pal/tests/palsuite/c_runtime/sprintf/test12/test12.c deleted file mode 100644 index c2e778e494..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test12/test12.c +++ /dev/null @@ -1,56 +0,0 @@ -// 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: test12.c -** -** Purpose: Test #12 for the sprintf function. Tests the (lowercase) -** hexadecimal specifier (%x) -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../sprintf.h" - -/* - * Depends on memcmp and strlen - */ - -int __cdecl main(int argc, char *argv[]) -{ - int neg = -42; - int pos = 0x1234ab; - INT64 l = I64(0x1234567887654321); - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - - DoNumTest("foo %x", pos, "foo 1234ab"); - DoNumTest("foo %lx", pos, "foo 1234ab"); - DoNumTest("foo %hx", pos, "foo 34ab"); - DoNumTest("foo %Lx", pos, "foo 1234ab"); - DoI64Test("foo %I64x", l, "0x1234567887654321", - "foo 1234567887654321"); - DoNumTest("foo %7x", pos, "foo 1234ab"); - DoNumTest("foo %-7x", pos, "foo 1234ab "); - DoNumTest("foo %.1x", pos, "foo 1234ab"); - DoNumTest("foo %.7x", pos, "foo 01234ab"); - DoNumTest("foo %07x", pos, "foo 01234ab"); - DoNumTest("foo %#x", pos, "foo 0x1234ab"); - DoNumTest("foo %+x", pos, "foo 1234ab"); - DoNumTest("foo % x", pos, "foo 1234ab"); - DoNumTest("foo %+x", neg, "foo ffffffd6"); - DoNumTest("foo % x", neg, "foo ffffffd6"); - - PAL_Terminate(); - return PASS; -} - diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test12/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf/test12/testinfo.dat deleted file mode 100644 index 5df91d0e6a..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test12/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = sprintf -Name = Positive Test for sprintf -TYPE = DEFAULT -EXE1 = test12 -Description -= Tests sprintf with hex numbers (lowercase) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test13/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf/test13/CMakeLists.txt deleted file mode 100644 index 25b033fe82..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test13/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test13.c -) - -add_executable(paltest_sprintf_test13 - ${SOURCES} -) - -add_dependencies(paltest_sprintf_test13 coreclrpal) - -target_link_libraries(paltest_sprintf_test13 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test13/test13.c b/src/pal/tests/palsuite/c_runtime/sprintf/test13/test13.c deleted file mode 100644 index 0b4b7ed9ae..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test13/test13.c +++ /dev/null @@ -1,56 +0,0 @@ -// 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: test13.c -** -** Purpose: Test #13 for the sprintf function. Tests the (uppercase) -** hexadecimal specifier (%X) -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../sprintf.h" - -/* - * Depends on memcmp and strlen - */ - -int __cdecl main(int argc, char *argv[]) -{ - int neg = -42; - int pos = 0x1234AB; - INT64 l = I64(0x1234567887654321); - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - - DoNumTest("foo %X", pos, "foo 1234AB"); - DoNumTest("foo %lX", pos, "foo 1234AB"); - DoNumTest("foo %hX", pos, "foo 34AB"); - DoNumTest("foo %LX", pos, "foo 1234AB"); - DoI64Test("foo %I64X", l, "0x1234567887654321", - "foo 1234567887654321"); - DoNumTest("foo %7X", pos, "foo 1234AB"); - DoNumTest("foo %-7X", pos, "foo 1234AB "); - DoNumTest("foo %.1X", pos, "foo 1234AB"); - DoNumTest("foo %.7X", pos, "foo 01234AB"); - DoNumTest("foo %07X", pos, "foo 01234AB"); - DoNumTest("foo %#X", pos, "foo 0X1234AB"); - DoNumTest("foo %+X", pos, "foo 1234AB"); - DoNumTest("foo % X", pos, "foo 1234AB"); - DoNumTest("foo %+X", neg, "foo FFFFFFD6"); - DoNumTest("foo % X", neg, "foo FFFFFFD6"); - - PAL_Terminate(); - return PASS; -} - diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test13/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf/test13/testinfo.dat deleted file mode 100644 index 634817a791..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test13/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = sprintf -Name = Positive Test for sprintf -TYPE = DEFAULT -EXE1 = test13 -Description -= Tests sprintf with hex numbers (uppercase) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test14/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf/test14/CMakeLists.txt deleted file mode 100644 index 5eae306e16..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test14/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test14.c -) - -add_executable(paltest_sprintf_test14 - ${SOURCES} -) - -add_dependencies(paltest_sprintf_test14 coreclrpal) - -target_link_libraries(paltest_sprintf_test14 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test14/test14.c b/src/pal/tests/palsuite/c_runtime/sprintf/test14/test14.c deleted file mode 100644 index 20e986a9c3..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test14/test14.c +++ /dev/null @@ -1,53 +0,0 @@ -// 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 sprintf function. Tests the lowercase -** exponential notation double specifier (%e) -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../sprintf.h" - -/* - * Depends on memcmp and strlen - */ - -int __cdecl main(int argc, char *argv[]) -{ - double val = 256.0; - double neg = -256.0; - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - - DoDoubleTest("foo %e", val, "foo 2.560000e+002", "foo 2.560000e+02"); - DoDoubleTest("foo %le", val, "foo 2.560000e+002", "foo 2.560000e+02"); - DoDoubleTest("foo %he", val, "foo 2.560000e+002", "foo 2.560000e+02"); - DoDoubleTest("foo %Le", val, "foo 2.560000e+002", "foo 2.560000e+02"); - DoDoubleTest("foo %I64e", val, "foo 2.560000e+002", "foo 2.560000e+02"); - DoDoubleTest("foo %14e", val, "foo 2.560000e+002", "foo 2.560000e+02"); - DoDoubleTest("foo %-14e", val, "foo 2.560000e+002 ", "foo 2.560000e+02 "); - DoDoubleTest("foo %.1e", val, "foo 2.6e+002", "foo 2.6e+02"); - DoDoubleTest("foo %.8e", val, "foo 2.56000000e+002", "foo 2.56000000e+02"); - DoDoubleTest("foo %014e", val, "foo 02.560000e+002", "foo 002.560000e+02"); - DoDoubleTest("foo %#e", val, "foo 2.560000e+002", "foo 2.560000e+02"); - DoDoubleTest("foo %+e", val, "foo +2.560000e+002", "foo +2.560000e+02"); - DoDoubleTest("foo % e", val, "foo 2.560000e+002", "foo 2.560000e+02"); - DoDoubleTest("foo %+e", neg, "foo -2.560000e+002", "foo -2.560000e+02"); - DoDoubleTest("foo % e", neg, "foo -2.560000e+002", "foo -2.560000e+02"); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test14/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf/test14/testinfo.dat deleted file mode 100644 index c7086efdbc..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test14/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = sprintf -Name = Positive Test for sprintf -TYPE = DEFAULT -EXE1 = test14 -Description -= Tests sprintf with exponential format doubles (lowercase) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test15/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf/test15/CMakeLists.txt deleted file mode 100644 index 1fff23fc89..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test15/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test15.c -) - -add_executable(paltest_sprintf_test15 - ${SOURCES} -) - -add_dependencies(paltest_sprintf_test15 coreclrpal) - -target_link_libraries(paltest_sprintf_test15 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test15/test15.c b/src/pal/tests/palsuite/c_runtime/sprintf/test15/test15.c deleted file mode 100644 index 34199b2eb3..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test15/test15.c +++ /dev/null @@ -1,53 +0,0 @@ -// 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: test15.c -** -** Purpose: Test #15 for the sprintf function. Tests the uppercase -** exponential notation double specifier (%E) -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../sprintf.h" - -/* - * Depends on memcmp and strlen - */ - -int __cdecl main(int argc, char *argv[]) -{ - double val = 256.0; - double neg = -256.0; - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - - DoDoubleTest("foo %E", val, "foo 2.560000E+002", "foo 2.560000E+02"); - DoDoubleTest("foo %lE", val, "foo 2.560000E+002", "foo 2.560000E+02"); - DoDoubleTest("foo %hE", val, "foo 2.560000E+002", "foo 2.560000E+02"); - DoDoubleTest("foo %LE", val, "foo 2.560000E+002", "foo 2.560000E+02"); - DoDoubleTest("foo %I64E", val, "foo 2.560000E+002", "foo 2.560000E+02"); - DoDoubleTest("foo %14E", val, "foo 2.560000E+002", "foo 2.560000E+02"); - DoDoubleTest("foo %-14E", val, "foo 2.560000E+002 ", "foo 2.560000E+02 "); - DoDoubleTest("foo %.1E", val, "foo 2.6E+002", "foo 2.6E+02"); - DoDoubleTest("foo %.8E", val, "foo 2.56000000E+002", "foo 2.56000000E+02"); - DoDoubleTest("foo %014E", val, "foo 02.560000E+002", "foo 002.560000E+02"); - DoDoubleTest("foo %#E", val, "foo 2.560000E+002", "foo 2.560000E+02"); - DoDoubleTest("foo %+E", val, "foo +2.560000E+002", "foo +2.560000E+02"); - DoDoubleTest("foo % E", val, "foo 2.560000E+002", "foo 2.560000E+02"); - DoDoubleTest("foo %+E", neg, "foo -2.560000E+002", "foo -2.560000E+02"); - DoDoubleTest("foo % E", neg, "foo -2.560000E+002", "foo -2.560000E+02"); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test15/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf/test15/testinfo.dat deleted file mode 100644 index 0a47c5321a..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test15/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = sprintf -Name = Positive Test for sprintf -TYPE = DEFAULT -EXE1 = test15 -Description -= Tests sprintf with exponential format doubles (uppercase) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test16/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf/test16/CMakeLists.txt deleted file mode 100644 index 2065c576d9..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test16/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test16.c -) - -add_executable(paltest_sprintf_test16 - ${SOURCES} -) - -add_dependencies(paltest_sprintf_test16 coreclrpal) - -target_link_libraries(paltest_sprintf_test16 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test16/test16.c b/src/pal/tests/palsuite/c_runtime/sprintf/test16/test16.c deleted file mode 100644 index c93b68bc2d..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test16/test16.c +++ /dev/null @@ -1,52 +0,0 @@ -// 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: test16.c -** -** Purpose: Test #16 for the sprintf function. Tests the decimal notation -** double specifier (%f) -** -** -**==========================================================================*/ - - -#include <palsuite.h> -#include "../sprintf.h" - -/* - * Depends on memcmp and strlen - */ - -int __cdecl main(int argc, char *argv[]) -{ - double val = 2560.001; - double neg = -2560.001; - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - - DoDoubleTest("foo %f", val, "foo 2560.001000", "foo 2560.001000"); - DoDoubleTest("foo %lf", val, "foo 2560.001000", "foo 2560.001000"); - DoDoubleTest("foo %hf", val, "foo 2560.001000", "foo 2560.001000"); - DoDoubleTest("foo %Lf", val, "foo 2560.001000", "foo 2560.001000"); - DoDoubleTest("foo %I64f", val, "foo 2560.001000", "foo 2560.001000"); - DoDoubleTest("foo %12f", val, "foo 2560.001000", "foo 2560.001000"); - DoDoubleTest("foo %-12f", val, "foo 2560.001000 ", "foo 2560.001000 "); - DoDoubleTest("foo %.1f", val, "foo 2560.0", "foo 2560.0"); - DoDoubleTest("foo %.8f", val, "foo 2560.00100000", "foo 2560.00100000"); - DoDoubleTest("foo %012f", val, "foo 02560.001000", "foo 02560.001000"); - DoDoubleTest("foo %#f", val, "foo 2560.001000", "foo 2560.001000"); - DoDoubleTest("foo %+f", val, "foo +2560.001000", "foo +2560.001000"); - DoDoubleTest("foo % f", val, "foo 2560.001000", "foo 2560.001000"); - DoDoubleTest("foo %+f", neg, "foo -2560.001000", "foo -2560.001000"); - DoDoubleTest("foo % f", neg, "foo -2560.001000", "foo -2560.001000"); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test16/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf/test16/testinfo.dat deleted file mode 100644 index e18fab1ad8..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test16/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = sprintf -Name = Positive Test for sprintf -TYPE = DEFAULT -EXE1 = test16 -Description -= Tests sprintf with decimal point format doubles diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test17/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf/test17/CMakeLists.txt deleted file mode 100644 index ce3a8ad048..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test17/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test17.c -) - -add_executable(paltest_sprintf_test17 - ${SOURCES} -) - -add_dependencies(paltest_sprintf_test17 coreclrpal) - -target_link_libraries(paltest_sprintf_test17 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test17/test17.c b/src/pal/tests/palsuite/c_runtime/sprintf/test17/test17.c deleted file mode 100644 index 643215b8f5..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test17/test17.c +++ /dev/null @@ -1,54 +0,0 @@ -// 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: test17.c -** -** Purpose: Test #17 for the sprintf function. Tests the lowercase -** shorthand notation double specifier (%g) -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../sprintf.h" - -/* - * Depends on memcmp and strlen - */ - -int __cdecl main(int argc, char *argv[]) -{ - double val = 2560.001; - double neg = -2560.001; - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - - DoDoubleTest("foo %g", val, "foo 2560", "foo 2560"); - DoDoubleTest("foo %lg", val, "foo 2560", "foo 2560"); - DoDoubleTest("foo %hg", val, "foo 2560", "foo 2560"); - DoDoubleTest("foo %Lg", val, "foo 2560", "foo 2560"); - DoDoubleTest("foo %I64g", val, "foo 2560", "foo 2560"); - DoDoubleTest("foo %5g", val, "foo 2560", "foo 2560"); - DoDoubleTest("foo %-5g", val, "foo 2560 ", "foo 2560 "); - DoDoubleTest("foo %.1g", val, "foo 3e+003", "foo 3e+03"); - DoDoubleTest("foo %.2g", val, "foo 2.6e+003", "foo 2.6e+03"); - DoDoubleTest("foo %.12g", val, "foo 2560.001", "foo 2560.001"); - DoDoubleTest("foo %06g", val, "foo 002560", "foo 002560"); - DoDoubleTest("foo %#g", val, "foo 2560.00", "foo 2560.00"); - DoDoubleTest("foo %+g", val, "foo +2560", "foo +2560"); - DoDoubleTest("foo % g", val, "foo 2560", "foo 2560"); - DoDoubleTest("foo %+g", neg, "foo -2560", "foo -2560"); - DoDoubleTest("foo % g", neg, "foo -2560", "foo -2560"); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test17/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf/test17/testinfo.dat deleted file mode 100644 index a723103e02..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test17/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = sprintf -Name = Positive Test for sprintf -TYPE = DEFAULT -EXE1 = test17 -Description -= Tests sprintf with compact format doubles (lowercase) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test18/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf/test18/CMakeLists.txt deleted file mode 100644 index 6f69e1c7c2..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test18/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test18.c -) - -add_executable(paltest_sprintf_test18 - ${SOURCES} -) - -add_dependencies(paltest_sprintf_test18 coreclrpal) - -target_link_libraries(paltest_sprintf_test18 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test18/test18.c b/src/pal/tests/palsuite/c_runtime/sprintf/test18/test18.c deleted file mode 100644 index fa88152479..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test18/test18.c +++ /dev/null @@ -1,53 +0,0 @@ -// 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: test18.c -** -** Purpose: Test #18 for the sprintf function. Tests the uppercase -** shorthand notation double specifier (%G) -** -** -**==========================================================================*/ - - -#include <palsuite.h> -#include "../sprintf.h" - -/* - * Depends on memcmp and strlen - */ - -int __cdecl main(int argc, char *argv[]) -{ - double val = 2560.001; - double neg = -2560.001; - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - - DoDoubleTest("foo %G", val, "foo 2560", "foo 2560"); - DoDoubleTest("foo %lG", val, "foo 2560", "foo 2560"); - DoDoubleTest("foo %hG", val, "foo 2560", "foo 2560"); - DoDoubleTest("foo %LG", val, "foo 2560", "foo 2560"); - DoDoubleTest("foo %I64G", val, "foo 2560", "foo 2560"); - DoDoubleTest("foo %5G", val, "foo 2560", "foo 2560"); - DoDoubleTest("foo %-5G", val, "foo 2560 ", "foo 2560 "); - DoDoubleTest("foo %.1G", val, "foo 3E+003", "foo 3E+03"); - DoDoubleTest("foo %.2G", val, "foo 2.6E+003", "foo 2.6E+03"); - DoDoubleTest("foo %.12G", val, "foo 2560.001", "foo 2560.001"); - DoDoubleTest("foo %06G", val, "foo 002560", "foo 002560"); - DoDoubleTest("foo %#G", val, "foo 2560.00", "foo 2560.00"); - DoDoubleTest("foo %+G", val, "foo +2560", "foo +2560"); - DoDoubleTest("foo % G", val, "foo 2560", "foo 2560"); - DoDoubleTest("foo %+G", neg, "foo -2560", "foo -2560"); - DoDoubleTest("foo % G", neg, "foo -2560", "foo -2560"); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test18/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf/test18/testinfo.dat deleted file mode 100644 index dfafa4bcf4..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test18/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = sprintf -Name = Positive Test for sprintf -TYPE = DEFAULT -EXE1 = test18 -Description -= Tests sprintf with compact format doubles (uppercase) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test19/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf/test19/CMakeLists.txt deleted file mode 100644 index a2917b27dc..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test19/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test19.c -) - -add_executable(paltest_sprintf_test19 - ${SOURCES} -) - -add_dependencies(paltest_sprintf_test19 coreclrpal) - -target_link_libraries(paltest_sprintf_test19 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test19/test19.c b/src/pal/tests/palsuite/c_runtime/sprintf/test19/test19.c deleted file mode 100644 index aee731cb74..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test19/test19.c +++ /dev/null @@ -1,78 +0,0 @@ -// 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: test19.c -** -** Purpose: Test #19 for the sprintf function. Tests the variable length -** precision argument. -** -** -**==========================================================================*/ - - -#include <palsuite.h> -#include "../sprintf.h" - -/* - * Depends on memcmp and strlen - */ - - -int __cdecl main(int argc, char *argv[]) -{ - int n = -1; - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - DoArgumentPrecTest("%.*s", 2, "bar", "bar", "ba", "ba"); - DoArgumentPrecTest("%.*S", 2, convert("bar"), "bar", "ba", "ba"); - - DoArgumentPrecTest("%.*n", 3, &n, "pointer to int", "", ""); - if (n != 0) - { - Fail("ERROR: Expected count parameter to resolve to %d, got %X\n", - 0, n); - } - - DoArgumentPrecTest("%.*c", 0, (void*)'a', "a", "a", "a"); - DoArgumentPrecTest("%.*c", 4, (void*)'a', "a", "a", "a"); - DoArgumentPrecTest("%.*C", 0, (void*)'a', "a", "a", "a"); - DoArgumentPrecTest("%.*C", 4, (void*)'a', "a", "a", "a"); - DoArgumentPrecTest("%.*d", 1, (void*)42, "42", "42", "42"); - DoArgumentPrecTest("%.*d", 3, (void*)42, "42", "042", "042"); - DoArgumentPrecTest("%.*i", 1, (void*)42, "42", "42", "42"); - DoArgumentPrecTest("%.*i", 3, (void*)42, "42", "042", "042"); - DoArgumentPrecTest("%.*o", 1, (void*)42, "42", "52", "52"); - DoArgumentPrecTest("%.*o", 3, (void*)42, "42", "052", "052"); - DoArgumentPrecTest("%.*u", 1, (void*)42, "42", "42", "42"); - DoArgumentPrecTest("%.*u", 3, (void*)42, "42", "042", "042"); - DoArgumentPrecTest("%.*x", 1, (void*)0x42, "0x42", "42", "42"); - DoArgumentPrecTest("%.*x", 3, (void*)0x42, "0x42", "042", "042"); - DoArgumentPrecTest("%.*X", 1, (void*)0x42, "0x42", "42", "42"); - DoArgumentPrecTest("%.*X", 3, (void*)0x42, "0x42", "042", "042"); - - - DoArgumentPrecDoubleTest("%.*e", 1, 2.01, "2.0e+000", "2.0e+00"); - DoArgumentPrecDoubleTest("%.*e", 3, 2.01, "2.010e+000", "2.010e+00"); - DoArgumentPrecDoubleTest("%.*E", 1, 2.01, "2.0E+000", "2.0E+00"); - DoArgumentPrecDoubleTest("%.*E", 3, 2.01, "2.010E+000", "2.010E+00"); - DoArgumentPrecDoubleTest("%.*f", 1, 2.01, "2.0", "2.0"); - DoArgumentPrecDoubleTest("%.*f", 3, 2.01, "2.010", "2.010"); - DoArgumentPrecDoubleTest("%.*g", 1, 256.01, "3e+002", "3e+02"); - DoArgumentPrecDoubleTest("%.*g", 3, 256.01, "256", "256"); - DoArgumentPrecDoubleTest("%.*g", 4, 256.01, "256", "256"); - DoArgumentPrecDoubleTest("%.*g", 6, 256.01, "256.01", "256.01"); - DoArgumentPrecDoubleTest("%.*G", 1, 256.01, "3E+002", "3E+02"); - DoArgumentPrecDoubleTest("%.*G", 3, 256.01, "256", "256"); - DoArgumentPrecDoubleTest("%.*G", 4, 256.01, "256", "256"); - DoArgumentPrecDoubleTest("%.*G", 6, 256.01, "256.01", "256.01"); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test19/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf/test19/testinfo.dat deleted file mode 100644 index ebd13025f6..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test19/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = sprintf -Name = Positive Test for sprintf -TYPE = DEFAULT -EXE1 = test19 -Description -= Tests sprintf with argument specified precision diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf/test2/CMakeLists.txt deleted file mode 100644 index 8af1c53a30..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test2/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test2.c -) - -add_executable(paltest_sprintf_test2 - ${SOURCES} -) - -add_dependencies(paltest_sprintf_test2 coreclrpal) - -target_link_libraries(paltest_sprintf_test2 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test2/test2.c b/src/pal/tests/palsuite/c_runtime/sprintf/test2/test2.c deleted file mode 100644 index d50679a5a3..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test2/test2.c +++ /dev/null @@ -1,47 +0,0 @@ -// 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: test2.c -** -** Purpose: Test #2 for the sprintf function. Tests the string specifier -** (%s). -** -** -**==========================================================================*/ - - -#include <palsuite.h> -#include "../sprintf.h" - -/* - * Depends on memcmp and strlen - */ - -int __cdecl main(int argc, char *argv[]) -{ - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - - DoStrTest("foo %s", "bar", "foo bar"); - DoStrTest("foo %hs", "bar", "foo bar"); - DoWStrTest("foo %ls", convert("bar"), "foo bar"); - DoWStrTest("foo %ws", convert("bar"), "foo bar"); - DoStrTest("foo %Ls", "bar", "foo bar"); - DoStrTest("foo %I64s", "bar", "foo bar"); - DoStrTest("foo %5s", "bar", "foo bar"); - DoStrTest("foo %.2s", "bar", "foo ba"); - DoStrTest("foo %5.2s", "bar", "foo ba"); - DoStrTest("foo %-5s", "bar", "foo bar "); - DoStrTest("foo %05s", "bar", "foo 00bar"); - - PAL_Terminate(); - return PASS; -} - diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf/test2/testinfo.dat deleted file mode 100644 index e8d0f53ff3..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test2/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = sprintf -Name = Positive Test for sprintf -TYPE = DEFAULT -EXE1 = test2 -Description -= Tests sprintf with strings diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf/test3/CMakeLists.txt deleted file mode 100644 index b7b7e0a579..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test3/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test3.c -) - -add_executable(paltest_sprintf_test3 - ${SOURCES} -) - -add_dependencies(paltest_sprintf_test3 coreclrpal) - -target_link_libraries(paltest_sprintf_test3 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test3/test3.c b/src/pal/tests/palsuite/c_runtime/sprintf/test3/test3.c deleted file mode 100644 index ae52dbed08..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test3/test3.c +++ /dev/null @@ -1,47 +0,0 @@ -// 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: test3.c -** -** Purpose: Test #3 for the sprintf function. Tests the wide string -** specifier (%S). -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../sprintf.h" - -/* - * Depends on memcmp and strlen - */ - -int __cdecl main(int argc, char *argv[]) -{ - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - DoWStrTest("foo %S", convert("bar"), "foo bar"); - DoStrTest("foo %hS", "bar", "foo bar"); - DoWStrTest("foo %lS", convert("bar"), "foo bar"); - DoWStrTest("foo %wS", convert("bar"), "foo bar"); - DoWStrTest("foo %LS", convert("bar"), "foo bar"); - DoWStrTest("foo %I64S", convert("bar"), "foo bar"); - DoWStrTest("foo %5S", convert("bar"), "foo bar"); - DoWStrTest("foo %.2S", convert("bar"), "foo ba"); - DoWStrTest("foo %5.2S", convert("bar"), "foo ba"); - DoWStrTest("foo %-5S", convert("bar"), "foo bar "); - DoWStrTest("foo %05S", convert("bar"), "foo 00bar"); - - PAL_Terminate(); - return PASS; -} - - diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test3/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf/test3/testinfo.dat deleted file mode 100644 index 12e0a9cfb0..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test3/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = sprintf -Name = Positive Test for sprintf -TYPE = DEFAULT -EXE1 = test3 -Description -= Tests sprintf with wide strings diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test4/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf/test4/CMakeLists.txt deleted file mode 100644 index 3478867b7c..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test4/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test4.c -) - -add_executable(paltest_sprintf_test4 - ${SOURCES} -) - -add_dependencies(paltest_sprintf_test4 coreclrpal) - -target_link_libraries(paltest_sprintf_test4 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test4/test4.c b/src/pal/tests/palsuite/c_runtime/sprintf/test4/test4.c deleted file mode 100644 index 9660ffaa3a..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test4/test4.c +++ /dev/null @@ -1,69 +0,0 @@ -// 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: test4.c -** -** Purpose: Test #4 for the sprintf function. Tests the pointer -** specifier (%p). -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../sprintf.h" -/* - * Depends on memcmp and strlen - */ - -int __cdecl main(int argc, char *argv[]) -{ - void *ptr = (void*) 0x123456; - INT64 lptr = I64(0x1234567887654321); - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - -/* -** Run only on 64 bit platforms -*/ -#if defined(BIT64) && defined(PLATFORM_UNIX) - Trace("Testing for 64 Bit Platforms \n"); - DoPointerTest("%p", NULL, "NULL", "0000000000000000"); - DoPointerTest("%p", ptr, "pointer to 0x123456", "0000000000123456"); - DoPointerTest("%17p", ptr, "pointer to 0x123456", " 0000000000123456"); - DoPointerTest("%17p", ptr, "pointer to 0x123456", " 0000000000123456"); - DoPointerTest("%-17p", ptr, "pointer to 0x123456", "0000000000123456 "); - DoPointerTest("%+p", ptr, "pointer to 0x123456", "0000000000123456"); - DoPointerTest("%#p", ptr, "pointer to 0x123456", "0X0000000000123456"); - DoPointerTest("%lp", ptr, "pointer to 0x123456", "00123456"); - DoPointerTest("%hp", ptr, "pointer to 0x123456", "00003456"); - DoPointerTest("%Lp", ptr, "pointer to 0x123456", "00123456"); - DoI64Test("%I64p", lptr, "pointer to 0x1234567887654321", - "1234567887654321"); -#else - Trace("Testing for Non 64 Bit Platforms \n"); - DoPointerTest("%p", NULL, "NULL", "00000000"); - DoPointerTest("%p", ptr, "pointer to 0x123456", "00123456"); - DoPointerTest("%9p", ptr, "pointer to 0x123456", " 00123456"); - DoPointerTest("%09p", ptr, "pointer to 0x123456", " 00123456"); - DoPointerTest("%-9p", ptr, "pointer to 0x123456", "00123456 "); - DoPointerTest("%+p", ptr, "pointer to 0x123456", "00123456"); - DoPointerTest("%#p", ptr, "pointer to 0x123456", "0X00123456"); - DoPointerTest("%lp", ptr, "pointer to 0x123456", "00123456"); - DoPointerTest("%hp", ptr, "pointer to 0x123456", "00003456"); - DoPointerTest("%Lp", ptr, "pointer to 0x123456", "00123456"); - DoI64Test("%I64p", lptr, "pointer to 0x1234567887654321", - "1234567887654321"); -#endif - - PAL_Terminate(); - return PASS; -} - diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test4/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf/test4/testinfo.dat deleted file mode 100644 index bf7236dc32..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test4/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = sprintf -Name = Positive Test for sprintf -TYPE = DEFAULT -EXE1 = test4 -Description -= Tests sprintf with pointers diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test5/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf/test5/CMakeLists.txt deleted file mode 100644 index dfa7583766..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test5/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test5.c -) - -add_executable(paltest_sprintf_test5 - ${SOURCES} -) - -add_dependencies(paltest_sprintf_test5 coreclrpal) - -target_link_libraries(paltest_sprintf_test5 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test5/test5.c b/src/pal/tests/palsuite/c_runtime/sprintf/test5/test5.c deleted file mode 100644 index 1b52da77b6..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test5/test5.c +++ /dev/null @@ -1,62 +0,0 @@ -// 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: test5.c -** -** Purpose: Test #5 for the sprintf function. Tests the count specifier (%n). -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../sprintf.h" - -/* - * Depends on memcmp and strlen - */ - - -int __cdecl main(int argc, char *argv[]) -{ - char *longStr = - "really-long-string-that-just-keeps-going-on-and-on-and-on.." - "..................useless-filler.................................." - "..................useless-filler.................................." - "..................useless-filler.................................." - "%n bar"; - char *longResult = - "really-long-string-that-just-keeps-going-on-and-on-and-on.." - "..................useless-filler.................................." - "..................useless-filler.................................." - "..................useless-filler.................................." - " bar"; - - if (PAL_Initialize(argc, argv)!= 0) - { - return FAIL; - } - - DoCountTest("foo %n bar", 4, "foo bar"); - DoCountTest(longStr, 257, longResult); - DoCountTest("fo%n bar", 2, "fo bar"); - DoCountTest("%n", 0, ""); - DoCountTest("foo %#n bar", 4, "foo bar"); - DoCountTest("foo % n bar", 4, "foo bar"); - DoCountTest("foo %+n bar", 4, "foo bar"); - DoCountTest("foo %-n bar", 4, "foo bar"); - DoCountTest("foo %0n bar", 4, "foo bar"); - DoShortCountTest("foo %hn bar", 4, "foo bar"); - DoCountTest("foo %ln bar", 4, "foo bar"); - DoCountTest("foo %Ln bar", 4, "foo bar"); - DoCountTest("foo %I64n bar", 4, "foo bar"); - DoCountTest("foo %20.3n bar", 4, "foo bar"); - - PAL_Terminate(); - - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test5/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf/test5/testinfo.dat deleted file mode 100644 index 31e0537bd0..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test5/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = sprintf -Name = Positive Test for sprintf -TYPE = DEFAULT -EXE1 = test5 -Description -= Tests sprintf with the count specifier diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test6/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf/test6/CMakeLists.txt deleted file mode 100644 index 7a9a5fc856..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test6/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test6.c -) - -add_executable(paltest_sprintf_test6 - ${SOURCES} -) - -add_dependencies(paltest_sprintf_test6 coreclrpal) - -target_link_libraries(paltest_sprintf_test6 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test6/test6.c b/src/pal/tests/palsuite/c_runtime/sprintf/test6/test6.c deleted file mode 100644 index c14e075475..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test6/test6.c +++ /dev/null @@ -1,50 +0,0 @@ -// 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: test6.c -** -** Purpose: Test #6 for the sprintf function. Tests the char specifier (%c). -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../sprintf.h" - -/* - * Depends on memcmp and strlen - */ - -int __cdecl main(int argc, char *argv[]) -{ - WCHAR wc = (WCHAR) 'c'; - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - - DoCharTest("foo %c", 'b', "foo b"); - DoCharTest("foo %hc", 'b', "foo b"); - DoWCharTest("foo %lc", wc, "foo c"); - DoCharTest("foo %Lc", 'b', "foo b"); - DoCharTest("foo %I64c", 'b', "foo b"); - DoCharTest("foo %5c", 'b', "foo b"); - DoCharTest("foo %.0c", 'b', "foo b"); - DoCharTest("foo %-5c", 'b', "foo b "); - DoCharTest("foo %05c", 'b', "foo 0000b"); - DoCharTest("foo % c", 'b', "foo b"); - DoCharTest("foo %#c", 'b', "foo b"); - - PAL_Terminate(); - return PASS; -} - - - diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test6/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf/test6/testinfo.dat deleted file mode 100644 index 037e4106ff..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test6/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = sprintf -Name = Positive Test for sprintf -TYPE = DEFAULT -EXE1 = test6 -Description -= Tests sprintf with characters diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test7/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf/test7/CMakeLists.txt deleted file mode 100644 index a539a59ab9..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test7/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test7.c -) - -add_executable(paltest_sprintf_test7 - ${SOURCES} -) - -add_dependencies(paltest_sprintf_test7 coreclrpal) - -target_link_libraries(paltest_sprintf_test7 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test7/test7.c b/src/pal/tests/palsuite/c_runtime/sprintf/test7/test7.c deleted file mode 100644 index 082bd20e6d..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test7/test7.c +++ /dev/null @@ -1,49 +0,0 @@ -// 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: test7.c -** -** Purpose: Test #7 for the sprintf function. Tests the wide char -** specifier (%C). -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../sprintf.h" - -/* - * Depends on memcmp and strlen - */ - -int __cdecl main(int argc, char *argv[]) -{ - WCHAR wb = (WCHAR) 'b'; - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - - DoWCharTest("foo %C", wb, "foo b"); - DoWCharTest("foo %hC", wb, "foo b"); - DoCharTest("foo %lC", 'c', "foo c"); - DoWCharTest("foo %LC", wb, "foo b"); - DoWCharTest("foo %I64C", wb, "foo b"); - DoWCharTest("foo %5C", wb, "foo b"); - DoWCharTest("foo %.0C", wb, "foo b"); - DoWCharTest("foo %-5C", wb, "foo b "); - DoWCharTest("foo %05C", wb, "foo 0000b"); - DoWCharTest("foo % C", wb, "foo b"); - DoWCharTest("foo %#C", wb, "foo b"); - - PAL_Terminate(); - return PASS; -} - diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test7/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf/test7/testinfo.dat deleted file mode 100644 index a2730bc97c..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test7/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = sprintf -Name = Positive Test for sprintf -TYPE = DEFAULT -EXE1 = test7 -Description -= Tests sprintf with wide characters diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test8/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf/test8/CMakeLists.txt deleted file mode 100644 index 7a92c5072a..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test8/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test8.c -) - -add_executable(paltest_sprintf_test8 - ${SOURCES} -) - -add_dependencies(paltest_sprintf_test8 coreclrpal) - -target_link_libraries(paltest_sprintf_test8 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test8/test8.c b/src/pal/tests/palsuite/c_runtime/sprintf/test8/test8.c deleted file mode 100644 index 9587c82c94..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test8/test8.c +++ /dev/null @@ -1,55 +0,0 @@ -// 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: test8.c -** -** Purpose: Test #8 for the sprintf function. Tests the decimal -** specifier (%d). -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../sprintf.h" - -/* - * Depends on memcmp and strlen - */ - -int __cdecl main(int argc, char *argv[]) -{ - int neg = -42; - int pos = 42; - INT64 l = 42; - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - - DoNumTest("foo %d", pos, "foo 42"); - DoNumTest("foo %ld", 0xFFFF, "foo 65535"); - DoNumTest("foo %hd", 0xFFFF, "foo -1"); - DoNumTest("foo %Ld", pos, "foo 42"); - DoI64Test("foo %I64d", l, "42", "foo 42"); - DoNumTest("foo %3d", pos, "foo 42"); - DoNumTest("foo %-3d", pos, "foo 42 "); - DoNumTest("foo %.1d", pos, "foo 42"); - DoNumTest("foo %.3d", pos, "foo 042"); - DoNumTest("foo %03d", pos, "foo 042"); - DoNumTest("foo %#d", pos, "foo 42"); - DoNumTest("foo %+d", pos, "foo +42"); - DoNumTest("foo % d", pos, "foo 42"); - DoNumTest("foo %+d", neg, "foo -42"); - DoNumTest("foo % d", neg, "foo -42"); - - PAL_Terminate(); - return PASS; -} - diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test8/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf/test8/testinfo.dat deleted file mode 100644 index adc0b66f06..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test8/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = sprintf -Name = Positive Test for sprintf -TYPE = DEFAULT -EXE1 = test8 -Description -= Tests sprintf with decimal numbers diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test9/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf/test9/CMakeLists.txt deleted file mode 100644 index 2a91658bd4..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test9/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test9.c -) - -add_executable(paltest_sprintf_test9 - ${SOURCES} -) - -add_dependencies(paltest_sprintf_test9 coreclrpal) - -target_link_libraries(paltest_sprintf_test9 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test9/test9.c b/src/pal/tests/palsuite/c_runtime/sprintf/test9/test9.c deleted file mode 100644 index 98f5db6ec1..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test9/test9.c +++ /dev/null @@ -1,55 +0,0 @@ -// 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: test9.c -** -** Purpose: Test #9 for the sprintf function. Tests the integer -** specifier (%i). -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../sprintf.h" - -/* - * Depends on memcmp and strlen - */ - -int __cdecl main(int argc, char *argv[]) -{ - int neg = -42; - int pos = 42; - INT64 l = 42; - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - - DoNumTest("foo %i", pos, "foo 42"); - DoNumTest("foo %li", 0xFFFF, "foo 65535"); - DoNumTest("foo %hi", 0xFFFF, "foo -1"); - DoNumTest("foo %Li", pos, "foo 42"); - DoI64Test("foo %I64i", l, "42", "foo 42"); - DoNumTest("foo %3i", pos, "foo 42"); - DoNumTest("foo %-3i", pos, "foo 42 "); - DoNumTest("foo %.1i", pos, "foo 42"); - DoNumTest("foo %.3i", pos, "foo 042"); - DoNumTest("foo %03i", pos, "foo 042"); - DoNumTest("foo %#i", pos, "foo 42"); - DoNumTest("foo %+i", pos, "foo +42"); - DoNumTest("foo % i", pos, "foo 42"); - DoNumTest("foo %+i", neg, "foo -42"); - DoNumTest("foo % i", neg, "foo -42"); - - PAL_Terminate(); - return PASS; -} - diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test9/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf/test9/testinfo.dat deleted file mode 100644 index e569e789cd..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test9/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = sprintf -Name = Positive Test for sprintf -TYPE = DEFAULT -EXE1 = test9 -Description -= Tests sprintf with integer numbers diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf_s/CMakeLists.txt new file mode 100644 index 0000000000..8fe1cb60ac --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/CMakeLists.txt @@ -0,0 +1,21 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +add_subdirectory(test1) +add_subdirectory(test10) +add_subdirectory(test11) +add_subdirectory(test12) +add_subdirectory(test13) +add_subdirectory(test14) +add_subdirectory(test15) +add_subdirectory(test16) +add_subdirectory(test17) +add_subdirectory(test18) +add_subdirectory(test19) +add_subdirectory(test2) +add_subdirectory(test3) +add_subdirectory(test4) +add_subdirectory(test6) +add_subdirectory(test7) +add_subdirectory(test8) +add_subdirectory(test9) + diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/sprintf_s.h b/src/pal/tests/palsuite/c_runtime/sprintf_s/sprintf_s.h new file mode 100644 index 0000000000..129b9db727 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/sprintf_s.h @@ -0,0 +1,195 @@ +// 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: sprintf_s.h +** +** Purpose: Containts common testing functions for sprintf_s +** +** +**==========================================================================*/ + +#ifndef __SPRINTF_S_H__ +#define __SPRINTF_S_H__ + +void DoStrTest(const char *formatstr, char* param, const char *checkstr) +{ + char buf[256] = { 0 }; + + sprintf_s(buf, _countof(buf), formatstr, param); + if (memcmp(buf, checkstr, strlen(checkstr) + 1) != 0) + { + Fail("ERROR: failed to insert string \"%s\" into \"%s\"\n" + "Expected \"%s\" got \"%s\".\n", + param, formatstr, checkstr, buf); + } +} + +void DoWStrTest(const char *formatstr, WCHAR* param, const char *checkstr) +{ + char buf[256] = { 0 }; + + sprintf_s(buf, _countof(buf), formatstr, param); + if (memcmp(buf, checkstr, strlen(checkstr) + 1) != 0) + { + Fail("ERROR: failed to insert wide string \"%s\" into \"%s\"\n" + "Expected \"%s\" got \"%s\".\n", + convertC(param), formatstr, checkstr, buf); + } +} + +void DoPointerTest(const char *formatstr, void* param, char* paramstr, + const char *checkstr1) +{ + char buf[256] = { 0 }; + + sprintf_s(buf, _countof(buf), formatstr, param); + if (memcmp(buf, checkstr1, strlen(checkstr1) + 1) != 0) + { + Fail("ERROR: failed to insert %s into \"%s\"\n" + "Expected \"%s\" got \"%s\".\n", + paramstr, formatstr, checkstr1, buf); + } +} + +void DoCountTest(const char *formatstr, int param, const char *checkstr) +{ + char buf[512] = { 0 }; + int n = -1; + + sprintf_s(buf, _countof(buf), formatstr, &n); + + if (n != param) + { + Fail("ERROR: Expected count parameter to resolve to %d, got %X\n", + param, n); + } + if (memcmp(buf, checkstr, strlen(checkstr) + 1) != 0) + { + Fail("ERROR: Expected \"%s\" got \"%s\".\n", checkstr, buf); + } +} + +void DoShortCountTest(const char *formatstr, int param, const char *checkstr) +{ + char buf[256] = { 0 }; + short int n = -1; + + sprintf_s(buf, _countof(buf), formatstr, &n); + + if (n != param) + { + Fail("ERROR: Expected count parameter to resolve to %d, got %X\n", + param, n); + } + if (memcmp(buf, checkstr, strlen(checkstr) + 1) != 0) + { + Fail("ERROR: Expected \"%s\" got \"%s\".\n", checkstr, buf); + } +} + + +void DoCharTest(const char *formatstr, char param, const char *checkstr) +{ + char buf[256] = { 0 }; + + sprintf_s(buf, _countof(buf), formatstr, param); + if (memcmp(buf, checkstr, strlen(checkstr) + 1) != 0) + { + Fail("ERROR: failed to insert char \'%c\' (%d) into \"%s\"\n" + "Expected \"%s\" got \"%s\".\n", + param, param, formatstr, checkstr, buf); + } +} + +void DoWCharTest(const char *formatstr, WCHAR param, const char *checkstr) +{ + char buf[256] = { 0 }; + + sprintf_s(buf, _countof(buf), formatstr, param); + if (memcmp(buf, checkstr, strlen(checkstr) + 1) != 0) + { + Fail("ERROR: failed to insert wide char \'%c\' (%d) into \"%s\"\n" + "Expected \"%s\" got \"%s\".\n", + (char)param, param, formatstr, checkstr, buf); + } +} + +void DoNumTest(const char *formatstr, int value, const char *checkstr) +{ + char buf[256] = { 0 }; + + sprintf_s(buf, _countof(buf), formatstr, value); + if (memcmp(buf, checkstr, strlen(checkstr) + 1) != 0) + { + Fail("ERROR: failed to insert %#x into \"%s\"\n" + "Expected \"%s\" got \"%s\".\n", + value, formatstr, checkstr, buf); + } +} + +void DoI64Test(const char *formatstr, INT64 value, char *valuestr, const char *checkstr1) +{ + char buf[256] = { 0 }; + + sprintf_s(buf, _countof(buf), formatstr, value); + if (memcmp(buf, checkstr1, strlen(checkstr1) + 1) != 0) + { + Fail("ERROR: failed to insert %s into \"%s\"\n" + "Expected \"%s\", got \"%s\".\n", + valuestr, formatstr, checkstr1, buf); + } +} + +void DoDoubleTest(const char *formatstr, double value, const char *checkstr1, + const char *checkstr2) +{ + char buf[256] = { 0 }; + + sprintf_s(buf, _countof(buf), formatstr, value); + if (memcmp(buf, checkstr1, strlen(checkstr1) + 1) != 0 && + memcmp(buf, checkstr2, strlen(checkstr2) + 1) != 0) + { + Fail("ERROR: failed to insert %f into \"%s\"\n" + "Expected \"%s\" or \"%s\", got \"%s\".\n", + value, formatstr, checkstr1, checkstr2, buf); + } +} + +void DoArgumentPrecTest(const char *formatstr, int precision, void *param, + char *paramstr, const char *checkstr1, const char *checkstr2) +{ + char buf[256]; + + sprintf_s(buf, _countof(buf), formatstr, precision, param); + if (memcmp(buf, checkstr1, strlen(checkstr1) + 1) != 0 && + memcmp(buf, checkstr2, strlen(checkstr2) + 1) != 0) + { + Fail("ERROR: failed to insert %s into \"%s\" with precision %d\n" + "Expected \"%s\" or \"%s\", got \"%s\".\n", paramstr, formatstr, + precision, checkstr1, checkstr2, buf); + } + +} + +void DoArgumentPrecDoubleTest(const char *formatstr, int precision, double param, + const char *checkstr1, const char *checkstr2) +{ + char buf[256]; + + sprintf_s(buf, _countof(buf), formatstr, precision, param); + if (memcmp(buf, checkstr1, strlen(checkstr1) + 1) != 0 && + memcmp(buf, checkstr2, strlen(checkstr2) + 1) != 0) + { + Fail("ERROR: failed to insert %f into \"%s\" with precision %d\n" + "Expected \"%s\" or \"%s\", got \"%s\".\n", param, formatstr, + precision, checkstr1, checkstr2, buf); + } + +} + +#endif + + diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf_s/test1/CMakeLists.txt new file mode 100644 index 0000000000..ee0d90fe7f --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test1/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test1.cpp +) + +add_executable(paltest_sprintf_test1 + ${SOURCES} +) + +add_dependencies(paltest_sprintf_test1 coreclrpal) + +target_link_libraries(paltest_sprintf_test1 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test1/test1.cpp b/src/pal/tests/palsuite/c_runtime/sprintf_s/test1/test1.cpp new file mode 100644 index 0000000000..a289c07716 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test1/test1.cpp @@ -0,0 +1,45 @@ +// 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: test1.c +** +** Purpose: Test #1 for the sprintf_s function. A single, basic, test +** case with no formatting. +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../sprintf_s.h" + +/* + * Depends on memcmp and strlen + */ + +int __cdecl main(int argc, char *argv[]) +{ + char checkstr[] = "hello world"; + char buf[256]; + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + + sprintf_s(buf, _countof(buf), "hello world"); + + if (memcmp(checkstr, buf, strlen(checkstr)+1) != 0) + { + Fail("ERROR: expected %s, got %s\n", checkstr, buf); + } + + PAL_Terminate(); + return PASS; +} + diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf_s/test1/testinfo.dat new file mode 100644 index 0000000000..255c534cdf --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test1/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sprintf_s +Name = Positive Test for sprintf_s +TYPE = DEFAULT +EXE1 = test1 +Description += General test to see if sprintf_s works correctly diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test10/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf_s/test10/CMakeLists.txt new file mode 100644 index 0000000000..1efad19dee --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test10/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test10.cpp +) + +add_executable(paltest_sprintf_test10 + ${SOURCES} +) + +add_dependencies(paltest_sprintf_test10 coreclrpal) + +target_link_libraries(paltest_sprintf_test10 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test10/test10.cpp b/src/pal/tests/palsuite/c_runtime/sprintf_s/test10/test10.cpp new file mode 100644 index 0000000000..bbda15a331 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test10/test10.cpp @@ -0,0 +1,55 @@ +// 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: test10.c +** +** Purpose: Test #10 for the sprintf_s function. Tests the octal specifier +** (%o). +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../sprintf_s.h" + +/* + * Depends on memcmp and strlen + */ + +int __cdecl main(int argc, char *argv[]) +{ + int neg = -42; + int pos = 42; + INT64 l = 42; + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + + DoNumTest("foo %o", pos, "foo 52"); + DoNumTest("foo %lo", 0xFFFF, "foo 177777"); + DoNumTest("foo %ho", 0xFFFF, "foo 177777"); + DoNumTest("foo %Lo", pos, "foo 52"); + DoI64Test("foo %I64o", l, "42", "foo 52"); + DoNumTest("foo %3o", pos, "foo 52"); + DoNumTest("foo %-3o", pos, "foo 52 "); + DoNumTest("foo %.1o", pos, "foo 52"); + DoNumTest("foo %.3o", pos, "foo 052"); + DoNumTest("foo %03o", pos, "foo 052"); + DoNumTest("foo %#o", pos, "foo 052"); + DoNumTest("foo %+o", pos, "foo 52"); + DoNumTest("foo % o", pos, "foo 52"); + DoNumTest("foo %+o", neg, "foo 37777777726"); + DoNumTest("foo % o", neg, "foo 37777777726"); + + PAL_Terminate(); + return PASS; +} + diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test10/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf_s/test10/testinfo.dat new file mode 100644 index 0000000000..25ed554ea3 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test10/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sprintf_s +Name = Positive Test for sprintf_s +TYPE = DEFAULT +EXE1 = test10 +Description += Tests sprintf_s with octal numbers diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test11/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf_s/test11/CMakeLists.txt new file mode 100644 index 0000000000..f2f4da694c --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test11/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test11.cpp +) + +add_executable(paltest_sprintf_test11 + ${SOURCES} +) + +add_dependencies(paltest_sprintf_test11 coreclrpal) + +target_link_libraries(paltest_sprintf_test11 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test11/test11.cpp b/src/pal/tests/palsuite/c_runtime/sprintf_s/test11/test11.cpp new file mode 100644 index 0000000000..7f4fca9f32 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test11/test11.cpp @@ -0,0 +1,55 @@ +// 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: test11.c +** +** Purpose: Test #11 for the sprintf_s function. Test the unsigned int +** specifier (%u). +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../sprintf_s.h" + +/* + * Depends on memcmp and strlen + */ + +int __cdecl main(int argc, char *argv[]) +{ + int neg = -42; + int pos = 42; + INT64 l = 42; + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + + DoNumTest("foo %u", pos, "foo 42"); + DoNumTest("foo %lu", 0xFFFF, "foo 65535"); + DoNumTest("foo %hu", 0xFFFF, "foo 65535"); + DoNumTest("foo %Lu", pos, "foo 42"); + DoI64Test("foo %I64u", l, "42", "foo 42"); + DoNumTest("foo %3u", pos, "foo 42"); + DoNumTest("foo %-3u", pos, "foo 42 "); + DoNumTest("foo %.1u", pos, "foo 42"); + DoNumTest("foo %.3u", pos, "foo 042"); + DoNumTest("foo %03u", pos, "foo 042"); + DoNumTest("foo %#u", pos, "foo 42"); + DoNumTest("foo %+u", pos, "foo 42"); + DoNumTest("foo % u", pos, "foo 42"); + DoNumTest("foo %+u", neg, "foo 4294967254"); + DoNumTest("foo % u", neg, "foo 4294967254"); + + PAL_Terminate(); + return PASS; +} + diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test11/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf_s/test11/testinfo.dat new file mode 100644 index 0000000000..3144f1290e --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test11/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sprintf_s +Name = Positive Test for sprintf_s +TYPE = DEFAULT +EXE1 = test11 +Description += Tests sprintf_s with unsigned numbers diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test12/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf_s/test12/CMakeLists.txt new file mode 100644 index 0000000000..361e91f9ae --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test12/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test12.cpp +) + +add_executable(paltest_sprintf_test12 + ${SOURCES} +) + +add_dependencies(paltest_sprintf_test12 coreclrpal) + +target_link_libraries(paltest_sprintf_test12 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test12/test12.cpp b/src/pal/tests/palsuite/c_runtime/sprintf_s/test12/test12.cpp new file mode 100644 index 0000000000..759a41105b --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test12/test12.cpp @@ -0,0 +1,56 @@ +// 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: test12.c +** +** Purpose: Test #12 for the sprintf_s function. Tests the (lowercase) +** hexadecimal specifier (%x) +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../sprintf_s.h" + +/* + * Depends on memcmp and strlen + */ + +int __cdecl main(int argc, char *argv[]) +{ + int neg = -42; + int pos = 0x1234ab; + INT64 l = I64(0x1234567887654321); + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + + DoNumTest("foo %x", pos, "foo 1234ab"); + DoNumTest("foo %lx", pos, "foo 1234ab"); + DoNumTest("foo %hx", pos, "foo 34ab"); + DoNumTest("foo %Lx", pos, "foo 1234ab"); + DoI64Test("foo %I64x", l, "0x1234567887654321", + "foo 1234567887654321"); + DoNumTest("foo %7x", pos, "foo 1234ab"); + DoNumTest("foo %-7x", pos, "foo 1234ab "); + DoNumTest("foo %.1x", pos, "foo 1234ab"); + DoNumTest("foo %.7x", pos, "foo 01234ab"); + DoNumTest("foo %07x", pos, "foo 01234ab"); + DoNumTest("foo %#x", pos, "foo 0x1234ab"); + DoNumTest("foo %+x", pos, "foo 1234ab"); + DoNumTest("foo % x", pos, "foo 1234ab"); + DoNumTest("foo %+x", neg, "foo ffffffd6"); + DoNumTest("foo % x", neg, "foo ffffffd6"); + + PAL_Terminate(); + return PASS; +} + diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test12/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf_s/test12/testinfo.dat new file mode 100644 index 0000000000..ed91cecc46 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test12/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sprintf_s +Name = Positive Test for sprintf_s +TYPE = DEFAULT +EXE1 = test12 +Description += Tests sprintf_s with hex numbers (lowercase) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test13/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf_s/test13/CMakeLists.txt new file mode 100644 index 0000000000..d08e13b2ba --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test13/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test13.cpp +) + +add_executable(paltest_sprintf_test13 + ${SOURCES} +) + +add_dependencies(paltest_sprintf_test13 coreclrpal) + +target_link_libraries(paltest_sprintf_test13 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test13/test13.cpp b/src/pal/tests/palsuite/c_runtime/sprintf_s/test13/test13.cpp new file mode 100644 index 0000000000..76250d058c --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test13/test13.cpp @@ -0,0 +1,56 @@ +// 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: test13.c +** +** Purpose: Test #13 for the sprintf_s function. Tests the (uppercase) +** hexadecimal specifier (%X) +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../sprintf_s.h" + +/* + * Depends on memcmp and strlen + */ + +int __cdecl main(int argc, char *argv[]) +{ + int neg = -42; + int pos = 0x1234AB; + INT64 l = I64(0x1234567887654321); + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + + DoNumTest("foo %X", pos, "foo 1234AB"); + DoNumTest("foo %lX", pos, "foo 1234AB"); + DoNumTest("foo %hX", pos, "foo 34AB"); + DoNumTest("foo %LX", pos, "foo 1234AB"); + DoI64Test("foo %I64X", l, "0x1234567887654321", + "foo 1234567887654321"); + DoNumTest("foo %7X", pos, "foo 1234AB"); + DoNumTest("foo %-7X", pos, "foo 1234AB "); + DoNumTest("foo %.1X", pos, "foo 1234AB"); + DoNumTest("foo %.7X", pos, "foo 01234AB"); + DoNumTest("foo %07X", pos, "foo 01234AB"); + DoNumTest("foo %#X", pos, "foo 0X1234AB"); + DoNumTest("foo %+X", pos, "foo 1234AB"); + DoNumTest("foo % X", pos, "foo 1234AB"); + DoNumTest("foo %+X", neg, "foo FFFFFFD6"); + DoNumTest("foo % X", neg, "foo FFFFFFD6"); + + PAL_Terminate(); + return PASS; +} + diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test13/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf_s/test13/testinfo.dat new file mode 100644 index 0000000000..fd5f53017c --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test13/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sprintf_s +Name = Positive Test for sprintf_s +TYPE = DEFAULT +EXE1 = test13 +Description += Tests sprintf_s with hex numbers (uppercase) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test14/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf_s/test14/CMakeLists.txt new file mode 100644 index 0000000000..60ac2922d7 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_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_sprintf_test14 + ${SOURCES} +) + +add_dependencies(paltest_sprintf_test14 coreclrpal) + +target_link_libraries(paltest_sprintf_test14 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test14/test14.cpp b/src/pal/tests/palsuite/c_runtime/sprintf_s/test14/test14.cpp new file mode 100644 index 0000000000..668edda433 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test14/test14.cpp @@ -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: test14.c +** +** Purpose: Test #14 for the sprintf_s function. Tests the lowercase +** exponential notation double specifier (%e) +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../sprintf_s.h" + +/* + * Depends on memcmp and strlen + */ + +int __cdecl main(int argc, char *argv[]) +{ + double val = 256.0; + double neg = -256.0; + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + + DoDoubleTest("foo %e", val, "foo 2.560000e+002", "foo 2.560000e+02"); + DoDoubleTest("foo %le", val, "foo 2.560000e+002", "foo 2.560000e+02"); + DoDoubleTest("foo %he", val, "foo 2.560000e+002", "foo 2.560000e+02"); + DoDoubleTest("foo %Le", val, "foo 2.560000e+002", "foo 2.560000e+02"); + DoDoubleTest("foo %I64e", val, "foo 2.560000e+002", "foo 2.560000e+02"); + DoDoubleTest("foo %14e", val, "foo 2.560000e+002", "foo 2.560000e+02"); + DoDoubleTest("foo %-14e", val, "foo 2.560000e+002 ", "foo 2.560000e+02 "); + DoDoubleTest("foo %.1e", val, "foo 2.6e+002", "foo 2.6e+02"); + DoDoubleTest("foo %.8e", val, "foo 2.56000000e+002", "foo 2.56000000e+02"); + DoDoubleTest("foo %014e", val, "foo 02.560000e+002", "foo 002.560000e+02"); + DoDoubleTest("foo %#e", val, "foo 2.560000e+002", "foo 2.560000e+02"); + DoDoubleTest("foo %+e", val, "foo +2.560000e+002", "foo +2.560000e+02"); + DoDoubleTest("foo % e", val, "foo 2.560000e+002", "foo 2.560000e+02"); + DoDoubleTest("foo %+e", neg, "foo -2.560000e+002", "foo -2.560000e+02"); + DoDoubleTest("foo % e", neg, "foo -2.560000e+002", "foo -2.560000e+02"); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test14/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf_s/test14/testinfo.dat new file mode 100644 index 0000000000..23cf423354 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test14/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sprintf_s +Name = Positive Test for sprintf_s +TYPE = DEFAULT +EXE1 = test14 +Description += Tests sprintf_s with exponential format doubles (lowercase) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test15/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf_s/test15/CMakeLists.txt new file mode 100644 index 0000000000..57bba40e6c --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test15/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test15.cpp +) + +add_executable(paltest_sprintf_test15 + ${SOURCES} +) + +add_dependencies(paltest_sprintf_test15 coreclrpal) + +target_link_libraries(paltest_sprintf_test15 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test15/test15.cpp b/src/pal/tests/palsuite/c_runtime/sprintf_s/test15/test15.cpp new file mode 100644 index 0000000000..61e0e362a1 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test15/test15.cpp @@ -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: test15.c +** +** Purpose: Test #15 for the sprintf_s function. Tests the uppercase +** exponential notation double specifier (%E) +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../sprintf_s.h" + +/* + * Depends on memcmp and strlen + */ + +int __cdecl main(int argc, char *argv[]) +{ + double val = 256.0; + double neg = -256.0; + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + + DoDoubleTest("foo %E", val, "foo 2.560000E+002", "foo 2.560000E+02"); + DoDoubleTest("foo %lE", val, "foo 2.560000E+002", "foo 2.560000E+02"); + DoDoubleTest("foo %hE", val, "foo 2.560000E+002", "foo 2.560000E+02"); + DoDoubleTest("foo %LE", val, "foo 2.560000E+002", "foo 2.560000E+02"); + DoDoubleTest("foo %I64E", val, "foo 2.560000E+002", "foo 2.560000E+02"); + DoDoubleTest("foo %14E", val, "foo 2.560000E+002", "foo 2.560000E+02"); + DoDoubleTest("foo %-14E", val, "foo 2.560000E+002 ", "foo 2.560000E+02 "); + DoDoubleTest("foo %.1E", val, "foo 2.6E+002", "foo 2.6E+02"); + DoDoubleTest("foo %.8E", val, "foo 2.56000000E+002", "foo 2.56000000E+02"); + DoDoubleTest("foo %014E", val, "foo 02.560000E+002", "foo 002.560000E+02"); + DoDoubleTest("foo %#E", val, "foo 2.560000E+002", "foo 2.560000E+02"); + DoDoubleTest("foo %+E", val, "foo +2.560000E+002", "foo +2.560000E+02"); + DoDoubleTest("foo % E", val, "foo 2.560000E+002", "foo 2.560000E+02"); + DoDoubleTest("foo %+E", neg, "foo -2.560000E+002", "foo -2.560000E+02"); + DoDoubleTest("foo % E", neg, "foo -2.560000E+002", "foo -2.560000E+02"); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test15/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf_s/test15/testinfo.dat new file mode 100644 index 0000000000..537e6d1db2 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test15/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sprintf_s +Name = Positive Test for sprintf_s +TYPE = DEFAULT +EXE1 = test15 +Description += Tests sprintf_s with exponential format doubles (uppercase) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test16/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf_s/test16/CMakeLists.txt new file mode 100644 index 0000000000..fc93e1a67d --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test16/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test16.cpp +) + +add_executable(paltest_sprintf_test16 + ${SOURCES} +) + +add_dependencies(paltest_sprintf_test16 coreclrpal) + +target_link_libraries(paltest_sprintf_test16 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test16/test16.cpp b/src/pal/tests/palsuite/c_runtime/sprintf_s/test16/test16.cpp new file mode 100644 index 0000000000..b237c98d5c --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test16/test16.cpp @@ -0,0 +1,52 @@ +// 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: test16.c +** +** Purpose: Test #16 for the sprintf_s function. Tests the decimal notation +** double specifier (%f) +** +** +**==========================================================================*/ + + +#include <palsuite.h> +#include "../sprintf_s.h" + +/* + * Depends on memcmp and strlen + */ + +int __cdecl main(int argc, char *argv[]) +{ + double val = 2560.001; + double neg = -2560.001; + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + + DoDoubleTest("foo %f", val, "foo 2560.001000", "foo 2560.001000"); + DoDoubleTest("foo %lf", val, "foo 2560.001000", "foo 2560.001000"); + DoDoubleTest("foo %hf", val, "foo 2560.001000", "foo 2560.001000"); + DoDoubleTest("foo %Lf", val, "foo 2560.001000", "foo 2560.001000"); + DoDoubleTest("foo %I64f", val, "foo 2560.001000", "foo 2560.001000"); + DoDoubleTest("foo %12f", val, "foo 2560.001000", "foo 2560.001000"); + DoDoubleTest("foo %-12f", val, "foo 2560.001000 ", "foo 2560.001000 "); + DoDoubleTest("foo %.1f", val, "foo 2560.0", "foo 2560.0"); + DoDoubleTest("foo %.8f", val, "foo 2560.00100000", "foo 2560.00100000"); + DoDoubleTest("foo %012f", val, "foo 02560.001000", "foo 02560.001000"); + DoDoubleTest("foo %#f", val, "foo 2560.001000", "foo 2560.001000"); + DoDoubleTest("foo %+f", val, "foo +2560.001000", "foo +2560.001000"); + DoDoubleTest("foo % f", val, "foo 2560.001000", "foo 2560.001000"); + DoDoubleTest("foo %+f", neg, "foo -2560.001000", "foo -2560.001000"); + DoDoubleTest("foo % f", neg, "foo -2560.001000", "foo -2560.001000"); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test16/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf_s/test16/testinfo.dat new file mode 100644 index 0000000000..4e98eccac2 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test16/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sprintf_s +Name = Positive Test for sprintf_s +TYPE = DEFAULT +EXE1 = test16 +Description += Tests sprintf_s with decimal point format doubles diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test17/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf_s/test17/CMakeLists.txt new file mode 100644 index 0000000000..dc5ff2bb30 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test17/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test17.cpp +) + +add_executable(paltest_sprintf_test17 + ${SOURCES} +) + +add_dependencies(paltest_sprintf_test17 coreclrpal) + +target_link_libraries(paltest_sprintf_test17 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test17/test17.cpp b/src/pal/tests/palsuite/c_runtime/sprintf_s/test17/test17.cpp new file mode 100644 index 0000000000..220555e5d4 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test17/test17.cpp @@ -0,0 +1,54 @@ +// 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: test17.c +** +** Purpose: Test #17 for the sprintf_s function. Tests the lowercase +** shorthand notation double specifier (%g) +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../sprintf_s.h" + +/* + * Depends on memcmp and strlen + */ + +int __cdecl main(int argc, char *argv[]) +{ + double val = 2560.001; + double neg = -2560.001; + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + + DoDoubleTest("foo %g", val, "foo 2560", "foo 2560"); + DoDoubleTest("foo %lg", val, "foo 2560", "foo 2560"); + DoDoubleTest("foo %hg", val, "foo 2560", "foo 2560"); + DoDoubleTest("foo %Lg", val, "foo 2560", "foo 2560"); + DoDoubleTest("foo %I64g", val, "foo 2560", "foo 2560"); + DoDoubleTest("foo %5g", val, "foo 2560", "foo 2560"); + DoDoubleTest("foo %-5g", val, "foo 2560 ", "foo 2560 "); + DoDoubleTest("foo %.1g", val, "foo 3e+003", "foo 3e+03"); + DoDoubleTest("foo %.2g", val, "foo 2.6e+003", "foo 2.6e+03"); + DoDoubleTest("foo %.12g", val, "foo 2560.001", "foo 2560.001"); + DoDoubleTest("foo %06g", val, "foo 002560", "foo 002560"); + DoDoubleTest("foo %#g", val, "foo 2560.00", "foo 2560.00"); + DoDoubleTest("foo %+g", val, "foo +2560", "foo +2560"); + DoDoubleTest("foo % g", val, "foo 2560", "foo 2560"); + DoDoubleTest("foo %+g", neg, "foo -2560", "foo -2560"); + DoDoubleTest("foo % g", neg, "foo -2560", "foo -2560"); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test17/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf_s/test17/testinfo.dat new file mode 100644 index 0000000000..5e41e20d44 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test17/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sprintf_s +Name = Positive Test for sprintf_s +TYPE = DEFAULT +EXE1 = test17 +Description += Tests sprintf_s with compact format doubles (lowercase) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test18/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf_s/test18/CMakeLists.txt new file mode 100644 index 0000000000..f6e1b09efa --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test18/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test18.cpp +) + +add_executable(paltest_sprintf_test18 + ${SOURCES} +) + +add_dependencies(paltest_sprintf_test18 coreclrpal) + +target_link_libraries(paltest_sprintf_test18 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test18/test18.cpp b/src/pal/tests/palsuite/c_runtime/sprintf_s/test18/test18.cpp new file mode 100644 index 0000000000..2135a6f1e7 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test18/test18.cpp @@ -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: test18.c +** +** Purpose: Test #18 for the sprintf_s function. Tests the uppercase +** shorthand notation double specifier (%G) +** +** +**==========================================================================*/ + + +#include <palsuite.h> +#include "../sprintf_s.h" + +/* + * Depends on memcmp and strlen + */ + +int __cdecl main(int argc, char *argv[]) +{ + double val = 2560.001; + double neg = -2560.001; + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + + DoDoubleTest("foo %G", val, "foo 2560", "foo 2560"); + DoDoubleTest("foo %lG", val, "foo 2560", "foo 2560"); + DoDoubleTest("foo %hG", val, "foo 2560", "foo 2560"); + DoDoubleTest("foo %LG", val, "foo 2560", "foo 2560"); + DoDoubleTest("foo %I64G", val, "foo 2560", "foo 2560"); + DoDoubleTest("foo %5G", val, "foo 2560", "foo 2560"); + DoDoubleTest("foo %-5G", val, "foo 2560 ", "foo 2560 "); + DoDoubleTest("foo %.1G", val, "foo 3E+003", "foo 3E+03"); + DoDoubleTest("foo %.2G", val, "foo 2.6E+003", "foo 2.6E+03"); + DoDoubleTest("foo %.12G", val, "foo 2560.001", "foo 2560.001"); + DoDoubleTest("foo %06G", val, "foo 002560", "foo 002560"); + DoDoubleTest("foo %#G", val, "foo 2560.00", "foo 2560.00"); + DoDoubleTest("foo %+G", val, "foo +2560", "foo +2560"); + DoDoubleTest("foo % G", val, "foo 2560", "foo 2560"); + DoDoubleTest("foo %+G", neg, "foo -2560", "foo -2560"); + DoDoubleTest("foo % G", neg, "foo -2560", "foo -2560"); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test18/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf_s/test18/testinfo.dat new file mode 100644 index 0000000000..06ae3a632e --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test18/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sprintf_s +Name = Positive Test for sprintf_s +TYPE = DEFAULT +EXE1 = test18 +Description += Tests sprintf_s with compact format doubles (uppercase) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test19/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf_s/test19/CMakeLists.txt new file mode 100644 index 0000000000..757288b694 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test19/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test19.cpp +) + +add_executable(paltest_sprintf_test19 + ${SOURCES} +) + +add_dependencies(paltest_sprintf_test19 coreclrpal) + +target_link_libraries(paltest_sprintf_test19 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test19/test19.cpp b/src/pal/tests/palsuite/c_runtime/sprintf_s/test19/test19.cpp new file mode 100644 index 0000000000..483c7167b1 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test19/test19.cpp @@ -0,0 +1,71 @@ +// 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: test19.c +** +** Purpose: Test #19 for the sprintf_s function. Tests the variable length +** precision argument. +** +** +**==========================================================================*/ + + +#include <palsuite.h> +#include "../sprintf_s.h" + +/* + * Depends on memcmp and strlen + */ + + +int __cdecl main(int argc, char *argv[]) +{ + int n = -1; + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + DoArgumentPrecTest("%.*s", 2, (void*)"bar", "bar", "ba", "ba"); + DoArgumentPrecTest("%.*S", 2, (void*)convert("bar"), "bar", "ba", "ba"); + + DoArgumentPrecTest("%.*c", 0, (void*)'a', "a", "a", "a"); + DoArgumentPrecTest("%.*c", 4, (void*)'a', "a", "a", "a"); + DoArgumentPrecTest("%.*C", 0, (void*)'a', "a", "a", "a"); + DoArgumentPrecTest("%.*C", 4, (void*)'a', "a", "a", "a"); + DoArgumentPrecTest("%.*d", 1, (void*)42, "42", "42", "42"); + DoArgumentPrecTest("%.*d", 3, (void*)42, "42", "042", "042"); + DoArgumentPrecTest("%.*i", 1, (void*)42, "42", "42", "42"); + DoArgumentPrecTest("%.*i", 3, (void*)42, "42", "042", "042"); + DoArgumentPrecTest("%.*o", 1, (void*)42, "42", "52", "52"); + DoArgumentPrecTest("%.*o", 3, (void*)42, "42", "052", "052"); + DoArgumentPrecTest("%.*u", 1, (void*)42, "42", "42", "42"); + DoArgumentPrecTest("%.*u", 3, (void*)42, "42", "042", "042"); + DoArgumentPrecTest("%.*x", 1, (void*)0x42, "0x42", "42", "42"); + DoArgumentPrecTest("%.*x", 3, (void*)0x42, "0x42", "042", "042"); + DoArgumentPrecTest("%.*X", 1, (void*)0x42, "0x42", "42", "42"); + DoArgumentPrecTest("%.*X", 3, (void*)0x42, "0x42", "042", "042"); + + + DoArgumentPrecDoubleTest("%.*e", 1, 2.01, "2.0e+000", "2.0e+00"); + DoArgumentPrecDoubleTest("%.*e", 3, 2.01, "2.010e+000", "2.010e+00"); + DoArgumentPrecDoubleTest("%.*E", 1, 2.01, "2.0E+000", "2.0E+00"); + DoArgumentPrecDoubleTest("%.*E", 3, 2.01, "2.010E+000", "2.010E+00"); + DoArgumentPrecDoubleTest("%.*f", 1, 2.01, "2.0", "2.0"); + DoArgumentPrecDoubleTest("%.*f", 3, 2.01, "2.010", "2.010"); + DoArgumentPrecDoubleTest("%.*g", 1, 256.01, "3e+002", "3e+02"); + DoArgumentPrecDoubleTest("%.*g", 3, 256.01, "256", "256"); + DoArgumentPrecDoubleTest("%.*g", 4, 256.01, "256", "256"); + DoArgumentPrecDoubleTest("%.*g", 6, 256.01, "256.01", "256.01"); + DoArgumentPrecDoubleTest("%.*G", 1, 256.01, "3E+002", "3E+02"); + DoArgumentPrecDoubleTest("%.*G", 3, 256.01, "256", "256"); + DoArgumentPrecDoubleTest("%.*G", 4, 256.01, "256", "256"); + DoArgumentPrecDoubleTest("%.*G", 6, 256.01, "256.01", "256.01"); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test19/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf_s/test19/testinfo.dat new file mode 100644 index 0000000000..7064c01771 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test19/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sprintf_s +Name = Positive Test for sprintf_s +TYPE = DEFAULT +EXE1 = test19 +Description += Tests sprintf_s with argument specified precision diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf_s/test2/CMakeLists.txt new file mode 100644 index 0000000000..d569263da4 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test2/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test2.cpp +) + +add_executable(paltest_sprintf_test2 + ${SOURCES} +) + +add_dependencies(paltest_sprintf_test2 coreclrpal) + +target_link_libraries(paltest_sprintf_test2 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test2/test2.cpp b/src/pal/tests/palsuite/c_runtime/sprintf_s/test2/test2.cpp new file mode 100644 index 0000000000..990f4f04a8 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test2/test2.cpp @@ -0,0 +1,47 @@ +// 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: test2.c +** +** Purpose: Test #2 for the sprintf_s function. Tests the string specifier +** (%s). +** +** +**==========================================================================*/ + + +#include <palsuite.h> +#include "../sprintf_s.h" + +/* + * Depends on memcmp and strlen + */ + +int __cdecl main(int argc, char *argv[]) +{ + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + + DoStrTest("foo %s", "bar", "foo bar"); + DoStrTest("foo %hs", "bar", "foo bar"); + DoWStrTest("foo %ls", convert("bar"), "foo bar"); + DoWStrTest("foo %ws", convert("bar"), "foo bar"); + DoStrTest("foo %Ls", "bar", "foo bar"); + DoStrTest("foo %I64s", "bar", "foo bar"); + DoStrTest("foo %5s", "bar", "foo bar"); + DoStrTest("foo %.2s", "bar", "foo ba"); + DoStrTest("foo %5.2s", "bar", "foo ba"); + DoStrTest("foo %-5s", "bar", "foo bar "); + DoStrTest("foo %05s", "bar", "foo 00bar"); + + PAL_Terminate(); + return PASS; +} + diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf_s/test2/testinfo.dat new file mode 100644 index 0000000000..cce2dc67e7 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test2/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sprintf_s +Name = Positive Test for sprintf_s +TYPE = DEFAULT +EXE1 = test2 +Description += Tests sprintf_s with strings diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf_s/test3/CMakeLists.txt new file mode 100644 index 0000000000..518c3f847a --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test3/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test3.cpp +) + +add_executable(paltest_sprintf_test3 + ${SOURCES} +) + +add_dependencies(paltest_sprintf_test3 coreclrpal) + +target_link_libraries(paltest_sprintf_test3 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test3/test3.cpp b/src/pal/tests/palsuite/c_runtime/sprintf_s/test3/test3.cpp new file mode 100644 index 0000000000..c0dc8e1716 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test3/test3.cpp @@ -0,0 +1,47 @@ +// 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: test3.c +** +** Purpose: Test #3 for the sprintf_s function. Tests the wide string +** specifier (%S). +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../sprintf_s.h" + +/* + * Depends on memcmp and strlen + */ + +int __cdecl main(int argc, char *argv[]) +{ + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + DoWStrTest("foo %S", convert("bar"), "foo bar"); + DoStrTest("foo %hS", "bar", "foo bar"); + DoWStrTest("foo %lS", convert("bar"), "foo bar"); + DoWStrTest("foo %wS", convert("bar"), "foo bar"); + DoWStrTest("foo %LS", convert("bar"), "foo bar"); + DoWStrTest("foo %I64S", convert("bar"), "foo bar"); + DoWStrTest("foo %5S", convert("bar"), "foo bar"); + DoWStrTest("foo %.2S", convert("bar"), "foo ba"); + DoWStrTest("foo %5.2S", convert("bar"), "foo ba"); + DoWStrTest("foo %-5S", convert("bar"), "foo bar "); + DoWStrTest("foo %05S", convert("bar"), "foo 00bar"); + + PAL_Terminate(); + return PASS; +} + + diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test3/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf_s/test3/testinfo.dat new file mode 100644 index 0000000000..cc8de0eae5 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test3/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sprintf_s +Name = Positive Test for sprintf_s +TYPE = DEFAULT +EXE1 = test3 +Description += Tests sprintf_s with wide strings diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test4/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf_s/test4/CMakeLists.txt new file mode 100644 index 0000000000..260def44aa --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test4/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test4.cpp +) + +add_executable(paltest_sprintf_test4 + ${SOURCES} +) + +add_dependencies(paltest_sprintf_test4 coreclrpal) + +target_link_libraries(paltest_sprintf_test4 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test4/test4.cpp b/src/pal/tests/palsuite/c_runtime/sprintf_s/test4/test4.cpp new file mode 100644 index 0000000000..46115ad5ae --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test4/test4.cpp @@ -0,0 +1,69 @@ +// 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: test4.c +** +** Purpose: Test #4 for the sprintf_s function. Tests the pointer +** specifier (%p). +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../sprintf_s.h" +/* + * Depends on memcmp and strlen + */ + +int __cdecl main(int argc, char *argv[]) +{ + void *ptr = (void*) 0x123456; + INT64 lptr = I64(0x1234567887654321); + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + +/* +** Run only on 64 bit platforms +*/ +#if defined(BIT64) && defined(PLATFORM_UNIX) + Trace("Testing for 64 Bit Platforms \n"); + DoPointerTest("%p", NULL, "NULL", "0000000000000000"); + DoPointerTest("%p", ptr, "pointer to 0x123456", "0000000000123456"); + DoPointerTest("%17p", ptr, "pointer to 0x123456", " 0000000000123456"); + DoPointerTest("%17p", ptr, "pointer to 0x123456", " 0000000000123456"); + DoPointerTest("%-17p", ptr, "pointer to 0x123456", "0000000000123456 "); + DoPointerTest("%+p", ptr, "pointer to 0x123456", "0000000000123456"); + DoPointerTest("%#p", ptr, "pointer to 0x123456", "0X0000000000123456"); + DoPointerTest("%lp", ptr, "pointer to 0x123456", "00123456"); + DoPointerTest("%hp", ptr, "pointer to 0x123456", "00003456"); + DoPointerTest("%Lp", ptr, "pointer to 0x123456", "00123456"); + DoI64Test("%I64p", lptr, "pointer to 0x1234567887654321", + "1234567887654321"); +#else + Trace("Testing for Non 64 Bit Platforms \n"); + DoPointerTest("%p", NULL, "NULL", "00000000"); + DoPointerTest("%p", ptr, "pointer to 0x123456", "00123456"); + DoPointerTest("%9p", ptr, "pointer to 0x123456", " 00123456"); + DoPointerTest("%09p", ptr, "pointer to 0x123456", " 00123456"); + DoPointerTest("%-9p", ptr, "pointer to 0x123456", "00123456 "); + DoPointerTest("%+p", ptr, "pointer to 0x123456", "00123456"); + DoPointerTest("%#p", ptr, "pointer to 0x123456", "0X00123456"); + DoPointerTest("%lp", ptr, "pointer to 0x123456", "00123456"); + DoPointerTest("%hp", ptr, "pointer to 0x123456", "00003456"); + DoPointerTest("%Lp", ptr, "pointer to 0x123456", "00123456"); + DoI64Test("%I64p", lptr, "pointer to 0x1234567887654321", + "1234567887654321"); +#endif + + PAL_Terminate(); + return PASS; +} + diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test4/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf_s/test4/testinfo.dat new file mode 100644 index 0000000000..f53f784991 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test4/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sprintf_s +Name = Positive Test for sprintf_s +TYPE = DEFAULT +EXE1 = test4 +Description += Tests sprintf_s with pointers diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test6/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf_s/test6/CMakeLists.txt new file mode 100644 index 0000000000..fce1f204fd --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test6/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test6.cpp +) + +add_executable(paltest_sprintf_test6 + ${SOURCES} +) + +add_dependencies(paltest_sprintf_test6 coreclrpal) + +target_link_libraries(paltest_sprintf_test6 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test6/test6.cpp b/src/pal/tests/palsuite/c_runtime/sprintf_s/test6/test6.cpp new file mode 100644 index 0000000000..c5fc804071 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test6/test6.cpp @@ -0,0 +1,50 @@ +// 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: test6.c +** +** Purpose: Test #6 for the sprintf_s function. Tests the char specifier (%c). +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../sprintf_s.h" + +/* + * Depends on memcmp and strlen + */ + +int __cdecl main(int argc, char *argv[]) +{ + WCHAR wc = (WCHAR) 'c'; + + if (PAL_Initialize(argc, argv)) + { + return FAIL; + } + + + DoCharTest("foo %c", 'b', "foo b"); + DoCharTest("foo %hc", 'b', "foo b"); + DoWCharTest("foo %lc", wc, "foo c"); + DoCharTest("foo %Lc", 'b', "foo b"); + DoCharTest("foo %I64c", 'b', "foo b"); + DoCharTest("foo %5c", 'b', "foo b"); + DoCharTest("foo %.0c", 'b', "foo b"); + DoCharTest("foo %-5c", 'b', "foo b "); + DoCharTest("foo %05c", 'b', "foo 0000b"); + DoCharTest("foo % c", 'b', "foo b"); + DoCharTest("foo %#c", 'b', "foo b"); + + PAL_Terminate(); + return PASS; +} + + + diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test6/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf_s/test6/testinfo.dat new file mode 100644 index 0000000000..c5b93fc78c --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test6/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sprintf_s +Name = Positive Test for sprintf_s +TYPE = DEFAULT +EXE1 = test6 +Description += Tests sprintf_s with characters diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test7/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf_s/test7/CMakeLists.txt new file mode 100644 index 0000000000..72a831ec89 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test7/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test7.cpp +) + +add_executable(paltest_sprintf_test7 + ${SOURCES} +) + +add_dependencies(paltest_sprintf_test7 coreclrpal) + +target_link_libraries(paltest_sprintf_test7 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test7/test7.cpp b/src/pal/tests/palsuite/c_runtime/sprintf_s/test7/test7.cpp new file mode 100644 index 0000000000..fd46ae9674 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test7/test7.cpp @@ -0,0 +1,49 @@ +// 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: test7.c +** +** Purpose: Test #7 for the sprintf_s function. Tests the wide char +** specifier (%C). +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../sprintf_s.h" + +/* + * Depends on memcmp and strlen + */ + +int __cdecl main(int argc, char *argv[]) +{ + WCHAR wb = (WCHAR) 'b'; + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + + DoWCharTest("foo %C", wb, "foo b"); + DoWCharTest("foo %hC", wb, "foo b"); + DoCharTest("foo %lC", 'c', "foo c"); + DoWCharTest("foo %LC", wb, "foo b"); + DoWCharTest("foo %I64C", wb, "foo b"); + DoWCharTest("foo %5C", wb, "foo b"); + DoWCharTest("foo %.0C", wb, "foo b"); + DoWCharTest("foo %-5C", wb, "foo b "); + DoWCharTest("foo %05C", wb, "foo 0000b"); + DoWCharTest("foo % C", wb, "foo b"); + DoWCharTest("foo %#C", wb, "foo b"); + + PAL_Terminate(); + return PASS; +} + diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test7/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf_s/test7/testinfo.dat new file mode 100644 index 0000000000..647c9d80fd --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test7/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sprintf_s +Name = Positive Test for sprintf_s +TYPE = DEFAULT +EXE1 = test7 +Description += Tests sprintf_s with wide characters diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test8/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf_s/test8/CMakeLists.txt new file mode 100644 index 0000000000..c9522c1c9d --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test8/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test8.cpp +) + +add_executable(paltest_sprintf_test8 + ${SOURCES} +) + +add_dependencies(paltest_sprintf_test8 coreclrpal) + +target_link_libraries(paltest_sprintf_test8 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test8/test8.cpp b/src/pal/tests/palsuite/c_runtime/sprintf_s/test8/test8.cpp new file mode 100644 index 0000000000..db02627bb0 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test8/test8.cpp @@ -0,0 +1,55 @@ +// 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: test8.c +** +** Purpose: Test #8 for the sprintf_s function. Tests the decimal +** specifier (%d). +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../sprintf_s.h" + +/* + * Depends on memcmp and strlen + */ + +int __cdecl main(int argc, char *argv[]) +{ + int neg = -42; + int pos = 42; + INT64 l = 42; + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + + DoNumTest("foo %d", pos, "foo 42"); + DoNumTest("foo %ld", 0xFFFF, "foo 65535"); + DoNumTest("foo %hd", 0xFFFF, "foo -1"); + DoNumTest("foo %Ld", pos, "foo 42"); + DoI64Test("foo %I64d", l, "42", "foo 42"); + DoNumTest("foo %3d", pos, "foo 42"); + DoNumTest("foo %-3d", pos, "foo 42 "); + DoNumTest("foo %.1d", pos, "foo 42"); + DoNumTest("foo %.3d", pos, "foo 042"); + DoNumTest("foo %03d", pos, "foo 042"); + DoNumTest("foo %#d", pos, "foo 42"); + DoNumTest("foo %+d", pos, "foo +42"); + DoNumTest("foo % d", pos, "foo 42"); + DoNumTest("foo %+d", neg, "foo -42"); + DoNumTest("foo % d", neg, "foo -42"); + + PAL_Terminate(); + return PASS; +} + diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test8/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf_s/test8/testinfo.dat new file mode 100644 index 0000000000..524834e53e --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test8/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sprintf_s +Name = Positive Test for sprintf_s +TYPE = DEFAULT +EXE1 = test8 +Description += Tests sprintf_s with decimal numbers diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test9/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf_s/test9/CMakeLists.txt new file mode 100644 index 0000000000..e76fed4784 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test9/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test9.cpp +) + +add_executable(paltest_sprintf_test9 + ${SOURCES} +) + +add_dependencies(paltest_sprintf_test9 coreclrpal) + +target_link_libraries(paltest_sprintf_test9 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test9/test9.cpp b/src/pal/tests/palsuite/c_runtime/sprintf_s/test9/test9.cpp new file mode 100644 index 0000000000..2e1c78ce68 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test9/test9.cpp @@ -0,0 +1,55 @@ +// 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: test9.c +** +** Purpose: Test #9 for the sprintf_s function. Tests the integer +** specifier (%i). +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../sprintf_s.h" + +/* + * Depends on memcmp and strlen + */ + +int __cdecl main(int argc, char *argv[]) +{ + int neg = -42; + int pos = 42; + INT64 l = 42; + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + + DoNumTest("foo %i", pos, "foo 42"); + DoNumTest("foo %li", 0xFFFF, "foo 65535"); + DoNumTest("foo %hi", 0xFFFF, "foo -1"); + DoNumTest("foo %Li", pos, "foo 42"); + DoI64Test("foo %I64i", l, "42", "foo 42"); + DoNumTest("foo %3i", pos, "foo 42"); + DoNumTest("foo %-3i", pos, "foo 42 "); + DoNumTest("foo %.1i", pos, "foo 42"); + DoNumTest("foo %.3i", pos, "foo 042"); + DoNumTest("foo %03i", pos, "foo 042"); + DoNumTest("foo %#i", pos, "foo 42"); + DoNumTest("foo %+i", pos, "foo +42"); + DoNumTest("foo % i", pos, "foo 42"); + DoNumTest("foo %+i", neg, "foo -42"); + DoNumTest("foo % i", neg, "foo -42"); + + PAL_Terminate(); + return PASS; +} + diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test9/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf_s/test9/testinfo.dat new file mode 100644 index 0000000000..7c51443a3d --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test9/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sprintf_s +Name = Positive Test for sprintf_s +TYPE = DEFAULT +EXE1 = test9 +Description += Tests sprintf_s with integer numbers diff --git a/src/pal/tests/palsuite/c_runtime/sqrt/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sqrt/test1/CMakeLists.txt index 4347c44e46..d4aefe6ca8 100644 --- a/src/pal/tests/palsuite/c_runtime/sqrt/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/sqrt/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_sqrt_test1 diff --git a/src/pal/tests/palsuite/c_runtime/sqrt/test1/test1.c b/src/pal/tests/palsuite/c_runtime/sqrt/test1/test1.cpp index 62d2251d61..62d2251d61 100644 --- a/src/pal/tests/palsuite/c_runtime/sqrt/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/sqrt/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_makepath/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sqrtf/CMakeLists.txt index f6aa0cb2d9..f6aa0cb2d9 100644 --- a/src/pal/tests/palsuite/c_runtime/_makepath/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/sqrtf/CMakeLists.txt diff --git a/src/pal/tests/palsuite/c_runtime/sqrtf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sqrtf/test1/CMakeLists.txt new file mode 100644 index 0000000000..96b6ffa998 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sqrtf/test1/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test1.c +) + +add_executable(paltest_sqrtf_test1 + ${SOURCES} +) + +add_dependencies(paltest_sqrtf_test1 coreclrpal) + +target_link_libraries(paltest_sqrtf_test1 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/sqrtf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/sqrtf/test1/test1.c new file mode 100644 index 0000000000..cb1ac9e7df --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sqrtf/test1/test1.c @@ -0,0 +1,122 @@ +// 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: test1.c +** +** Purpose: Call the sqrtf function on a positive value, a positive value +** with a decimal and on the maxium possible float value. +** +** +**===================================================================*/ + +#include <palsuite.h> + +// binary32 (float) has a machine epsilon of 2^-23 (approx. 1.19e-07). However, this +// is slightly too accurate when writing tests meant to run against libm implementations +// for various platforms. 2^-21 (approx. 4.76e-07) seems to be as accurate as we can get. +// +// The tests themselves will take PAL_EPSILON and adjust it according to the expected result +// so that the delta used for comparison will compare the most significant digits and ignore +// any digits that are outside the double precision range (6-9 digits). + +// For example, a test with an expect result in the format of 0.xxxxxxxxx will use PAL_EPSILON +// for the variance, while an expected result in the format of 0.0xxxxxxxxx will use +// PAL_EPSILON / 10 and and expected result in the format of x.xxxxxx will use PAL_EPSILON * 10. +#define PAL_EPSILON 4.76837158e-07 + +#define PAL_NAN sqrtf(-1.0f) +#define PAL_POSINF -logf(0.0f) +#define PAL_NEGINF logf(0.0f) + +/** + * Helper test structure + */ +struct test +{ + float value; /* value to test the function with */ + float expected; /* expected result */ + float variance; /* maximum delta between the expected and actual result */ +}; + +/** + * validate + * + * test validation function + */ +void __cdecl validate(float value, float expected, float variance) +{ + float result = sqrtf(value); + + /* + * The test is valid when the difference between result + * and expected is less than or equal to variance + */ + float delta = fabsf(result - expected); + + if (delta > variance) + { + Fail("sqrtf(%g) returned %10.9g when it should have returned %10.9g", + value, result, expected); + } +} + +/** + * validate + * + * test validation function for values returning NaN + */ +void __cdecl validate_isnan(float value) +{ + float result = sqrtf(value); + + if (!_isnanf(result)) + { + Fail("sqrtf(%g) returned %10.9g when it should have returned %10.9g", + value, result, PAL_NAN); + } +} + +int __cdecl main(int argc, char **argv) +{ + struct test tests[] = + { + /* value expected variance */ + { 0.318309886f, 0.564189584f, PAL_EPSILON }, // value: 1 / pi + { 0.434294482f, 0.659010229f, PAL_EPSILON }, // value: log10f(e) + { 0.636619772f, 0.797884561f, PAL_EPSILON }, // value: 2 / pi + { 0.693147181f, 0.832554611f, PAL_EPSILON }, // value: ln(2) + { 0.707106781f, 0.840896415f, PAL_EPSILON }, // value: 1 / sqrtf(2) + { 0.785398163f, 0.886226925f, PAL_EPSILON }, // value: pi / 4 + { 1, 1, PAL_EPSILON * 10 }, + { 1.12837917f, 1.06225193f, PAL_EPSILON * 10 }, // value: 2 / sqrtf(pi) + { 1.41421356f, 1.18920712f, PAL_EPSILON * 10 }, // value: sqrtf(2) + { 1.44269504f, 1.20112241f, PAL_EPSILON * 10 }, // value: logf2(e) + { 1.57079633f, 1.25331414f, PAL_EPSILON * 10 }, // value: pi / 2 + { 2.30258509f, 1.51742713f, PAL_EPSILON * 10 }, // value: ln(10) + { 2.71828183f, 1.64872127f, PAL_EPSILON * 10 }, // value: e + { 3.14159265f, 1.77245385F, PAL_EPSILON * 10 }, // value: pi + }; + + /* PAL initialization */ + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + validate(-0.0f, -0.0f, PAL_EPSILON); + validate( 0.0f, 0.0f, PAL_EPSILON); + + for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) + { + validate(tests[i].value, tests[i].expected, tests[i].variance); + validate_isnan(-tests[i].value); + } + + validate_isnan(PAL_NAN); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/sqrtf/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sqrtf/test1/testinfo.dat new file mode 100644 index 0000000000..00d8ab2e43 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sqrtf/test1/testinfo.dat @@ -0,0 +1,17 @@ +# 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 = sqrtf +Name = Call sqrtf on positive values and zero. +TYPE = DEFAULT +EXE1 = test1 +Description += Call the sqrtf function on a positive value, a positive value += with a decimal and on the maxium possible float value. + + + + diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/sscanf.h b/src/pal/tests/palsuite/c_runtime/sscanf/sscanf.h deleted file mode 100644 index 675a67aed2..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/sscanf.h +++ /dev/null @@ -1,246 +0,0 @@ -// 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: sscanf.h -** -** Purpose: Contains common testing functions for sscanf.h -** -** -**==========================================================================*/ - -#ifndef __SSCANF_H__ -#define __SSCANF_H__ - -void DoVoidTest(char *inputstr, char *formatstr) -{ - char buf[256] = { 0 }; - int i; - int ret; - - ret = sscanf(inputstr, formatstr, buf); - if (ret != 0) - { - Fail("ERROR: Expected sscanf to return 0, got %d.\n" - "Using \"%s\" in \"%s\".\n", ret, inputstr, formatstr); - } - - for (i=0; i<256; i++) - { - if (buf[i] != 0) - { - Fail("ERROR: Parameter unexpectedly modified scanning \"%s\" " - "using \"%s\".\n", inputstr, formatstr); - } - } - -} - -void DoStrTest(char *inputstr, char *formatstr, char *checkstr) -{ - char buf[256] = { 0 }; - int ret; - - ret = sscanf(inputstr, formatstr, buf); - if (ret != 1) - { - Fail("ERROR: Expected sscanf to return 1, got %d.\n" - "Using \"%s\" in \"%s\".\n", ret, inputstr, formatstr); - } - - if (memcmp(checkstr, buf, strlen(checkstr) + 1) != 0) - { - Fail("ERROR: scanned string incorrectly from \"%s\" using \"%s\".\n" - "Expected \"%s\", got \"%s\".\n", inputstr, formatstr, checkstr, - buf); - } - -} - -void DoWStrTest(char *inputstr, char *formatstr, WCHAR *checkstr) -{ - WCHAR buf[256] = { 0 }; - int ret; - - ret = sscanf(inputstr, formatstr, buf); - if (ret != 1) - { - Fail("ERROR: Expected sscanf to return 1, got %d.\n" - "Using \"%s\" in \"%s\".\n", ret, inputstr, formatstr); - } - - if (memcmp(checkstr, buf, wcslen(checkstr)*2 + 2) != 0) - { - Fail("ERROR: scanned wide string incorrectly from \"%s\" using \"%s\".\n" - "Expected \"%s\", got \"%s\".\n", inputstr, formatstr, - convertC(checkstr), convertC(buf)); - } - -} - -void DoNumTest(char *inputstr, char *formatstr, int checknum) -{ - int num; - int ret; - - ret = sscanf(inputstr, formatstr, &num); - if (ret != 1) - { - Fail("ERROR: Expected sscanf to return 1, got %d.\n" - "Using \"%s\" in \"%s\".\n", ret, inputstr, formatstr); - } - - if (checknum != num) - { - Fail("ERROR: scanned number incorrectly from \"%s\" using \"%s\".\n" - "Expected %d, got %d.\n", inputstr, formatstr, checknum, num); - } -} - -void DoShortNumTest(char *inputstr, char *formatstr, short checknum) -{ - short num; - int ret; - - ret = sscanf(inputstr, formatstr, &num); - if (ret != 1) - { - Fail("ERROR: Expected sscanf to return 1, got %d.\n" - "Using \"%s\" in \"%s\".\n", ret, inputstr, formatstr); - } - - if (checknum != num) - { - Fail("ERROR: scanned number incorrectly from \"%s\" using \"%s\".\n" - "Expected %hd, got %hd.\n", inputstr, formatstr, checknum, num); - } -} - -void DoI64NumTest(char *inputstr, char *formatstr, INT64 checknum) -{ - char buf[256]; - char check[256]; - INT64 num; - int ret; - - ret = sscanf(inputstr, formatstr, &num); - if (ret != 1) - { - Fail("ERROR: Expected sscanf to return 1, got %d.\n" - "Using \"%s\" in \"%s\".\n", ret, inputstr, formatstr); - } - - if (checknum != num) - { - sprintf(buf, "%I64d", num); - sprintf(check, "%I64d", checknum); - Fail("ERROR: scanned I64 number incorrectly from \"%s\" using \"%s\".\n" - "Expected %s, got %s.\n", inputstr, formatstr, check, buf); - } -} - -void DoCharTest(char *inputstr, char *formatstr, char* checkchars, int numchars) -{ - char buf[256]; - int ret; - int i; - - for (i=0; i<256; i++) - buf[i] = (char)-1; - - ret = sscanf(inputstr, formatstr, buf); - if (ret != 1) - { - Fail("ERROR: Expected sscanf to return 1, got %d.\n" - "Using \"%s\" in \"%s\".\n", ret, inputstr, formatstr); - } - - if (memcmp(buf, checkchars, numchars) != 0) - { - buf[numchars] = 0; - - Fail("ERROR: scanned character(s) incorrectly from \"%s\" using \"%s\".\n" - "Expected %s, got %s.\n", inputstr, formatstr, checkchars, - buf); - } - - if (buf[numchars] != (char)-1) - { - Fail("ERROR: overflow occurred in scanning character(s) from \"%s\" " - "using \"%s\".\nExpected %d character(s)\n", inputstr, formatstr, - numchars); - } -} - -void DoWCharTest(char *inputstr, char *formatstr, WCHAR* checkchars, int numchars) -{ - WCHAR buf[256]; - int ret; - int i; - - for (i=0; i<256; i++) - buf[i] = (WCHAR)-1; - - ret = sscanf(inputstr, formatstr, buf); - if (ret != 1) - { - Fail("ERROR: Expected sscanf to return 1, got %d.\n" - "Using \"%s\" in \"%s\".\n", ret, inputstr, formatstr); - } - - if (memcmp(buf, checkchars, numchars) != 0) - { - buf[numchars] = 0; - - Fail("ERROR: scanned wide character(s) incorrectly from \"%s\" using \"%s\".\n" - "Expected %s, got %s.\n", inputstr, formatstr, convertC(checkchars), - convertC(buf)); - } - - if (buf[numchars] != (WCHAR)-1) - { - Fail("ERROR: overflow occurred in scanning wide character(s) from \"%s\" " - "using \"%s\".\nExpected %d character(s)\n", inputstr, formatstr, - numchars); - } -} - - -void DoFloatTest(char *inputstr, char *formatstr, float checkval) -{ - char buf[256] = { 0 }; - float val; - int ret; - int i; - - for (i=0; i<256; i++) - buf[i] = (char)-1; - - ret = sscanf(inputstr, formatstr, buf); - val = *(float*)buf; - - if (ret != 1) - { - Fail("ERROR: Expected sscanf to return 1, got %d.\n" - "Using \"%s\" in \"%s\".\n", ret, inputstr, formatstr); - } - - if (val != checkval) - { - Fail("ERROR: scanned float incorrectly from \"%s\" using \"%s\".\n" - "Expected \"%f\", got \"%f\".\n", inputstr, formatstr, checkval, - val); - } - - if (buf[4] != (char)-1) - { - Fail("ERROR: overflow occurred in scanning float from \"%s\" " - "using \"%s\".\n", inputstr, formatstr); - - } -} - - -#endif diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf/test1/CMakeLists.txt deleted file mode 100644 index dce6d1de87..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test1/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test1.c -) - -add_executable(paltest_sscanf_test1 - ${SOURCES} -) - -add_dependencies(paltest_sscanf_test1 coreclrpal) - -target_link_libraries(paltest_sscanf_test1 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/sscanf/test1/test1.c deleted file mode 100644 index c6f66a1d20..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test1/test1.c +++ /dev/null @@ -1,53 +0,0 @@ -// 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: test1.c -** -** Purpose: General test of sscanf -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../sscanf.h" - - -int __cdecl main(int argc, char *argv[]) -{ - int num; - int ret; - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - - DoVoidTest("foo bar", "foo "); - DoVoidTest("foo bar", "baz"); - DoVoidTest("foo bar", "foo %*s"); - - DoStrTest("foo % bar", "foo %% %s", "bar"); - DoStrTest("foo bar baz", "foo %bar %s", "baz"); - - DoVoidTest("foo bar baz", "foo % bar %s"); - DoVoidTest("foo baz bar", "foo% baz %s"); - - ret = sscanf("foo bar baz", "foo bar %n", &num); - if (ret != 0 || num != 8) - { - Fail("ERROR: Got incorrect values in scanning \"%s\" using \"%s\".\n" - "Expected to get a value of %d with return value of %d, " - "got %d with return %d\n", "foo bar baz", "foo bar %n", 8, 0, - num, ret); - - } - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf/test1/testinfo.dat deleted file mode 100644 index ef33ba9e13..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test1/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = sscanf -Name = Positive Test for sscanf -TYPE = DEFAULT -EXE1 = test1 -Description -= General test of sscanf diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test10/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf/test10/CMakeLists.txt deleted file mode 100644 index c27e4ce33a..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test10/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test10.c -) - -add_executable(paltest_sscanf_test10 - ${SOURCES} -) - -add_dependencies(paltest_sscanf_test10 coreclrpal) - -target_link_libraries(paltest_sscanf_test10 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test10/test10.c b/src/pal/tests/palsuite/c_runtime/sscanf/test10/test10.c deleted file mode 100644 index aac5be43ae..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test10/test10.c +++ /dev/null @@ -1,37 +0,0 @@ -// 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: test10.c -** -** Purpose: Tests sscanf with wide charactersn -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../sscanf.h" - -int __cdecl main(int argc, char *argv[]) -{ - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - DoWCharTest("1234d", "%C", convert("1"), 1); - DoWCharTest("1234d", "%C", convert("1"), 1); - DoWCharTest("abc", "%2C", convert("ab"), 2); - DoWCharTest(" ab", "%C", convert(" "), 1); - DoCharTest("ab", "%hC", "a", 1); - DoWCharTest("ab", "%lC", convert("a"), 1); - DoWCharTest("ab", "%LC", convert("a"), 1); - DoWCharTest("ab", "%I64C", convert("a"), 1); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test10/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf/test10/testinfo.dat deleted file mode 100644 index 7e854ed235..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test10/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = sscanf -Name = Positive Test for sscanf -TYPE = DEFAULT -EXE1 = test10 -Description -= Tests sscanf with wide characters diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test11/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf/test11/CMakeLists.txt deleted file mode 100644 index 7570e990bf..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test11/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test11.c -) - -add_executable(paltest_sscanf_test11 - ${SOURCES} -) - -add_dependencies(paltest_sscanf_test11 coreclrpal) - -target_link_libraries(paltest_sscanf_test11 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test11/test11.c b/src/pal/tests/palsuite/c_runtime/sscanf/test11/test11.c deleted file mode 100644 index 0e3db6cca0..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test11/test11.c +++ /dev/null @@ -1,36 +0,0 @@ -// 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: test11.c -** -** Purpose: Tests sscanf with strings -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../sscanf.h" - -int __cdecl main(int argc, char *argv[]) -{ - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - DoStrTest("foo bar", "foo %s", "bar"); - DoStrTest("foo bar", "foo %2s", "ba"); - DoStrTest("foo bar", "foo %hs", "bar"); - DoWStrTest("foo bar", "foo %ls", convert("bar")); - DoStrTest("foo bar", "foo %Ls", "bar"); - DoStrTest("foo bar", "foo %I64s", "bar"); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test11/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf/test11/testinfo.dat deleted file mode 100644 index 60f5cc46a4..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test11/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = sscanf -Name = Positive Test for sscanf -TYPE = DEFAULT -EXE1 = test11 -Description -= Tests sscanf with strings diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test12/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf/test12/CMakeLists.txt deleted file mode 100644 index b6509e46d4..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test12/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test12.c -) - -add_executable(paltest_sscanf_test12 - ${SOURCES} -) - -add_dependencies(paltest_sscanf_test12 coreclrpal) - -target_link_libraries(paltest_sscanf_test12 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test12/test12.c b/src/pal/tests/palsuite/c_runtime/sscanf/test12/test12.c deleted file mode 100644 index f800e452c0..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test12/test12.c +++ /dev/null @@ -1,35 +0,0 @@ -// 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: test12.c -** -** Purpose: Tests sscanf with wide strings -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../sscanf.h" - -int __cdecl main(int argc, char *argv[]) -{ - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - DoWStrTest("foo bar", "foo %S", convert("bar")); - DoWStrTest("foo bar", "foo %2S", convert("ba")); - DoStrTest("foo bar", "foo %hS", "bar"); - DoWStrTest("foo bar", "foo %lS", convert("bar")); - DoWStrTest("foo bar", "foo %LS", convert("bar")); - DoWStrTest("foo bar", "foo %I64S", convert("bar")); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test12/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf/test12/testinfo.dat deleted file mode 100644 index 3c453bf53a..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test12/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = sscanf -Name = Positive Test for sscanf -TYPE = DEFAULT -EXE1 = test12 -Description -= Tests sscanf with wide strings diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test13/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf/test13/CMakeLists.txt deleted file mode 100644 index 6fb4094f00..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test13/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test13.c -) - -add_executable(paltest_sscanf_test13 - ${SOURCES} -) - -add_dependencies(paltest_sscanf_test13 coreclrpal) - -target_link_libraries(paltest_sscanf_test13 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test13/test13.c b/src/pal/tests/palsuite/c_runtime/sscanf/test13/test13.c deleted file mode 100644 index 314604e3ac..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test13/test13.c +++ /dev/null @@ -1,37 +0,0 @@ -// 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: test13.c -** -** Purpose: Tests sscanf with floats (decimal notation) -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../sscanf.h" - -int __cdecl main(int argc, char *argv[]) -{ - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - DoFloatTest("123.0", "%f", 123.0f); - DoFloatTest("123.0", "%2f", 12.0f); - DoFloatTest("10E1", "%f", 100.0f); - DoFloatTest("-12.01e-2", "%f", -0.1201f); - DoFloatTest("+12.01e-2", "%f", 0.1201f); - DoFloatTest("-12.01e+2", "%f", -1201.0f); - DoFloatTest("+12.01e+2", "%f", 1201.0f); - DoFloatTest("1234567890.0123456789f", "%f", 1234567936); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test13/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf/test13/testinfo.dat deleted file mode 100644 index 1c4c2fc26e..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test13/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = sscanf -Name = Positive Test for sscanf -TYPE = DEFAULT -EXE1 = test13 -Description -= Tests sscanf with floats (decimal notation) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test14/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf/test14/CMakeLists.txt deleted file mode 100644 index 373a75fbda..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test14/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test14.c -) - -add_executable(paltest_sscanf_test14 - ${SOURCES} -) - -add_dependencies(paltest_sscanf_test14 coreclrpal) - -target_link_libraries(paltest_sscanf_test14 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test14/test14.c b/src/pal/tests/palsuite/c_runtime/sscanf/test14/test14.c deleted file mode 100644 index d1291a3b65..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test14/test14.c +++ /dev/null @@ -1,36 +0,0 @@ -// 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: Tests sscanf with floats (exponential notation, lowercase) -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../sscanf.h" - -int __cdecl main(int argc, char *argv[]) -{ - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - DoFloatTest("123.0", "%e", 123.0f); - DoFloatTest("123.0", "%2e", 12.0f); - DoFloatTest("10E1", "%e", 100.0f); - DoFloatTest("-12.01e-2", "%e", -0.1201f); - DoFloatTest("+12.01e-2", "%e", 0.1201f); - DoFloatTest("-12.01e+2", "%e", -1201.0f); - DoFloatTest("+12.01e+2", "%e", 1201.0f); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test14/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf/test14/testinfo.dat deleted file mode 100644 index 97db6e4ffd..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test14/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = sscanf -Name = Positive Test for sscanf -TYPE = DEFAULT -EXE1 = test14 -Description -= Tests sscanf with floats (exponential notation, lowercase) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test15/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf/test15/CMakeLists.txt deleted file mode 100644 index d500901782..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test15/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test15.c -) - -add_executable(paltest_sscanf_test15 - ${SOURCES} -) - -add_dependencies(paltest_sscanf_test15 coreclrpal) - -target_link_libraries(paltest_sscanf_test15 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test15/test15.c b/src/pal/tests/palsuite/c_runtime/sscanf/test15/test15.c deleted file mode 100644 index fa51467d85..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test15/test15.c +++ /dev/null @@ -1,36 +0,0 @@ -// 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: test15.c -** -** Purpose: Tests sscanf with floats (exponential notation, uppercase -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../sscanf.h" - -int __cdecl main(int argc, char *argv[]) -{ - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - DoFloatTest("123.0", "%E", 123.0f); - DoFloatTest("123.0", "%2E", 12.0f); - DoFloatTest("10E1", "%E", 100.0f); - DoFloatTest("-12.01e-2", "%E", -0.1201f); - DoFloatTest("+12.01e-2", "%E", 0.1201f); - DoFloatTest("-12.01e+2", "%E", -1201.0f); - DoFloatTest("+12.01e+2", "%E", 1201.0f); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test15/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf/test15/testinfo.dat deleted file mode 100644 index 30c2cf4b30..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test15/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = sscanf -Name = Positive Test for sscanf -TYPE = DEFAULT -EXE1 = test15 -Description -= Tests sscanf with floats (exponential notation, uppercase) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test16/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf/test16/CMakeLists.txt deleted file mode 100644 index c5e18ec061..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test16/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test16.c -) - -add_executable(paltest_sscanf_test16 - ${SOURCES} -) - -add_dependencies(paltest_sscanf_test16 coreclrpal) - -target_link_libraries(paltest_sscanf_test16 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test16/test16.c b/src/pal/tests/palsuite/c_runtime/sscanf/test16/test16.c deleted file mode 100644 index 787b72ed0a..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test16/test16.c +++ /dev/null @@ -1,37 +0,0 @@ -// 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: test16.c -** -** Purpose:Tests sscanf with floats (compact notation, lowercase) -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../sscanf.h" - -int __cdecl main(int argc, char *argv[]) -{ - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - DoFloatTest("123.0", "%g", 123.0f); - DoFloatTest("123.0", "%2g", 12.0f); - DoFloatTest("10E1", "%g", 100.0f); - DoFloatTest("-12.01e-2", "%g", -0.1201f); - DoFloatTest("+12.01e-2", "%g", 0.1201f); - DoFloatTest("-12.01e+2", "%g", -1201.0f); - DoFloatTest("+12.01e+2", "%g", 1201.0f); - DoFloatTest("1234567890.0123456789g", "%g", 1234567936); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test16/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf/test16/testinfo.dat deleted file mode 100644 index 2c1dd42b70..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test16/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = sscanf -Name = Positive Test for sscanf -TYPE = DEFAULT -EXE1 = test16 -Description -= Tests sscanf with floats (compact notation, lowercase) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test17/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf/test17/CMakeLists.txt deleted file mode 100644 index 7d908ab832..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test17/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test17.c -) - -add_executable(paltest_sscanf_test17 - ${SOURCES} -) - -add_dependencies(paltest_sscanf_test17 coreclrpal) - -target_link_libraries(paltest_sscanf_test17 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test17/test17.c b/src/pal/tests/palsuite/c_runtime/sscanf/test17/test17.c deleted file mode 100644 index c0dfd1699c..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test17/test17.c +++ /dev/null @@ -1,37 +0,0 @@ -// 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: test17.c -** -** Purpose: Tests sscanf with floats (compact notation, uppercase) -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../sscanf.h" - -int __cdecl main(int argc, char *argv[]) -{ - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - DoFloatTest("123.0", "%G", 123.0f); - DoFloatTest("123.0", "%2G", 12.0f); - DoFloatTest("10E1", "%G", 100.0f); - DoFloatTest("-12.01e-2", "%G", -0.1201f); - DoFloatTest("+12.01e-2", "%G", 0.1201f); - DoFloatTest("-12.01e+2", "%G", -1201.0f); - DoFloatTest("+12.01e+2", "%G", 1201.0f); - DoFloatTest("1234567890.0123456789G", "%G", 1234567936); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test17/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf/test17/testinfo.dat deleted file mode 100644 index e23be8541e..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test17/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = sscanf -Name = Positive Test for sscanf -TYPE = DEFAULT -EXE1 = test17 -Description -= Tests sscanf with floats (compact notation, uppercase) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf/test2/CMakeLists.txt deleted file mode 100644 index 571d773a88..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test2/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test2.c -) - -add_executable(paltest_sscanf_test2 - ${SOURCES} -) - -add_dependencies(paltest_sscanf_test2 coreclrpal) - -target_link_libraries(paltest_sscanf_test2 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test2/test2.c b/src/pal/tests/palsuite/c_runtime/sscanf/test2/test2.c deleted file mode 100644 index 1221124e3a..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test2/test2.c +++ /dev/null @@ -1,44 +0,0 @@ -// 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: test2.c -** -** Purpose: Test to see if sscanf handles whitespace correctly -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../sscanf.h" - - -/* - * Tests out how it handles whitespace. Seems to accept anything that qualifies - * as isspace (space, tab, vertical tab, line feed, carriage return and form - * feed), even if it says it only wants spaces tabs and newlines. - */ - -int __cdecl main(int argc, char *argv[]) -{ - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - DoStrTest("foo bar", "foo %s", "bar"); - DoStrTest("foo\tbar", "foo %s", "bar"); - DoStrTest("foo\nbar", "foo %s", "bar"); - DoStrTest("foo\rbar", "foo %s", "bar"); - DoStrTest("foo\vbar", "foo %s", "bar"); - DoStrTest("foo\fbar", "foo %s", "bar"); - DoStrTest("foo \t\n\r\v\fbar", "foo %s", "bar"); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf/test2/testinfo.dat deleted file mode 100644 index f5ee4b52d4..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test2/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = sscanf -Name = Positive Test for sscanf -TYPE = DEFAULT -EXE1 = test2 -Description -= Test to see if sscanf handles whitespace correctly diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf/test3/CMakeLists.txt deleted file mode 100644 index ced8d5f8da..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test3/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test3.c -) - -add_executable(paltest_sscanf_test3 - ${SOURCES} -) - -add_dependencies(paltest_sscanf_test3 coreclrpal) - -target_link_libraries(paltest_sscanf_test3 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test3/test3.c b/src/pal/tests/palsuite/c_runtime/sscanf/test3/test3.c deleted file mode 100644 index 9d18991070..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test3/test3.c +++ /dev/null @@ -1,35 +0,0 @@ -// 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: test3.c -** -** Purpose: Tests sscanf with bracketed set strings -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../sscanf.h" - -int __cdecl main(int argc, char *argv[]) -{ - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - DoStrTest("bar1", "%[a-z]", "bar"); - DoStrTest("bar1", "%[z-a]", "bar"); - DoStrTest("bar1", "%[ab]", "ba"); - DoStrTest("bar1", "%[ar1b]", "bar1"); - DoStrTest("bar1", "%[^4]", "bar1"); - DoStrTest("bar1", "%[^4a]", "b"); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test3/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf/test3/testinfo.dat deleted file mode 100644 index c38a498225..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test3/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = sscanf -Name = Positive Test for sscanf -TYPE = DEFAULT -EXE1 = test3 -Description -= Tests sscanf with bracketed set strings diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test4/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf/test4/CMakeLists.txt deleted file mode 100644 index 3e70d6dae2..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test4/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test4.c -) - -add_executable(paltest_sscanf_test4 - ${SOURCES} -) - -add_dependencies(paltest_sscanf_test4 coreclrpal) - -target_link_libraries(paltest_sscanf_test4 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test4/test4.c b/src/pal/tests/palsuite/c_runtime/sscanf/test4/test4.c deleted file mode 100644 index dd0538bcfe..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test4/test4.c +++ /dev/null @@ -1,44 +0,0 @@ -// 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: test4.c -** -** Purpose: Tests sscanf with decimal numbers -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../sscanf.h" - - -int __cdecl main(int argc, char *argv[]) -{ - int n65535 = 65535; /* Walkaround compiler strictness */ - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - DoNumTest("1234d", "%d", 1234); - DoNumTest("1234d", "%2d", 12); - DoNumTest("-1", "%d", -1); - DoNumTest("0x1234", "%d", 0); - DoNumTest("012", "%d", 12); - DoShortNumTest("-1", "%hd", n65535); - DoShortNumTest("65536", "%hd", 0); - DoNumTest("-1", "%ld", -1); - DoNumTest("65536", "%ld", 65536); - DoNumTest("-1", "%Ld", -1); - DoNumTest("65536", "%Ld", 65536); - DoI64NumTest("4294967296", "%I64d", I64(4294967296)); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test4/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf/test4/testinfo.dat deleted file mode 100644 index 868056a6a5..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test4/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = sscanf -Name = Positive Test for sscanf -TYPE = DEFAULT -EXE1 = test4 -Description -= Tests sscanf with decimal numbers diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test5/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf/test5/CMakeLists.txt deleted file mode 100644 index 391e51baa2..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test5/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test5.c -) - -add_executable(paltest_sscanf_test5 - ${SOURCES} -) - -add_dependencies(paltest_sscanf_test5 coreclrpal) - -target_link_libraries(paltest_sscanf_test5 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test5/test5.c b/src/pal/tests/palsuite/c_runtime/sscanf/test5/test5.c deleted file mode 100644 index 0d45248af3..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test5/test5.c +++ /dev/null @@ -1,43 +0,0 @@ -// 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: test5.c -** -** Purpose: Tests sscanf with integer numbers -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../sscanf.h" - -int __cdecl main(int argc, char *argv[]) -{ - int n65535 = 65535; /* Walkaround compiler strictness */ - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - DoNumTest("1234d", "%i", 1234); - DoNumTest("1234d", "%2i", 12); - DoNumTest("-1", "%i", -1); - DoNumTest("0x1234", "%i", 0x1234); - DoNumTest("012", "%i", 10); - DoShortNumTest("-1", "%hi", n65535); - DoShortNumTest("65536", "%hi", 0); - DoNumTest("-1", "%li", -1); - DoNumTest("65536", "%li", 65536); - DoNumTest("-1", "%Li", -1); - DoNumTest("65536", "%Li", 65536); - DoI64NumTest("4294967296", "%I64i", I64(4294967296)); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test5/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf/test5/testinfo.dat deleted file mode 100644 index 8678dc8f5a..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test5/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = sscanf -Name = Positive Test for sscanf -TYPE = DEFAULT -EXE1 = test5 -Description -= Tests sscanf with integer numbers diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test6/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf/test6/CMakeLists.txt deleted file mode 100644 index c0b21bfd0d..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test6/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test6.c -) - -add_executable(paltest_sscanf_test6 - ${SOURCES} -) - -add_dependencies(paltest_sscanf_test6 coreclrpal) - -target_link_libraries(paltest_sscanf_test6 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test6/test6.c b/src/pal/tests/palsuite/c_runtime/sscanf/test6/test6.c deleted file mode 100644 index c45ea31b04..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test6/test6.c +++ /dev/null @@ -1,43 +0,0 @@ -// 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: test6.c -** -** Purpose: Tests sscanf with octal numbers -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../sscanf.h" - -int __cdecl main(int argc, char *argv[]) -{ - int n65535 = 65535; /* Walkaround compiler strictness */ - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - DoNumTest("1234d", "%o", 668); - DoNumTest("1234d", "%2o", 10); - DoNumTest("-1", "%o", -1); - DoNumTest("0x1234", "%o", 0); - DoNumTest("012", "%o", 10); - DoShortNumTest("-1", "%ho", n65535); - DoShortNumTest("200000", "%ho", 0); - DoNumTest("-1", "%lo", -1); - DoNumTest("200000", "%lo", 65536); - DoNumTest("-1", "%Lo", -1); - DoNumTest("200000", "%Lo", 65536); - DoI64NumTest("40000000000", "%I64o", I64(4294967296)); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test6/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf/test6/testinfo.dat deleted file mode 100644 index b2547a776a..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test6/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = sscanf -Name = Positive Test for sscanf -TYPE = DEFAULT -EXE1 = test6 -Description -= Tests sscanf with octal numbers diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test7/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf/test7/CMakeLists.txt deleted file mode 100644 index bcbd268011..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test7/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test7.c -) - -add_executable(paltest_sscanf_test7 - ${SOURCES} -) - -add_dependencies(paltest_sscanf_test7 coreclrpal) - -target_link_libraries(paltest_sscanf_test7 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test7/test7.c b/src/pal/tests/palsuite/c_runtime/sscanf/test7/test7.c deleted file mode 100644 index 0899671d64..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test7/test7.c +++ /dev/null @@ -1,43 +0,0 @@ -// 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: test7.c -** -** Purpose: Tests sscanf with hex numbers (lowercase) -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../sscanf.h" - -int __cdecl main(int argc, char *argv[]) -{ - int n65535 = 65535; /* Walkaround compiler strictness */ - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - DoNumTest("1234i", "%x", 0x1234); - DoNumTest("1234i", "%2x", 0x12); - DoNumTest("-1", "%x", -1); - DoNumTest("0x1234", "%x", 0x1234); - DoNumTest("012", "%x", 0x12); - DoShortNumTest("-1", "%hx", n65535); - DoShortNumTest("10000", "%hx", 0); - DoNumTest("-1", "%lx", -1); - DoNumTest("10000", "%lx", 65536); - DoNumTest("-1", "%Lx", -1); - DoNumTest("10000", "%Lx", 65536); - DoI64NumTest("100000000", "%I64x", I64(4294967296)); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test7/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf/test7/testinfo.dat deleted file mode 100644 index 614333e650..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test7/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = sscanf -Name = Positive Test for sscanf -TYPE = DEFAULT -EXE1 = test7 -Description -= Tests sscanf with hex numbers (lowercase) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test8/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf/test8/CMakeLists.txt deleted file mode 100644 index 211e9e4df6..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test8/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test8.c -) - -add_executable(paltest_sscanf_test8 - ${SOURCES} -) - -add_dependencies(paltest_sscanf_test8 coreclrpal) - -target_link_libraries(paltest_sscanf_test8 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test8/test8.c b/src/pal/tests/palsuite/c_runtime/sscanf/test8/test8.c deleted file mode 100644 index 53252f8929..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test8/test8.c +++ /dev/null @@ -1,43 +0,0 @@ -// 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: test8.c -** -** Purpose:Tests sscanf with unsigned number -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../sscanf.h" - -int __cdecl main(int argc, char *argv[]) -{ - int n65535 = 65535; /* Walkaround compiler strictness */ - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - DoNumTest("1234d", "%u", 1234); - DoNumTest("1234d", "%2u", 12); - DoNumTest("-1", "%u", -1); - DoNumTest("0x1234", "%u", 0); - DoNumTest("012", "%u", 12); - DoShortNumTest("-1", "%hu", n65535); - DoShortNumTest("65536", "%hu", 0); - DoNumTest("-1", "%lu", -1); - DoNumTest("65536", "%lu", 65536); - DoNumTest("-1", "%Lu", -1); - DoNumTest("65536", "%Lu", 65536); - DoI64NumTest("4294967296", "%I64u", I64(4294967296)); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test8/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf/test8/testinfo.dat deleted file mode 100644 index 2cbc31ad2a..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test8/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = sscanf -Name = Positive Test for sscanf -TYPE = DEFAULT -EXE1 = test8 -Description -= Tests sscanf with unsigned numbers diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test9/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf/test9/CMakeLists.txt deleted file mode 100644 index 77c269aeaa..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test9/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test9.c -) - -add_executable(paltest_sscanf_test9 - ${SOURCES} -) - -add_dependencies(paltest_sscanf_test9 coreclrpal) - -target_link_libraries(paltest_sscanf_test9 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test9/test9.c b/src/pal/tests/palsuite/c_runtime/sscanf/test9/test9.c deleted file mode 100644 index c5a2e0de5d..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test9/test9.c +++ /dev/null @@ -1,38 +0,0 @@ -// 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: test9.c -** -** Purpose: Tests sscanf with characters -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../sscanf.h" - - -int __cdecl main(int argc, char *argv[]) -{ - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - DoCharTest("1234d", "%c", "1", 1); - DoCharTest("1234d", "%c", "1", 1); - DoCharTest("abc", "%2c", "ab", 2); - DoCharTest(" ab", "%c", " ", 1); - DoCharTest("ab", "%hc", "a", 1); - DoWCharTest("ab", "%lc", convert("a"), 1); - DoCharTest("ab", "%Lc", "a", 1); - DoCharTest("ab", "%I64c", "a", 1); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test9/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf/test9/testinfo.dat deleted file mode 100644 index c0ccc8a4c9..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test9/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# 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 = sscanf -Name = Positive Test for sscanf -TYPE = DEFAULT -EXE1 = test9 -Description -= Tests sscanf with characters diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf_s/CMakeLists.txt index 59f39a5f58..59f39a5f58 100644 --- a/src/pal/tests/palsuite/c_runtime/sscanf/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/CMakeLists.txt diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/sscanf_s.h b/src/pal/tests/palsuite/c_runtime/sscanf_s/sscanf_s.h new file mode 100644 index 0000000000..8a99d87cb4 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/sscanf_s.h @@ -0,0 +1,246 @@ +// 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: sscanf_s.h +** +** Purpose: Contains common testing functions for sscanf_s +** +** +**==========================================================================*/ + +#ifndef __SSCANF_S_H__ +#define __SSCANF_S_H__ + +void DoVoidTest(char *inputstr, const char *formatstr) +{ + char buf[256] = { 0 }; + int i; + int ret; + + ret = sscanf_s(inputstr, formatstr, buf); + if (ret != 0) + { + Fail("ERROR: Expected sscanf_s to return 0, got %d.\n" + "Using \"%s\" in \"%s\".\n", ret, inputstr, formatstr); + } + + for (i=0; i<256; i++) + { + if (buf[i] != 0) + { + Fail("ERROR: Parameter unexpectedly modified scanning \"%s\" " + "using \"%s\".\n", inputstr, formatstr); + } + } + +} + +void DoStrTest(char *inputstr, const char *formatstr, const char *checkstr) +{ + char buf[256] = { 0 }; + int ret; + + ret = sscanf_s(inputstr, formatstr, buf, _countof(buf)); + if (ret != 1) + { + Fail("ERROR: Expected sscanf_s to return 1, got %d.\n" + "Using \"%s\" in \"%s\".\n", ret, inputstr, formatstr); + } + + if (memcmp(checkstr, buf, strlen(checkstr) + 1) != 0) + { + Fail("ERROR: scanned string incorrectly from \"%s\" using \"%s\".\n" + "Expected \"%s\", got \"%s\".\n", inputstr, formatstr, checkstr, + buf); + } + +} + +void DoWStrTest(char *inputstr, const char *formatstr, const WCHAR *checkstr) +{ + WCHAR buf[256] = { 0 }; + int ret; + + ret = sscanf_s(inputstr, formatstr, buf, _countof(buf)); + if (ret != 1) + { + Fail("ERROR: Expected sscanf_s to return 1, got %d.\n" + "Using \"%s\" in \"%s\".\n", ret, inputstr, formatstr); + } + + if (memcmp(checkstr, buf, wcslen(checkstr)*2 + 2) != 0) + { + Fail("ERROR: scanned wide string incorrectly from \"%s\" using \"%s\".\n" + "Expected \"%s\", got \"%s\".\n", inputstr, formatstr, + convertC(checkstr), convertC(buf)); + } + +} + +void DoNumTest(char *inputstr, const char *formatstr, int checknum) +{ + int num; + int ret; + + ret = sscanf_s(inputstr, formatstr, &num); + if (ret != 1) + { + Fail("ERROR: Expected sscanf_s to return 1, got %d.\n" + "Using \"%s\" in \"%s\".\n", ret, inputstr, formatstr); + } + + if (checknum != num) + { + Fail("ERROR: scanned number incorrectly from \"%s\" using \"%s\".\n" + "Expected %d, got %d.\n", inputstr, formatstr, checknum, num); + } +} + +void DoShortNumTest(char *inputstr, const char *formatstr, short checknum) +{ + short num; + int ret; + + ret = sscanf_s(inputstr, formatstr, &num); + if (ret != 1) + { + Fail("ERROR: Expected sscanf_s to return 1, got %d.\n" + "Using \"%s\" in \"%s\".\n", ret, inputstr, formatstr); + } + + if (checknum != num) + { + Fail("ERROR: scanned number incorrectly from \"%s\" using \"%s\".\n" + "Expected %hd, got %hd.\n", inputstr, formatstr, checknum, num); + } +} + +void DoI64NumTest(char *inputstr, const char *formatstr, INT64 checknum) +{ + char buf[256]; + char check[256]; + INT64 num; + int ret; + + ret = sscanf_s(inputstr, formatstr, &num); + if (ret != 1) + { + Fail("ERROR: Expected sscanf_s to return 1, got %d.\n" + "Using \"%s\" in \"%s\".\n", ret, inputstr, formatstr); + } + + if (checknum != num) + { + sprintf_s(buf, _countof(buf), "%I64d", num); + sprintf_s(check, _countof(check), "%I64d", checknum); + Fail("ERROR: scanned I64 number incorrectly from \"%s\" using \"%s\".\n" + "Expected %s, got %s.\n", inputstr, formatstr, check, buf); + } +} + +void DoCharTest(char *inputstr, const char *formatstr, char* checkchars, int numchars) +{ + char buf[256]; + int ret; + int i; + + for (i=0; i<256; i++) + buf[i] = (char)-1; + + ret = sscanf_s(inputstr, formatstr, buf, _countof(buf)); + if (ret != 1) + { + Fail("ERROR: Expected sscanf_s to return 1, got %d.\n" + "Using \"%s\" in \"%s\".\n", ret, inputstr, formatstr); + } + + if (memcmp(buf, checkchars, numchars) != 0) + { + buf[numchars] = 0; + + Fail("ERROR: scanned character(s) incorrectly from \"%s\" using \"%s\".\n" + "Expected %s, got %s.\n", inputstr, formatstr, checkchars, + buf); + } + + if (buf[numchars] != (char)-1) + { + Fail("ERROR: overflow occurred in scanning character(s) from \"%s\" " + "using \"%s\".\nExpected %d character(s)\n", inputstr, formatstr, + numchars); + } +} + +void DoWCharTest(char *inputstr, const char *formatstr, WCHAR* checkchars, int numchars) +{ + WCHAR buf[256]; + int ret; + int i; + + for (i=0; i<256; i++) + buf[i] = (WCHAR)-1; + + ret = sscanf_s(inputstr, formatstr, buf, _countof(buf)); + if (ret != 1) + { + Fail("ERROR: Expected sscanf_s to return 1, got %d.\n" + "Using \"%s\" in \"%s\".\n", ret, inputstr, formatstr); + } + + if (memcmp(buf, checkchars, numchars) != 0) + { + buf[numchars] = 0; + + Fail("ERROR: scanned wide character(s) incorrectly from \"%s\" using \"%s\".\n" + "Expected %s, got %s.\n", inputstr, formatstr, convertC(checkchars), + convertC(buf)); + } + + if (buf[numchars] != (WCHAR)-1) + { + Fail("ERROR: overflow occurred in scanning wide character(s) from \"%s\" " + "using \"%s\".\nExpected %d character(s)\n", inputstr, formatstr, + numchars); + } +} + + +void DoFloatTest(char *inputstr, const char *formatstr, float checkval) +{ + char buf[256] = { 0 }; + float val; + int ret; + int i; + + for (i=0; i<256; i++) + buf[i] = (char)-1; + + ret = sscanf_s(inputstr, formatstr, buf); + val = *(float*)buf; + + if (ret != 1) + { + Fail("ERROR: Expected sscanf_s to return 1, got %d.\n" + "Using \"%s\" in \"%s\".\n", ret, inputstr, formatstr); + } + + if (val != checkval) + { + Fail("ERROR: scanned float incorrectly from \"%s\" using \"%s\".\n" + "Expected \"%f\", got \"%f\".\n", inputstr, formatstr, checkval, + val); + } + + if (buf[4] != (char)-1) + { + Fail("ERROR: overflow occurred in scanning float from \"%s\" " + "using \"%s\".\n", inputstr, formatstr); + + } +} + + +#endif diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf_s/test1/CMakeLists.txt new file mode 100644 index 0000000000..97b8f570e3 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test1/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test1.cpp +) + +add_executable(paltest_sscanf_test1 + ${SOURCES} +) + +add_dependencies(paltest_sscanf_test1 coreclrpal) + +target_link_libraries(paltest_sscanf_test1 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test1/test1.cpp b/src/pal/tests/palsuite/c_runtime/sscanf_s/test1/test1.cpp new file mode 100644 index 0000000000..61313146e5 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test1/test1.cpp @@ -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: test1.c +** +** Purpose: General test of sscanf_s +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../sscanf_s.h" + + +int __cdecl main(int argc, char *argv[]) +{ + int num; + int ret; + + if (PAL_Initialize(argc, argv)) + { + return FAIL; + } + + + DoVoidTest("foo bar", "foo "); + DoVoidTest("foo bar", "baz"); + DoVoidTest("foo bar", "foo %*s"); + + DoStrTest("foo % bar", "foo %% %s", "bar"); + DoStrTest("foo bar baz", "foo %bar %s", "baz"); + + DoVoidTest("foo bar baz", "foo % bar %s"); + DoVoidTest("foo baz bar", "foo% baz %s"); + + ret = sscanf_s("foo bar baz", "foo bar %n", &num); + if (ret != 0 || num != 8) + { + Fail("ERROR: Got incorrect values in scanning \"%s\" using \"%s\".\n" + "Expected to get a value of %d with return value of %d, " + "got %d with return %d\n", "foo bar baz", "foo bar %n", 8, 0, + num, ret); + + } + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf_s/test1/testinfo.dat new file mode 100644 index 0000000000..76f592769f --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test1/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sscanf_s +Name = Positive Test for sscanf_s +TYPE = DEFAULT +EXE1 = test1 +Description += General test of sscanf_s diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test10/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf_s/test10/CMakeLists.txt new file mode 100644 index 0000000000..afda216c6b --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test10/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test10.cpp +) + +add_executable(paltest_sscanf_test10 + ${SOURCES} +) + +add_dependencies(paltest_sscanf_test10 coreclrpal) + +target_link_libraries(paltest_sscanf_test10 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test10/test10.cpp b/src/pal/tests/palsuite/c_runtime/sscanf_s/test10/test10.cpp new file mode 100644 index 0000000000..0c63c864ed --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test10/test10.cpp @@ -0,0 +1,37 @@ +// 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: test10.c +** +** Purpose: Tests sscanf_s with wide characters +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../sscanf_s.h" + +int __cdecl main(int argc, char *argv[]) +{ + if (PAL_Initialize(argc, argv)) + { + return FAIL; + } + + DoWCharTest("1234d", "%C", convert("1"), 1); + DoWCharTest("1234d", "%C", convert("1"), 1); + DoWCharTest("abc", "%2C", convert("ab"), 2); + DoWCharTest(" ab", "%C", convert(" "), 1); + DoCharTest("ab", "%hC", "a", 1); + DoWCharTest("ab", "%lC", convert("a"), 1); + DoWCharTest("ab", "%LC", convert("a"), 1); + DoWCharTest("ab", "%I64C", convert("a"), 1); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test10/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf_s/test10/testinfo.dat new file mode 100644 index 0000000000..e048e700a0 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test10/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sscanf_s +Name = Positive Test for sscanf_s +TYPE = DEFAULT +EXE1 = test10 +Description += Tests sscanf_s with wide characters diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test11/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf_s/test11/CMakeLists.txt new file mode 100644 index 0000000000..c8f98aeeef --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test11/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test11.cpp +) + +add_executable(paltest_sscanf_test11 + ${SOURCES} +) + +add_dependencies(paltest_sscanf_test11 coreclrpal) + +target_link_libraries(paltest_sscanf_test11 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test11/test11.cpp b/src/pal/tests/palsuite/c_runtime/sscanf_s/test11/test11.cpp new file mode 100644 index 0000000000..8279f4b3f4 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test11/test11.cpp @@ -0,0 +1,36 @@ +// 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: test11.c +** +** Purpose: Tests sscanf_s with strings +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../sscanf_s.h" + +int __cdecl main(int argc, char *argv[]) +{ + + if (PAL_Initialize(argc, argv)) + { + return FAIL; + } + + DoStrTest("foo bar", "foo %s", "bar"); + DoStrTest("foo bar", "foo %2s", "ba"); + DoStrTest("foo bar", "foo %hs", "bar"); + DoWStrTest("foo bar", "foo %ls", convert("bar")); + DoStrTest("foo bar", "foo %Ls", "bar"); + DoStrTest("foo bar", "foo %I64s", "bar"); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test11/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf_s/test11/testinfo.dat new file mode 100644 index 0000000000..5a906ddf51 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test11/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sscanf_s +Name = Positive Test for sscanf_s +TYPE = DEFAULT +EXE1 = test11 +Description += Tests sscanf_s with strings diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test12/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf_s/test12/CMakeLists.txt new file mode 100644 index 0000000000..0ecedc3285 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test12/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test12.cpp +) + +add_executable(paltest_sscanf_test12 + ${SOURCES} +) + +add_dependencies(paltest_sscanf_test12 coreclrpal) + +target_link_libraries(paltest_sscanf_test12 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test12/test12.cpp b/src/pal/tests/palsuite/c_runtime/sscanf_s/test12/test12.cpp new file mode 100644 index 0000000000..e599534270 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test12/test12.cpp @@ -0,0 +1,35 @@ +// 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: test12.c +** +** Purpose: Tests sscanf_s with wide strings +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../sscanf_s.h" + +int __cdecl main(int argc, char *argv[]) +{ + if (PAL_Initialize(argc, argv)) + { + return FAIL; + } + + DoWStrTest("foo bar", "foo %S", convert("bar")); + DoWStrTest("foo bar", "foo %2S", convert("ba")); + DoStrTest("foo bar", "foo %hS", "bar"); + DoWStrTest("foo bar", "foo %lS", convert("bar")); + DoWStrTest("foo bar", "foo %LS", convert("bar")); + DoWStrTest("foo bar", "foo %I64S", convert("bar")); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test12/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf_s/test12/testinfo.dat new file mode 100644 index 0000000000..569be983c0 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test12/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sscanf_s +Name = Positive Test for sscanf_s +TYPE = DEFAULT +EXE1 = test12 +Description += Tests sscanf_s with wide strings diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test13/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf_s/test13/CMakeLists.txt new file mode 100644 index 0000000000..4566ec3338 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test13/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test13.cpp +) + +add_executable(paltest_sscanf_test13 + ${SOURCES} +) + +add_dependencies(paltest_sscanf_test13 coreclrpal) + +target_link_libraries(paltest_sscanf_test13 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test13/test13.cpp b/src/pal/tests/palsuite/c_runtime/sscanf_s/test13/test13.cpp new file mode 100644 index 0000000000..4fc12bb751 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test13/test13.cpp @@ -0,0 +1,37 @@ +// 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: test13.c +** +** Purpose: Tests sscanf_s with floats (decimal notation) +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../sscanf_s.h" + +int __cdecl main(int argc, char *argv[]) +{ + if (PAL_Initialize(argc, argv)) + { + return FAIL; + } + + DoFloatTest("123.0", "%f", 123.0f); + DoFloatTest("123.0", "%2f", 12.0f); + DoFloatTest("10E1", "%f", 100.0f); + DoFloatTest("-12.01e-2", "%f", -0.1201f); + DoFloatTest("+12.01e-2", "%f", 0.1201f); + DoFloatTest("-12.01e+2", "%f", -1201.0f); + DoFloatTest("+12.01e+2", "%f", 1201.0f); + DoFloatTest("1234567890.0123456789f", "%f", 1234567936); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test13/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf_s/test13/testinfo.dat new file mode 100644 index 0000000000..651577befd --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test13/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sscanf_s +Name = Positive Test for sscanf_s +TYPE = DEFAULT +EXE1 = test13 +Description += Tests sscanf_s with floats (decimal notation) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test14/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf_s/test14/CMakeLists.txt new file mode 100644 index 0000000000..557acf5bf8 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_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_sscanf_test14 + ${SOURCES} +) + +add_dependencies(paltest_sscanf_test14 coreclrpal) + +target_link_libraries(paltest_sscanf_test14 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test14/test14.cpp b/src/pal/tests/palsuite/c_runtime/sscanf_s/test14/test14.cpp new file mode 100644 index 0000000000..fc2fa2ee15 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test14/test14.cpp @@ -0,0 +1,36 @@ +// 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: Tests sscanf_s with floats (exponential notation, lowercase) +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../sscanf_s.h" + +int __cdecl main(int argc, char *argv[]) +{ + if (PAL_Initialize(argc, argv)) + { + return FAIL; + } + + DoFloatTest("123.0", "%e", 123.0f); + DoFloatTest("123.0", "%2e", 12.0f); + DoFloatTest("10E1", "%e", 100.0f); + DoFloatTest("-12.01e-2", "%e", -0.1201f); + DoFloatTest("+12.01e-2", "%e", 0.1201f); + DoFloatTest("-12.01e+2", "%e", -1201.0f); + DoFloatTest("+12.01e+2", "%e", 1201.0f); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test14/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf_s/test14/testinfo.dat new file mode 100644 index 0000000000..8e7338fd46 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test14/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sscanf_s +Name = Positive Test for sscanf_s +TYPE = DEFAULT +EXE1 = test14 +Description += Tests sscanf_s with floats (exponential notation, lowercase) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test15/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf_s/test15/CMakeLists.txt new file mode 100644 index 0000000000..efde5c4a21 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test15/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test15.cpp +) + +add_executable(paltest_sscanf_test15 + ${SOURCES} +) + +add_dependencies(paltest_sscanf_test15 coreclrpal) + +target_link_libraries(paltest_sscanf_test15 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test15/test15.cpp b/src/pal/tests/palsuite/c_runtime/sscanf_s/test15/test15.cpp new file mode 100644 index 0000000000..1eff995b86 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test15/test15.cpp @@ -0,0 +1,36 @@ +// 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: test15.c +** +** Purpose: Tests sscanf_s with floats (exponential notation, uppercase +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../sscanf_s.h" + +int __cdecl main(int argc, char *argv[]) +{ + if (PAL_Initialize(argc, argv)) + { + return FAIL; + } + + DoFloatTest("123.0", "%E", 123.0f); + DoFloatTest("123.0", "%2E", 12.0f); + DoFloatTest("10E1", "%E", 100.0f); + DoFloatTest("-12.01e-2", "%E", -0.1201f); + DoFloatTest("+12.01e-2", "%E", 0.1201f); + DoFloatTest("-12.01e+2", "%E", -1201.0f); + DoFloatTest("+12.01e+2", "%E", 1201.0f); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test15/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf_s/test15/testinfo.dat new file mode 100644 index 0000000000..d713a73d81 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test15/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sscanf_s +Name = Positive Test for sscanf_s +TYPE = DEFAULT +EXE1 = test15 +Description += Tests sscanf_s with floats (exponential notation, uppercase) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test16/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf_s/test16/CMakeLists.txt new file mode 100644 index 0000000000..6757b0d78a --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test16/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test16.cpp +) + +add_executable(paltest_sscanf_test16 + ${SOURCES} +) + +add_dependencies(paltest_sscanf_test16 coreclrpal) + +target_link_libraries(paltest_sscanf_test16 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test16/test16.cpp b/src/pal/tests/palsuite/c_runtime/sscanf_s/test16/test16.cpp new file mode 100644 index 0000000000..f202767448 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test16/test16.cpp @@ -0,0 +1,37 @@ +// 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: test16.c +** +** Purpose:Tests sscanf_s with floats (compact notation, lowercase) +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../sscanf_s.h" + +int __cdecl main(int argc, char *argv[]) +{ + if (PAL_Initialize(argc, argv)) + { + return FAIL; + } + + DoFloatTest("123.0", "%g", 123.0f); + DoFloatTest("123.0", "%2g", 12.0f); + DoFloatTest("10E1", "%g", 100.0f); + DoFloatTest("-12.01e-2", "%g", -0.1201f); + DoFloatTest("+12.01e-2", "%g", 0.1201f); + DoFloatTest("-12.01e+2", "%g", -1201.0f); + DoFloatTest("+12.01e+2", "%g", 1201.0f); + DoFloatTest("1234567890.0123456789g", "%g", 1234567936); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test16/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf_s/test16/testinfo.dat new file mode 100644 index 0000000000..669611945d --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test16/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sscanf_s +Name = Positive Test for sscanf_s +TYPE = DEFAULT +EXE1 = test16 +Description += Tests sscanf_s with floats (compact notation, lowercase) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test17/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf_s/test17/CMakeLists.txt new file mode 100644 index 0000000000..8ea4d5e3f6 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test17/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test17.cpp +) + +add_executable(paltest_sscanf_test17 + ${SOURCES} +) + +add_dependencies(paltest_sscanf_test17 coreclrpal) + +target_link_libraries(paltest_sscanf_test17 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test17/test17.cpp b/src/pal/tests/palsuite/c_runtime/sscanf_s/test17/test17.cpp new file mode 100644 index 0000000000..a18c3caff1 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test17/test17.cpp @@ -0,0 +1,37 @@ +// 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: test17.c +** +** Purpose: Tests sscanf_s with floats (compact notation, uppercase) +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../sscanf_s.h" + +int __cdecl main(int argc, char *argv[]) +{ + if (PAL_Initialize(argc, argv)) + { + return FAIL; + } + + DoFloatTest("123.0", "%G", 123.0f); + DoFloatTest("123.0", "%2G", 12.0f); + DoFloatTest("10E1", "%G", 100.0f); + DoFloatTest("-12.01e-2", "%G", -0.1201f); + DoFloatTest("+12.01e-2", "%G", 0.1201f); + DoFloatTest("-12.01e+2", "%G", -1201.0f); + DoFloatTest("+12.01e+2", "%G", 1201.0f); + DoFloatTest("1234567890.0123456789G", "%G", 1234567936); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test17/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf_s/test17/testinfo.dat new file mode 100644 index 0000000000..8ce4e93e1a --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test17/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sscanf_s +Name = Positive Test for sscanf_s +TYPE = DEFAULT +EXE1 = test17 +Description += Tests sscanf_s with floats (compact notation, uppercase) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf_s/test2/CMakeLists.txt new file mode 100644 index 0000000000..4e36223a1d --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test2/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test2.cpp +) + +add_executable(paltest_sscanf_test2 + ${SOURCES} +) + +add_dependencies(paltest_sscanf_test2 coreclrpal) + +target_link_libraries(paltest_sscanf_test2 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test2/test2.cpp b/src/pal/tests/palsuite/c_runtime/sscanf_s/test2/test2.cpp new file mode 100644 index 0000000000..c9c79f67ea --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test2/test2.cpp @@ -0,0 +1,44 @@ +// 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: test2.c +** +** Purpose: Test to see if sscanf_s handles whitespace correctly +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../sscanf_s.h" + + +/* + * Tests out how it handles whitespace. Seems to accept anything that qualifies + * as isspace (space, tab, vertical tab, line feed, carriage return and form + * feed), even if it says it only wants spaces tabs and newlines. + */ + +int __cdecl main(int argc, char *argv[]) +{ + + if (PAL_Initialize(argc, argv)) + { + return FAIL; + } + + DoStrTest("foo bar", "foo %s", "bar"); + DoStrTest("foo\tbar", "foo %s", "bar"); + DoStrTest("foo\nbar", "foo %s", "bar"); + DoStrTest("foo\rbar", "foo %s", "bar"); + DoStrTest("foo\vbar", "foo %s", "bar"); + DoStrTest("foo\fbar", "foo %s", "bar"); + DoStrTest("foo \t\n\r\v\fbar", "foo %s", "bar"); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf_s/test2/testinfo.dat new file mode 100644 index 0000000000..85fed244f9 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test2/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sscanf_s +Name = Positive Test for sscanf_s +TYPE = DEFAULT +EXE1 = test2 +Description += Test to see if sscanf_s handles whitespace correctly diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf_s/test3/CMakeLists.txt new file mode 100644 index 0000000000..053a96ca0f --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test3/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test3.cpp +) + +add_executable(paltest_sscanf_test3 + ${SOURCES} +) + +add_dependencies(paltest_sscanf_test3 coreclrpal) + +target_link_libraries(paltest_sscanf_test3 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test3/test3.cpp b/src/pal/tests/palsuite/c_runtime/sscanf_s/test3/test3.cpp new file mode 100644 index 0000000000..e1e45bdd70 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test3/test3.cpp @@ -0,0 +1,35 @@ +// 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: test3.c +** +** Purpose: Tests sscanf_s with bracketed set strings +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../sscanf_s.h" + +int __cdecl main(int argc, char *argv[]) +{ + if (PAL_Initialize(argc, argv)) + { + return FAIL; + } + + DoStrTest("bar1", "%[a-z]", "bar"); + DoStrTest("bar1", "%[z-a]", "bar"); + DoStrTest("bar1", "%[ab]", "ba"); + DoStrTest("bar1", "%[ar1b]", "bar1"); + DoStrTest("bar1", "%[^4]", "bar1"); + DoStrTest("bar1", "%[^4a]", "b"); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test3/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf_s/test3/testinfo.dat new file mode 100644 index 0000000000..523d31e82e --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test3/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sscanf_s +Name = Positive Test for sscanf_s +TYPE = DEFAULT +EXE1 = test3 +Description += Tests sscanf_s with bracketed set strings diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test4/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf_s/test4/CMakeLists.txt new file mode 100644 index 0000000000..ae04bfef57 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test4/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test4.cpp +) + +add_executable(paltest_sscanf_test4 + ${SOURCES} +) + +add_dependencies(paltest_sscanf_test4 coreclrpal) + +target_link_libraries(paltest_sscanf_test4 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test4/test4.cpp b/src/pal/tests/palsuite/c_runtime/sscanf_s/test4/test4.cpp new file mode 100644 index 0000000000..f8413ea7fd --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test4/test4.cpp @@ -0,0 +1,44 @@ +// 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: test4.c +** +** Purpose: Tests sscanf_s with decimal numbers +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../sscanf_s.h" + + +int __cdecl main(int argc, char *argv[]) +{ + int n65535 = 65535; /* Walkaround compiler strictness */ + + if (PAL_Initialize(argc, argv)) + { + return FAIL; + } + + DoNumTest("1234d", "%d", 1234); + DoNumTest("1234d", "%2d", 12); + DoNumTest("-1", "%d", -1); + DoNumTest("0x1234", "%d", 0); + DoNumTest("012", "%d", 12); + DoShortNumTest("-1", "%hd", n65535); + DoShortNumTest("65536", "%hd", 0); + DoNumTest("-1", "%ld", -1); + DoNumTest("65536", "%ld", 65536); + DoNumTest("-1", "%Ld", -1); + DoNumTest("65536", "%Ld", 65536); + DoI64NumTest("4294967296", "%I64d", I64(4294967296)); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test4/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf_s/test4/testinfo.dat new file mode 100644 index 0000000000..2065f2bea2 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test4/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sscanf_s +Name = Positive Test for sscanf_s +TYPE = DEFAULT +EXE1 = test4 +Description += Tests sscanf_s with decimal numbers diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test5/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf_s/test5/CMakeLists.txt new file mode 100644 index 0000000000..33dcaffec3 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test5/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test5.cpp +) + +add_executable(paltest_sscanf_test5 + ${SOURCES} +) + +add_dependencies(paltest_sscanf_test5 coreclrpal) + +target_link_libraries(paltest_sscanf_test5 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test5/test5.cpp b/src/pal/tests/palsuite/c_runtime/sscanf_s/test5/test5.cpp new file mode 100644 index 0000000000..cdfefd860b --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test5/test5.cpp @@ -0,0 +1,43 @@ +// 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: test5.c +** +** Purpose: Tests sscanf_s with integer numbers +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../sscanf_s.h" + +int __cdecl main(int argc, char *argv[]) +{ + int n65535 = 65535; /* Walkaround compiler strictness */ + + if (PAL_Initialize(argc, argv)) + { + return FAIL; + } + + DoNumTest("1234d", "%i", 1234); + DoNumTest("1234d", "%2i", 12); + DoNumTest("-1", "%i", -1); + DoNumTest("0x1234", "%i", 0x1234); + DoNumTest("012", "%i", 10); + DoShortNumTest("-1", "%hi", n65535); + DoShortNumTest("65536", "%hi", 0); + DoNumTest("-1", "%li", -1); + DoNumTest("65536", "%li", 65536); + DoNumTest("-1", "%Li", -1); + DoNumTest("65536", "%Li", 65536); + DoI64NumTest("4294967296", "%I64i", I64(4294967296)); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test5/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf_s/test5/testinfo.dat new file mode 100644 index 0000000000..cb687c15cd --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test5/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sscanf_s +Name = Positive Test for sscanf_s +TYPE = DEFAULT +EXE1 = test5 +Description += Tests sscanf_s with integer numbers diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test6/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf_s/test6/CMakeLists.txt new file mode 100644 index 0000000000..1dd23c3cb1 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test6/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test6.cpp +) + +add_executable(paltest_sscanf_test6 + ${SOURCES} +) + +add_dependencies(paltest_sscanf_test6 coreclrpal) + +target_link_libraries(paltest_sscanf_test6 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test6/test6.cpp b/src/pal/tests/palsuite/c_runtime/sscanf_s/test6/test6.cpp new file mode 100644 index 0000000000..507b100e15 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test6/test6.cpp @@ -0,0 +1,43 @@ +// 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: test6.c +** +** Purpose: Tests sscanf_s with octal numbers +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../sscanf_s.h" + +int __cdecl main(int argc, char *argv[]) +{ + int n65535 = 65535; /* Walkaround compiler strictness */ + + if (PAL_Initialize(argc, argv)) + { + return FAIL; + } + + DoNumTest("1234d", "%o", 668); + DoNumTest("1234d", "%2o", 10); + DoNumTest("-1", "%o", -1); + DoNumTest("0x1234", "%o", 0); + DoNumTest("012", "%o", 10); + DoShortNumTest("-1", "%ho", n65535); + DoShortNumTest("200000", "%ho", 0); + DoNumTest("-1", "%lo", -1); + DoNumTest("200000", "%lo", 65536); + DoNumTest("-1", "%Lo", -1); + DoNumTest("200000", "%Lo", 65536); + DoI64NumTest("40000000000", "%I64o", I64(4294967296)); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test6/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf_s/test6/testinfo.dat new file mode 100644 index 0000000000..9e518dddf2 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test6/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sscanf_s +Name = Positive Test for sscanf_s +TYPE = DEFAULT +EXE1 = test6 +Description += Tests sscanf_s with octal numbers diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test7/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf_s/test7/CMakeLists.txt new file mode 100644 index 0000000000..015a27b776 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test7/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test7.cpp +) + +add_executable(paltest_sscanf_test7 + ${SOURCES} +) + +add_dependencies(paltest_sscanf_test7 coreclrpal) + +target_link_libraries(paltest_sscanf_test7 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test7/test7.cpp b/src/pal/tests/palsuite/c_runtime/sscanf_s/test7/test7.cpp new file mode 100644 index 0000000000..4093e009e1 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test7/test7.cpp @@ -0,0 +1,43 @@ +// 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: test7.c +** +** Purpose: Tests sscanf_s with hex numbers (lowercase) +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../sscanf_s.h" + +int __cdecl main(int argc, char *argv[]) +{ + int n65535 = 65535; /* Walkaround compiler strictness */ + + if (PAL_Initialize(argc, argv)) + { + return FAIL; + } + + DoNumTest("1234i", "%x", 0x1234); + DoNumTest("1234i", "%2x", 0x12); + DoNumTest("-1", "%x", -1); + DoNumTest("0x1234", "%x", 0x1234); + DoNumTest("012", "%x", 0x12); + DoShortNumTest("-1", "%hx", n65535); + DoShortNumTest("10000", "%hx", 0); + DoNumTest("-1", "%lx", -1); + DoNumTest("10000", "%lx", 65536); + DoNumTest("-1", "%Lx", -1); + DoNumTest("10000", "%Lx", 65536); + DoI64NumTest("100000000", "%I64x", I64(4294967296)); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test7/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf_s/test7/testinfo.dat new file mode 100644 index 0000000000..8d6c182c90 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test7/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sscanf_s +Name = Positive Test for sscanf_s +TYPE = DEFAULT +EXE1 = test7 +Description += Tests sscanf_s with hex numbers (lowercase) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test8/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf_s/test8/CMakeLists.txt new file mode 100644 index 0000000000..aa41ab42a6 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test8/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test8.cpp +) + +add_executable(paltest_sscanf_test8 + ${SOURCES} +) + +add_dependencies(paltest_sscanf_test8 coreclrpal) + +target_link_libraries(paltest_sscanf_test8 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test8/test8.cpp b/src/pal/tests/palsuite/c_runtime/sscanf_s/test8/test8.cpp new file mode 100644 index 0000000000..23ef22a56a --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test8/test8.cpp @@ -0,0 +1,43 @@ +// 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: test8.c +** +** Purpose:Tests sscanf_s with unsigned number +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../sscanf_s.h" + +int __cdecl main(int argc, char *argv[]) +{ + int n65535 = 65535; /* Walkaround compiler strictness */ + + if (PAL_Initialize(argc, argv)) + { + return FAIL; + } + + DoNumTest("1234d", "%u", 1234); + DoNumTest("1234d", "%2u", 12); + DoNumTest("-1", "%u", -1); + DoNumTest("0x1234", "%u", 0); + DoNumTest("012", "%u", 12); + DoShortNumTest("-1", "%hu", n65535); + DoShortNumTest("65536", "%hu", 0); + DoNumTest("-1", "%lu", -1); + DoNumTest("65536", "%lu", 65536); + DoNumTest("-1", "%Lu", -1); + DoNumTest("65536", "%Lu", 65536); + DoI64NumTest("4294967296", "%I64u", I64(4294967296)); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test8/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf_s/test8/testinfo.dat new file mode 100644 index 0000000000..0287a495d2 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test8/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sscanf_s +Name = Positive Test for sscanf_s +TYPE = DEFAULT +EXE1 = test8 +Description += Tests sscanf_s with unsigned numbers diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test9/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf_s/test9/CMakeLists.txt new file mode 100644 index 0000000000..b631fd40ea --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test9/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test9.cpp +) + +add_executable(paltest_sscanf_test9 + ${SOURCES} +) + +add_dependencies(paltest_sscanf_test9 coreclrpal) + +target_link_libraries(paltest_sscanf_test9 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test9/test9.cpp b/src/pal/tests/palsuite/c_runtime/sscanf_s/test9/test9.cpp new file mode 100644 index 0000000000..2c99c40e5d --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test9/test9.cpp @@ -0,0 +1,38 @@ +// 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: test9.c +** +** Purpose: Tests sscanf_s with characters +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../sscanf_s.h" + + +int __cdecl main(int argc, char *argv[]) +{ + if (PAL_Initialize(argc, argv)) + { + return FAIL; + } + + DoCharTest("1234d", "%c", "1", 1); + DoCharTest("1234d", "%c", "1", 1); + DoCharTest("abc", "%2c", "ab", 2); + DoCharTest(" ab", "%c", " ", 1); + DoCharTest("ab", "%hc", "a", 1); + DoWCharTest("ab", "%lc", convert("a"), 1); + DoCharTest("ab", "%Lc", "a", 1); + DoCharTest("ab", "%I64c", "a", 1); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/sscanf_s/test9/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf_s/test9/testinfo.dat new file mode 100644 index 0000000000..95f6c74ee2 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test9/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = sscanf_s +Name = Positive Test for sscanf_s +TYPE = DEFAULT +EXE1 = test9 +Description += Tests sscanf_s with characters diff --git a/src/pal/tests/palsuite/c_runtime/strcat/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/strcat/test1/CMakeLists.txt index 4a0f0be32d..fd62627db6 100644 --- a/src/pal/tests/palsuite/c_runtime/strcat/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/strcat/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_strcat_test1 diff --git a/src/pal/tests/palsuite/c_runtime/strcat/test1/test1.c b/src/pal/tests/palsuite/c_runtime/strcat/test1/test1.cpp index 532d84621e..532d84621e 100644 --- a/src/pal/tests/palsuite/c_runtime/strcat/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/strcat/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/strchr/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/strchr/test1/CMakeLists.txt index 1d248f3f56..f3ffe3bc15 100644 --- a/src/pal/tests/palsuite/c_runtime/strchr/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/strchr/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_strchr_test1 diff --git a/src/pal/tests/palsuite/c_runtime/strchr/test1/test1.c b/src/pal/tests/palsuite/c_runtime/strchr/test1/test1.cpp index 9190c4f7ce..9190c4f7ce 100644 --- a/src/pal/tests/palsuite/c_runtime/strchr/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/strchr/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/strcmp/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/strcmp/test1/CMakeLists.txt index b953dfa034..3b0f89c2a5 100644 --- a/src/pal/tests/palsuite/c_runtime/strcmp/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/strcmp/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_strcmp_test1 diff --git a/src/pal/tests/palsuite/c_runtime/strcmp/test1/test1.c b/src/pal/tests/palsuite/c_runtime/strcmp/test1/test1.cpp index 49428fd624..49428fd624 100644 --- a/src/pal/tests/palsuite/c_runtime/strcmp/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/strcmp/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/strcpy/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/strcpy/test1/CMakeLists.txt index 043ec57d98..4369d37a40 100644 --- a/src/pal/tests/palsuite/c_runtime/strcpy/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/strcpy/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_strcpy_test1 diff --git a/src/pal/tests/palsuite/c_runtime/strcpy/test1/test1.c b/src/pal/tests/palsuite/c_runtime/strcpy/test1/test1.cpp index 43069e59a6..43069e59a6 100644 --- a/src/pal/tests/palsuite/c_runtime/strcpy/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/strcpy/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/strcspn/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/strcspn/test1/CMakeLists.txt index a38761c335..717e18f0e9 100644 --- a/src/pal/tests/palsuite/c_runtime/strcspn/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/strcspn/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_strcspn_test1 diff --git a/src/pal/tests/palsuite/c_runtime/strcspn/test1/test1.c b/src/pal/tests/palsuite/c_runtime/strcspn/test1/test1.cpp index ddc5667570..ddc5667570 100644 --- a/src/pal/tests/palsuite/c_runtime/strcspn/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/strcspn/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/strlen/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/strlen/test1/CMakeLists.txt index c61828a97b..4afeb598aa 100644 --- a/src/pal/tests/palsuite/c_runtime/strlen/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/strlen/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_strlen_test1 diff --git a/src/pal/tests/palsuite/c_runtime/strlen/test1/test1.c b/src/pal/tests/palsuite/c_runtime/strlen/test1/test1.cpp index 40f8e151c7..40f8e151c7 100644 --- a/src/pal/tests/palsuite/c_runtime/strlen/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/strlen/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/strncat/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/strncat/test1/CMakeLists.txt index 7595f66939..f8080ecdc2 100644 --- a/src/pal/tests/palsuite/c_runtime/strncat/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/strncat/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_strncat_test1 diff --git a/src/pal/tests/palsuite/c_runtime/strncat/test1/test1.c b/src/pal/tests/palsuite/c_runtime/strncat/test1/test1.cpp index 000d1685b9..000d1685b9 100644 --- a/src/pal/tests/palsuite/c_runtime/strncat/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/strncat/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/strncmp/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/strncmp/test1/CMakeLists.txt index 4a0337a3dc..34b53e294d 100644 --- a/src/pal/tests/palsuite/c_runtime/strncmp/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/strncmp/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_strncmp_test1 diff --git a/src/pal/tests/palsuite/c_runtime/strncmp/test1/test1.c b/src/pal/tests/palsuite/c_runtime/strncmp/test1/test1.cpp index 7326c3b61e..7326c3b61e 100644 --- a/src/pal/tests/palsuite/c_runtime/strncmp/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/strncmp/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/strncpy/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/strncpy/test1/CMakeLists.txt index 6e0250bce3..fb737c8c59 100644 --- a/src/pal/tests/palsuite/c_runtime/strncpy/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/strncpy/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_strncpy_test1 diff --git a/src/pal/tests/palsuite/c_runtime/strncpy/test1/test1.c b/src/pal/tests/palsuite/c_runtime/strncpy/test1/test1.cpp index 62baf61ba2..62baf61ba2 100644 --- a/src/pal/tests/palsuite/c_runtime/strncpy/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/strncpy/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/strpbrk/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/strpbrk/test1/CMakeLists.txt index eac9ac9169..9e76436e01 100644 --- a/src/pal/tests/palsuite/c_runtime/strpbrk/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/strpbrk/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_strpbrk_test1 diff --git a/src/pal/tests/palsuite/c_runtime/strpbrk/test1/test1.c b/src/pal/tests/palsuite/c_runtime/strpbrk/test1/test1.cpp index a42b80f313..a42b80f313 100644 --- a/src/pal/tests/palsuite/c_runtime/strpbrk/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/strpbrk/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/strrchr/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/strrchr/test1/CMakeLists.txt index 5c099b0cd2..bb6916038d 100644 --- a/src/pal/tests/palsuite/c_runtime/strrchr/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/strrchr/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_strrchr_test1 diff --git a/src/pal/tests/palsuite/c_runtime/strrchr/test1/test1.c b/src/pal/tests/palsuite/c_runtime/strrchr/test1/test1.cpp index a5c147eece..a5c147eece 100644 --- a/src/pal/tests/palsuite/c_runtime/strrchr/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/strrchr/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/strspn/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/strspn/test1/CMakeLists.txt index 45caaf1bf8..c72fd0fa9a 100644 --- a/src/pal/tests/palsuite/c_runtime/strspn/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/strspn/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_strspn_test1 diff --git a/src/pal/tests/palsuite/c_runtime/strspn/test1/test1.c b/src/pal/tests/palsuite/c_runtime/strspn/test1/test1.cpp index 78d2488438..78d2488438 100644 --- a/src/pal/tests/palsuite/c_runtime/strspn/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/strspn/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/strstr/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/strstr/test1/CMakeLists.txt index 17e6ae8457..004b9a5658 100644 --- a/src/pal/tests/palsuite/c_runtime/strstr/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/strstr/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_strstr_test1 diff --git a/src/pal/tests/palsuite/c_runtime/strstr/test1/test1.c b/src/pal/tests/palsuite/c_runtime/strstr/test1/test1.cpp index db01e8b32a..db01e8b32a 100644 --- a/src/pal/tests/palsuite/c_runtime/strstr/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/strstr/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/strtod/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/strtod/test1/CMakeLists.txt index d3a9d61a4d..09884f32e6 100644 --- a/src/pal/tests/palsuite/c_runtime/strtod/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/strtod/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_strtod_test1 diff --git a/src/pal/tests/palsuite/c_runtime/strtod/test1/test1.c b/src/pal/tests/palsuite/c_runtime/strtod/test1/test1.cpp index e312d98f58..e312d98f58 100644 --- a/src/pal/tests/palsuite/c_runtime/strtod/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/strtod/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/strtod/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/strtod/test2/CMakeLists.txt index 6f407c5914..8729cc5a1c 100644 --- a/src/pal/tests/palsuite/c_runtime/strtod/test2/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/strtod/test2/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test2.c + test2.cpp ) add_executable(paltest_strtod_test2 diff --git a/src/pal/tests/palsuite/c_runtime/strtod/test2/test2.c b/src/pal/tests/palsuite/c_runtime/strtod/test2/test2.cpp index 0eaf4f53b6..0eaf4f53b6 100644 --- a/src/pal/tests/palsuite/c_runtime/strtod/test2/test2.c +++ b/src/pal/tests/palsuite/c_runtime/strtod/test2/test2.cpp diff --git a/src/pal/tests/palsuite/c_runtime/strtok/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/strtok/test1/CMakeLists.txt index 1d5fc04cca..422c4e96b5 100644 --- a/src/pal/tests/palsuite/c_runtime/strtok/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/strtok/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_strtok_test1 diff --git a/src/pal/tests/palsuite/c_runtime/strtok/test1/test1.c b/src/pal/tests/palsuite/c_runtime/strtok/test1/test1.cpp index f1dec70380..f1dec70380 100644 --- a/src/pal/tests/palsuite/c_runtime/strtok/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/strtok/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/strtoul/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/strtoul/test1/CMakeLists.txt index 61dbd4f9a3..009e85fb11 100644 --- a/src/pal/tests/palsuite/c_runtime/strtoul/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/strtoul/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_strtoul_test1 diff --git a/src/pal/tests/palsuite/c_runtime/strtoul/test1/test1.c b/src/pal/tests/palsuite/c_runtime/strtoul/test1/test1.cpp index 344671b5cc..344671b5cc 100644 --- a/src/pal/tests/palsuite/c_runtime/strtoul/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/strtoul/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/swprintf.h b/src/pal/tests/palsuite/c_runtime/swprintf/swprintf.h index 5229506064..6f4c914a82 100644 --- a/src/pal/tests/palsuite/c_runtime/swprintf/swprintf.h +++ b/src/pal/tests/palsuite/c_runtime/swprintf/swprintf.h @@ -14,7 +14,7 @@ #ifndef __SWPRINTF_H__ #define __SWPRINTF_H__ -void DoWStrTest(WCHAR *formatstr, WCHAR *param, WCHAR *checkstr) +void DoWStrTest(const WCHAR *formatstr, WCHAR *param, const WCHAR *checkstr) { WCHAR buf[256] = { 0 }; @@ -29,7 +29,7 @@ void DoWStrTest(WCHAR *formatstr, WCHAR *param, WCHAR *checkstr) } } -void DoStrTest(WCHAR *formatstr, char *param, WCHAR *checkstr) +void DoStrTest(const WCHAR *formatstr, char *param, const WCHAR *checkstr) { WCHAR buf[256] = { 0 }; @@ -44,7 +44,7 @@ void DoStrTest(WCHAR *formatstr, char *param, WCHAR *checkstr) } } -void DoPointerTest(WCHAR *formatstr, void* param, WCHAR *checkstr1) +void DoPointerTest(const WCHAR *formatstr, void* param, const WCHAR *checkstr1) { WCHAR buf[256] = { 0 }; @@ -57,7 +57,7 @@ void DoPointerTest(WCHAR *formatstr, void* param, WCHAR *checkstr1) } } -void DoCountTest(WCHAR *formatstr, int param, WCHAR *checkstr) +void DoCountTest(const WCHAR *formatstr, int param, const WCHAR *checkstr) { WCHAR buf[512] = { 0 }; int n = -1; @@ -77,7 +77,7 @@ void DoCountTest(WCHAR *formatstr, int param, WCHAR *checkstr) } } -void DoShortCountTest(WCHAR *formatstr, int param, WCHAR *checkstr) +void DoShortCountTest(const WCHAR *formatstr, int param, const WCHAR *checkstr) { WCHAR buf[256] = { 0 }; short int n = -1; @@ -97,7 +97,7 @@ void DoShortCountTest(WCHAR *formatstr, int param, WCHAR *checkstr) } } -void DoCharTest(WCHAR *formatstr, char param, WCHAR *checkstr) +void DoCharTest(const WCHAR *formatstr, char param, const WCHAR *checkstr) { WCHAR buf[256] = { 0 }; @@ -110,7 +110,7 @@ void DoCharTest(WCHAR *formatstr, char param, WCHAR *checkstr) } } -void DoWCharTest(WCHAR *formatstr, WCHAR param, WCHAR *checkstr) +void DoWCharTest(const WCHAR *formatstr, WCHAR param, const WCHAR *checkstr) { WCHAR buf[256] = { 0 }; @@ -123,7 +123,7 @@ void DoWCharTest(WCHAR *formatstr, WCHAR param, WCHAR *checkstr) } } -void DoNumTest(WCHAR *formatstr, int value, WCHAR*checkstr) +void DoNumTest(const WCHAR *formatstr, int value, const WCHAR *checkstr) { WCHAR buf[256] = { 0 }; @@ -136,8 +136,8 @@ void DoNumTest(WCHAR *formatstr, int value, WCHAR*checkstr) } } -void DoI64Test(WCHAR *formatstr, INT64 param, char *paramdesc, - WCHAR *checkstr1) +void DoI64Test(const WCHAR *formatstr, INT64 param, char *paramdesc, + const WCHAR *checkstr1) { WCHAR buf[256] = { 0 }; @@ -150,8 +150,8 @@ void DoI64Test(WCHAR *formatstr, INT64 param, char *paramdesc, } } -void DoDoubleTest(WCHAR *formatstr, double value, WCHAR *checkstr1, - WCHAR *checkstr2) +void DoDoubleTest(const WCHAR *formatstr, double value, const WCHAR *checkstr1, + const WCHAR *checkstr2) { WCHAR buf[256] = { 0 }; @@ -166,8 +166,8 @@ void DoDoubleTest(WCHAR *formatstr, double value, WCHAR *checkstr1, } } -void DoArgumentPrecTest(WCHAR *formatstr, int precision, void *param, - char *paramstr, WCHAR *checkstr1, WCHAR *checkstr2) +void DoArgumentPrecTest(const WCHAR *formatstr, int precision, void *param, + char *paramstr, const WCHAR *checkstr1, const WCHAR *checkstr2) { WCHAR buf[256]; @@ -182,8 +182,8 @@ void DoArgumentPrecTest(WCHAR *formatstr, int precision, void *param, } } -void DoArgumentPrecDoubleTest(WCHAR *formatstr, int precision, double param, - WCHAR *checkstr1, WCHAR *checkstr2) +void DoArgumentPrecDoubleTest(const WCHAR *formatstr, int precision, double param, + const WCHAR *checkstr1, const WCHAR *checkstr2) { WCHAR buf[256]; diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swprintf/test1/CMakeLists.txt index fcf816029e..c9be8c3347 100644 --- a/src/pal/tests/palsuite/c_runtime/swprintf/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/swprintf/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_swprintf_test1 diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/swprintf/test1/test1.cpp index 626040d9f7..626040d9f7 100644 --- a/src/pal/tests/palsuite/c_runtime/swprintf/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/swprintf/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test10/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swprintf/test10/CMakeLists.txt index 302c5e5923..222108393b 100644 --- a/src/pal/tests/palsuite/c_runtime/swprintf/test10/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/swprintf/test10/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test10.c + test10.cpp ) add_executable(paltest_swprintf_test10 diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test10/test10.c b/src/pal/tests/palsuite/c_runtime/swprintf/test10/test10.cpp index 61aef593a0..61aef593a0 100644 --- a/src/pal/tests/palsuite/c_runtime/swprintf/test10/test10.c +++ b/src/pal/tests/palsuite/c_runtime/swprintf/test10/test10.cpp diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test11/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swprintf/test11/CMakeLists.txt index 484d57ef58..96222a5b2a 100644 --- a/src/pal/tests/palsuite/c_runtime/swprintf/test11/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/swprintf/test11/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test11.c + test11.cpp ) add_executable(paltest_swprintf_test11 diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test11/test11.c b/src/pal/tests/palsuite/c_runtime/swprintf/test11/test11.cpp index 216f9acdbb..216f9acdbb 100644 --- a/src/pal/tests/palsuite/c_runtime/swprintf/test11/test11.c +++ b/src/pal/tests/palsuite/c_runtime/swprintf/test11/test11.cpp diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test12/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swprintf/test12/CMakeLists.txt index 6d45ee4646..1ffe620fed 100644 --- a/src/pal/tests/palsuite/c_runtime/swprintf/test12/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/swprintf/test12/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test12.c + test12.cpp ) add_executable(paltest_swprintf_test12 diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test12/test12.c b/src/pal/tests/palsuite/c_runtime/swprintf/test12/test12.cpp index a41b0ddbd3..a41b0ddbd3 100644 --- a/src/pal/tests/palsuite/c_runtime/swprintf/test12/test12.c +++ b/src/pal/tests/palsuite/c_runtime/swprintf/test12/test12.cpp diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test13/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swprintf/test13/CMakeLists.txt index 20f6f0df7b..8699589ec9 100644 --- a/src/pal/tests/palsuite/c_runtime/swprintf/test13/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/swprintf/test13/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test13.c + test13.cpp ) add_executable(paltest_swprintf_test13 diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test13/test13.c b/src/pal/tests/palsuite/c_runtime/swprintf/test13/test13.cpp index b99232f7ea..b99232f7ea 100644 --- a/src/pal/tests/palsuite/c_runtime/swprintf/test13/test13.c +++ b/src/pal/tests/palsuite/c_runtime/swprintf/test13/test13.cpp diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test14/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swprintf/test14/CMakeLists.txt index a052f60116..2a4b84805c 100644 --- a/src/pal/tests/palsuite/c_runtime/swprintf/test14/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/swprintf/test14/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test14.c + test14.cpp ) add_executable(paltest_swprintf_test14 diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test14/test14.c b/src/pal/tests/palsuite/c_runtime/swprintf/test14/test14.cpp index bcfd6a7c24..bcfd6a7c24 100644 --- a/src/pal/tests/palsuite/c_runtime/swprintf/test14/test14.c +++ b/src/pal/tests/palsuite/c_runtime/swprintf/test14/test14.cpp diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test15/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swprintf/test15/CMakeLists.txt index 7bc2da122f..22382bce5f 100644 --- a/src/pal/tests/palsuite/c_runtime/swprintf/test15/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/swprintf/test15/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test15.c + test15.cpp ) add_executable(paltest_swprintf_test15 diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test15/test15.c b/src/pal/tests/palsuite/c_runtime/swprintf/test15/test15.cpp index 215afbe093..215afbe093 100644 --- a/src/pal/tests/palsuite/c_runtime/swprintf/test15/test15.c +++ b/src/pal/tests/palsuite/c_runtime/swprintf/test15/test15.cpp diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test16/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swprintf/test16/CMakeLists.txt index e6ad3abd3f..462f0806cd 100644 --- a/src/pal/tests/palsuite/c_runtime/swprintf/test16/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/swprintf/test16/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test16.c + test16.cpp ) add_executable(paltest_swprintf_test16 diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test16/test16.c b/src/pal/tests/palsuite/c_runtime/swprintf/test16/test16.cpp index 859afed8dd..859afed8dd 100644 --- a/src/pal/tests/palsuite/c_runtime/swprintf/test16/test16.c +++ b/src/pal/tests/palsuite/c_runtime/swprintf/test16/test16.cpp diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test17/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swprintf/test17/CMakeLists.txt index 401285b740..c5b4d44593 100644 --- a/src/pal/tests/palsuite/c_runtime/swprintf/test17/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/swprintf/test17/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test17.c + test17.cpp ) add_executable(paltest_swprintf_test17 diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test17/test17.c b/src/pal/tests/palsuite/c_runtime/swprintf/test17/test17.cpp index 480f2b2fe1..480f2b2fe1 100644 --- a/src/pal/tests/palsuite/c_runtime/swprintf/test17/test17.c +++ b/src/pal/tests/palsuite/c_runtime/swprintf/test17/test17.cpp diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test18/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swprintf/test18/CMakeLists.txt index 210ab2c7ec..6cdf576966 100644 --- a/src/pal/tests/palsuite/c_runtime/swprintf/test18/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/swprintf/test18/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test18.c + test18.cpp ) add_executable(paltest_swprintf_test18 diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test18/test18.c b/src/pal/tests/palsuite/c_runtime/swprintf/test18/test18.cpp index 1ed8cd00d8..1ed8cd00d8 100644 --- a/src/pal/tests/palsuite/c_runtime/swprintf/test18/test18.c +++ b/src/pal/tests/palsuite/c_runtime/swprintf/test18/test18.cpp diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test19/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swprintf/test19/CMakeLists.txt index b9d44a3031..334b7b4fa1 100644 --- a/src/pal/tests/palsuite/c_runtime/swprintf/test19/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/swprintf/test19/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test19.c + test19.cpp ) add_executable(paltest_swprintf_test19 diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test19/test19.c b/src/pal/tests/palsuite/c_runtime/swprintf/test19/test19.c deleted file mode 100644 index 5199cc3cd9..0000000000 --- a/src/pal/tests/palsuite/c_runtime/swprintf/test19/test19.c +++ /dev/null @@ -1,109 +0,0 @@ -// 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: test19.c -** -** Purpose: Tests swprintf with argument specified precision -** -** -**==========================================================================*/ - - - -#include <palsuite.h> -#include "../swprintf.h" - -/* - * Uses memcmp & wcslen - */ - -int __cdecl main(int argc, char *argv[]) -{ - int n = -1; - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - DoArgumentPrecTest(convert("%.*s"), 2, convert("bar"), "bar", - convert("ba"), convert("ba")); - DoArgumentPrecTest(convert("%.*S"), 2, "bar", "bar", convert("ba"), - convert("ba")); - DoArgumentPrecTest(convert("%.*n"), 3, &n, "pointer to int", convert(""), - convert("")); - if (n != 0) - { - Fail("ERROR: Expected count parameter to resolve to %d, got %X\n", - 0, n); - } - - DoArgumentPrecTest(convert("%.*c"), 0, (void*)'a', "a", convert("a"), - convert("a")); - DoArgumentPrecTest(convert("%.*c"), 4, (void*)'a', "a", convert("a"), - convert("a")); - DoArgumentPrecTest(convert("%.*C"), 0, (void*)'a', "a", convert("a"), - convert("a")); - DoArgumentPrecTest(convert("%.*C"), 4, (void*)'a', "a", convert("a"), - convert("a")); - DoArgumentPrecTest(convert("%.*d"), 1, (void*)42, "42", convert("42"), - convert("42")); - DoArgumentPrecTest(convert("%.*d"), 3, (void*)42, "42", convert("042"), - convert("042")); - DoArgumentPrecTest(convert("%.*i"), 1, (void*)42, "42", convert("42"), - convert("42")); - DoArgumentPrecTest(convert("%.*i"), 3, (void*)42, "42", convert("042"), - convert("042")); - DoArgumentPrecTest(convert("%.*o"), 1, (void*)42, "42", convert("52"), - convert("52")); - DoArgumentPrecTest(convert("%.*o"), 3, (void*)42, "42", convert("052"), - convert("052")); - DoArgumentPrecTest(convert("%.*u"), 1, (void*)42, "42", convert("42"), - convert("42")); - DoArgumentPrecTest(convert("%.*u"), 3, (void*)42, "42", convert("042"), - convert("042")); - DoArgumentPrecTest(convert("%.*x"), 1, (void*)0x42, "0x42", convert("42"), - convert("42")); - DoArgumentPrecTest(convert("%.*x"), 3, (void*)0x42, "0x42", convert("042"), - convert("042")); - DoArgumentPrecTest(convert("%.*X"), 1, (void*)0x42, "0x42", convert("42"), - convert("42")); - DoArgumentPrecTest(convert("%.*X"), 3, (void*)0x42, "0x42", convert("042"), - convert("042")); - - - DoArgumentPrecDoubleTest(convert("%.*e"), 1, 2.01, convert("2.0e+000"), - convert("2.0e+000")); - DoArgumentPrecDoubleTest(convert("%.*e"), 3, 2.01, convert("2.010e+000"), - convert("2.010e+000")); - DoArgumentPrecDoubleTest(convert("%.*E"), 1, 2.01, convert("2.0E+000"), - convert("2.0E+000")); - DoArgumentPrecDoubleTest(convert("%.*E"), 3, 2.01, convert("2.010E+000"), - convert("2.010E+000")); - DoArgumentPrecDoubleTest(convert("%.*f"), 1, 2.01, convert("2.0"), - convert("2.0")); - DoArgumentPrecDoubleTest(convert("%.*f"), 3, 2.01, convert("2.010"), - convert("2.010")); - DoArgumentPrecDoubleTest(convert("%.*g"), 1, 256.01, convert("3e+002"), - convert("3e+002")); - DoArgumentPrecDoubleTest(convert("%.*g"), 3, 256.01, convert("256"), - convert("256")); - DoArgumentPrecDoubleTest(convert("%.*g"), 4, 256.01, convert("256"), - convert("256")); - DoArgumentPrecDoubleTest(convert("%.*g"), 6, 256.01, convert("256.01"), - convert("256.01")); - DoArgumentPrecDoubleTest(convert("%.*G"), 1, 256.01, convert("3E+002"), - convert("3E+002")); - DoArgumentPrecDoubleTest(convert("%.*G"), 3, 256.01, convert("256"), - convert("256")); - DoArgumentPrecDoubleTest(convert("%.*G"), 4, 256.01, convert("256"), - convert("256")); - DoArgumentPrecDoubleTest(convert("%.*G"), 6, 256.01, convert("256.01"), - convert("256.01")); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test19/test19.cpp b/src/pal/tests/palsuite/c_runtime/swprintf/test19/test19.cpp new file mode 100644 index 0000000000..c0346036cd --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/swprintf/test19/test19.cpp @@ -0,0 +1,109 @@ +// 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: test19.c +** +** Purpose: Tests swprintf with argument specified precision +** +** +**==========================================================================*/ + + + +#include <palsuite.h> +#include "../swprintf.h" + +/* + * Uses memcmp & wcslen + */ + +int __cdecl main(int argc, char *argv[]) +{ + int n = -1; + + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + DoArgumentPrecTest(convert("%.*s"), 2, (void*)convert("bar"), "bar", + convert("ba"), convert("ba")); + DoArgumentPrecTest(convert("%.*S"), 2, (void*)"bar", "bar", convert("ba"), + convert("ba")); + DoArgumentPrecTest(convert("%.*n"), 3, (void*)&n, "pointer to int", convert(""), + convert("")); + if (n != 0) + { + Fail("ERROR: Expected count parameter to resolve to %d, got %X\n", + 0, n); + } + + DoArgumentPrecTest(convert("%.*c"), 0, (void*)'a', "a", convert("a"), + convert("a")); + DoArgumentPrecTest(convert("%.*c"), 4, (void*)'a', "a", convert("a"), + convert("a")); + DoArgumentPrecTest(convert("%.*C"), 0, (void*)'a', "a", convert("a"), + convert("a")); + DoArgumentPrecTest(convert("%.*C"), 4, (void*)'a', "a", convert("a"), + convert("a")); + DoArgumentPrecTest(convert("%.*d"), 1, (void*)42, "42", convert("42"), + convert("42")); + DoArgumentPrecTest(convert("%.*d"), 3, (void*)42, "42", convert("042"), + convert("042")); + DoArgumentPrecTest(convert("%.*i"), 1, (void*)42, "42", convert("42"), + convert("42")); + DoArgumentPrecTest(convert("%.*i"), 3, (void*)42, "42", convert("042"), + convert("042")); + DoArgumentPrecTest(convert("%.*o"), 1, (void*)42, "42", convert("52"), + convert("52")); + DoArgumentPrecTest(convert("%.*o"), 3, (void*)42, "42", convert("052"), + convert("052")); + DoArgumentPrecTest(convert("%.*u"), 1, (void*)42, "42", convert("42"), + convert("42")); + DoArgumentPrecTest(convert("%.*u"), 3, (void*)42, "42", convert("042"), + convert("042")); + DoArgumentPrecTest(convert("%.*x"), 1, (void*)0x42, "0x42", convert("42"), + convert("42")); + DoArgumentPrecTest(convert("%.*x"), 3, (void*)0x42, "0x42", convert("042"), + convert("042")); + DoArgumentPrecTest(convert("%.*X"), 1, (void*)0x42, "0x42", convert("42"), + convert("42")); + DoArgumentPrecTest(convert("%.*X"), 3, (void*)0x42, "0x42", convert("042"), + convert("042")); + + + DoArgumentPrecDoubleTest(convert("%.*e"), 1, 2.01, convert("2.0e+000"), + convert("2.0e+000")); + DoArgumentPrecDoubleTest(convert("%.*e"), 3, 2.01, convert("2.010e+000"), + convert("2.010e+000")); + DoArgumentPrecDoubleTest(convert("%.*E"), 1, 2.01, convert("2.0E+000"), + convert("2.0E+000")); + DoArgumentPrecDoubleTest(convert("%.*E"), 3, 2.01, convert("2.010E+000"), + convert("2.010E+000")); + DoArgumentPrecDoubleTest(convert("%.*f"), 1, 2.01, convert("2.0"), + convert("2.0")); + DoArgumentPrecDoubleTest(convert("%.*f"), 3, 2.01, convert("2.010"), + convert("2.010")); + DoArgumentPrecDoubleTest(convert("%.*g"), 1, 256.01, convert("3e+002"), + convert("3e+002")); + DoArgumentPrecDoubleTest(convert("%.*g"), 3, 256.01, convert("256"), + convert("256")); + DoArgumentPrecDoubleTest(convert("%.*g"), 4, 256.01, convert("256"), + convert("256")); + DoArgumentPrecDoubleTest(convert("%.*g"), 6, 256.01, convert("256.01"), + convert("256.01")); + DoArgumentPrecDoubleTest(convert("%.*G"), 1, 256.01, convert("3E+002"), + convert("3E+002")); + DoArgumentPrecDoubleTest(convert("%.*G"), 3, 256.01, convert("256"), + convert("256")); + DoArgumentPrecDoubleTest(convert("%.*G"), 4, 256.01, convert("256"), + convert("256")); + DoArgumentPrecDoubleTest(convert("%.*G"), 6, 256.01, convert("256.01"), + convert("256.01")); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swprintf/test2/CMakeLists.txt index 84446d5f6d..af2b13e4c7 100644 --- a/src/pal/tests/palsuite/c_runtime/swprintf/test2/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/swprintf/test2/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test2.c + test2.cpp ) add_executable(paltest_swprintf_test2 diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test2/test2.c b/src/pal/tests/palsuite/c_runtime/swprintf/test2/test2.cpp index deffd3edd7..deffd3edd7 100644 --- a/src/pal/tests/palsuite/c_runtime/swprintf/test2/test2.c +++ b/src/pal/tests/palsuite/c_runtime/swprintf/test2/test2.cpp diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swprintf/test3/CMakeLists.txt index 6dbd8a3c36..14b81f4ac8 100644 --- a/src/pal/tests/palsuite/c_runtime/swprintf/test3/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/swprintf/test3/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test3.c + test3.cpp ) add_executable(paltest_swprintf_test3 diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test3/test3.c b/src/pal/tests/palsuite/c_runtime/swprintf/test3/test3.cpp index 42875c0640..42875c0640 100644 --- a/src/pal/tests/palsuite/c_runtime/swprintf/test3/test3.c +++ b/src/pal/tests/palsuite/c_runtime/swprintf/test3/test3.cpp diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test4/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swprintf/test4/CMakeLists.txt index a665948c47..e153e6b02f 100644 --- a/src/pal/tests/palsuite/c_runtime/swprintf/test4/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/swprintf/test4/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test4.c + test4.cpp ) add_executable(paltest_swprintf_test4 diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test4/test4.c b/src/pal/tests/palsuite/c_runtime/swprintf/test4/test4.cpp index 02cc3f9005..02cc3f9005 100644 --- a/src/pal/tests/palsuite/c_runtime/swprintf/test4/test4.c +++ b/src/pal/tests/palsuite/c_runtime/swprintf/test4/test4.cpp diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test5/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swprintf/test5/CMakeLists.txt index 8268ec2963..967ccbb992 100644 --- a/src/pal/tests/palsuite/c_runtime/swprintf/test5/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/swprintf/test5/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test5.c + test5.cpp ) add_executable(paltest_swprintf_test5 diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test5/test5.c b/src/pal/tests/palsuite/c_runtime/swprintf/test5/test5.cpp index e85adc120e..e85adc120e 100644 --- a/src/pal/tests/palsuite/c_runtime/swprintf/test5/test5.c +++ b/src/pal/tests/palsuite/c_runtime/swprintf/test5/test5.cpp diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test6/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swprintf/test6/CMakeLists.txt index 6a90c0b88e..806211a992 100644 --- a/src/pal/tests/palsuite/c_runtime/swprintf/test6/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/swprintf/test6/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test6.c + test6.cpp ) add_executable(paltest_swprintf_test6 diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test6/test6.c b/src/pal/tests/palsuite/c_runtime/swprintf/test6/test6.cpp index ecd6374264..ecd6374264 100644 --- a/src/pal/tests/palsuite/c_runtime/swprintf/test6/test6.c +++ b/src/pal/tests/palsuite/c_runtime/swprintf/test6/test6.cpp diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test7/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swprintf/test7/CMakeLists.txt index 2b1c30cb56..cf563799d9 100644 --- a/src/pal/tests/palsuite/c_runtime/swprintf/test7/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/swprintf/test7/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test7.c + test7.cpp ) add_executable(paltest_swprintf_test7 diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test7/test7.c b/src/pal/tests/palsuite/c_runtime/swprintf/test7/test7.cpp index e231ada3d2..e231ada3d2 100644 --- a/src/pal/tests/palsuite/c_runtime/swprintf/test7/test7.c +++ b/src/pal/tests/palsuite/c_runtime/swprintf/test7/test7.cpp diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test8/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swprintf/test8/CMakeLists.txt index 281e6df097..e8fcf66157 100644 --- a/src/pal/tests/palsuite/c_runtime/swprintf/test8/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/swprintf/test8/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test8.c + test8.cpp ) add_executable(paltest_swprintf_test8 diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test8/test8.c b/src/pal/tests/palsuite/c_runtime/swprintf/test8/test8.cpp index b4be28e78d..b4be28e78d 100644 --- a/src/pal/tests/palsuite/c_runtime/swprintf/test8/test8.c +++ b/src/pal/tests/palsuite/c_runtime/swprintf/test8/test8.cpp diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test9/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swprintf/test9/CMakeLists.txt index 054b40a998..c616348766 100644 --- a/src/pal/tests/palsuite/c_runtime/swprintf/test9/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/swprintf/test9/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test9.c + test9.cpp ) add_executable(paltest_swprintf_test9 diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test9/test9.c b/src/pal/tests/palsuite/c_runtime/swprintf/test9/test9.cpp index 2f5429e5fd..2f5429e5fd 100644 --- a/src/pal/tests/palsuite/c_runtime/swprintf/test9/test9.c +++ b/src/pal/tests/palsuite/c_runtime/swprintf/test9/test9.cpp diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/swscanf.h b/src/pal/tests/palsuite/c_runtime/swscanf/swscanf.h index 1cac450cf4..6349b7dcd6 100644 --- a/src/pal/tests/palsuite/c_runtime/swscanf/swscanf.h +++ b/src/pal/tests/palsuite/c_runtime/swscanf/swscanf.h @@ -14,7 +14,7 @@ #ifndef __SWSCANF_H__ #define __SWSCANF_H__ -void DoVoidTest(WCHAR *inputstr, WCHAR *formatstr) +void DoVoidTest(WCHAR *inputstr, const WCHAR *formatstr) { char buf[256] = { 0 }; int i; @@ -40,7 +40,7 @@ void DoVoidTest(WCHAR *inputstr, WCHAR *formatstr) } -void DoStrTest(WCHAR *inputstr, WCHAR *formatstr, char *checkstr) +void DoStrTest(WCHAR *inputstr, const WCHAR *formatstr, const char *checkstr) { char buf[256] = { 0 }; int ret; @@ -63,7 +63,7 @@ void DoStrTest(WCHAR *inputstr, WCHAR *formatstr, char *checkstr) } -void DoWStrTest(WCHAR *inputstr, WCHAR *formatstr, WCHAR *checkstr) +void DoWStrTest(WCHAR *inputstr, const WCHAR *formatstr, const WCHAR *checkstr) { WCHAR buf[256] = { 0 }; int ret; @@ -86,7 +86,7 @@ void DoWStrTest(WCHAR *inputstr, WCHAR *formatstr, WCHAR *checkstr) } -void DoNumTest(WCHAR *inputstr, WCHAR *formatstr, int checknum) +void DoNumTest(WCHAR *inputstr, const WCHAR *formatstr, int checknum) { int num = 0; int ret; @@ -107,7 +107,7 @@ void DoNumTest(WCHAR *inputstr, WCHAR *formatstr, int checknum) } } -void DoShortNumTest(WCHAR *inputstr, WCHAR *formatstr, short checknum) +void DoShortNumTest(WCHAR *inputstr, const WCHAR *formatstr, short checknum) { short num = 0; int ret; @@ -128,7 +128,7 @@ void DoShortNumTest(WCHAR *inputstr, WCHAR *formatstr, short checknum) } } -void DoI64NumTest(WCHAR *inputstr, WCHAR *formatstr, INT64 checknum) +void DoI64NumTest(WCHAR *inputstr, const WCHAR *formatstr, INT64 checknum) { char buf[256]; char check[256]; @@ -145,15 +145,15 @@ void DoI64NumTest(WCHAR *inputstr, WCHAR *formatstr, INT64 checknum) if (checknum != num) { - sprintf(buf, "%I64d", num); - sprintf(check, "%I64d", checknum); + sprintf_s(buf, _countof(buf), "%I64d", num); + sprintf_s(check, _countof(check), "%I64d", checknum); Fail("ERROR: scanned I64 number incorrectly from \"%s\" using \"%s\".\n" "Expected %s, got %s.\n", convertC(inputstr), convertC(formatstr), check, buf); } } -void DoCharTest(WCHAR *inputstr, WCHAR*formatstr, char* checkchars, int numchars) +void DoCharTest(WCHAR *inputstr, const WCHAR *formatstr, char* checkchars, int numchars) { char buf[256]; int ret; @@ -187,7 +187,7 @@ void DoCharTest(WCHAR *inputstr, WCHAR*formatstr, char* checkchars, int numchars } } -void DoWCharTest(WCHAR *inputstr, WCHAR *formatstr, WCHAR *checkchars, int numchars) +void DoWCharTest(WCHAR *inputstr, const WCHAR *formatstr, const WCHAR *checkchars, int numchars) { WCHAR buf[256]; int ret; @@ -223,7 +223,7 @@ void DoWCharTest(WCHAR *inputstr, WCHAR *formatstr, WCHAR *checkchars, int numch } -void DoFloatTest(WCHAR *inputstr, WCHAR *formatstr, float checkval) +void DoFloatTest(WCHAR *inputstr, const WCHAR *formatstr, float checkval) { char buf[256] = { 0 }; float val; diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swscanf/test1/CMakeLists.txt index 030aaaf709..44b8939248 100644 --- a/src/pal/tests/palsuite/c_runtime/swscanf/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/swscanf/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_swscanf_test1 diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/swscanf/test1/test1.cpp index 66136e57c5..66136e57c5 100644 --- a/src/pal/tests/palsuite/c_runtime/swscanf/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/swscanf/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test10/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swscanf/test10/CMakeLists.txt index f7c8b284ff..27d42114a9 100644 --- a/src/pal/tests/palsuite/c_runtime/swscanf/test10/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/swscanf/test10/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test10.c + test10.cpp ) add_executable(paltest_swscanf_test10 diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test10/test10.c b/src/pal/tests/palsuite/c_runtime/swscanf/test10/test10.cpp index a8628e0de1..a8628e0de1 100644 --- a/src/pal/tests/palsuite/c_runtime/swscanf/test10/test10.c +++ b/src/pal/tests/palsuite/c_runtime/swscanf/test10/test10.cpp diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test11/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swscanf/test11/CMakeLists.txt index 17066f31b8..1ca9224ec0 100644 --- a/src/pal/tests/palsuite/c_runtime/swscanf/test11/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/swscanf/test11/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test11.c + test11.cpp ) add_executable(paltest_swscanf_test11 diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test11/test11.c b/src/pal/tests/palsuite/c_runtime/swscanf/test11/test11.cpp index f7eb4af46f..f7eb4af46f 100644 --- a/src/pal/tests/palsuite/c_runtime/swscanf/test11/test11.c +++ b/src/pal/tests/palsuite/c_runtime/swscanf/test11/test11.cpp diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test12/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swscanf/test12/CMakeLists.txt index 95f5174ecb..44d70f47ae 100644 --- a/src/pal/tests/palsuite/c_runtime/swscanf/test12/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/swscanf/test12/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test12.c + test12.cpp ) add_executable(paltest_swscanf_test12 diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test12/test12.c b/src/pal/tests/palsuite/c_runtime/swscanf/test12/test12.cpp index f5f8bbdf8a..f5f8bbdf8a 100644 --- a/src/pal/tests/palsuite/c_runtime/swscanf/test12/test12.c +++ b/src/pal/tests/palsuite/c_runtime/swscanf/test12/test12.cpp diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test13/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swscanf/test13/CMakeLists.txt index 47abc50313..add0cbfe18 100644 --- a/src/pal/tests/palsuite/c_runtime/swscanf/test13/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/swscanf/test13/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test13.c + test13.cpp ) add_executable(paltest_swscanf_test13 diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test13/test13.c b/src/pal/tests/palsuite/c_runtime/swscanf/test13/test13.cpp index 1bb0b7b21c..1bb0b7b21c 100644 --- a/src/pal/tests/palsuite/c_runtime/swscanf/test13/test13.c +++ b/src/pal/tests/palsuite/c_runtime/swscanf/test13/test13.cpp diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test14/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swscanf/test14/CMakeLists.txt index a470436ce7..126e087b1c 100644 --- a/src/pal/tests/palsuite/c_runtime/swscanf/test14/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/swscanf/test14/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test14.c + test14.cpp ) add_executable(paltest_swscanf_test14 diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test14/test14.c b/src/pal/tests/palsuite/c_runtime/swscanf/test14/test14.cpp index 80581b726f..80581b726f 100644 --- a/src/pal/tests/palsuite/c_runtime/swscanf/test14/test14.c +++ b/src/pal/tests/palsuite/c_runtime/swscanf/test14/test14.cpp diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test15/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swscanf/test15/CMakeLists.txt index d89650b12c..7c2da2bdf8 100644 --- a/src/pal/tests/palsuite/c_runtime/swscanf/test15/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/swscanf/test15/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test15.c + test15.cpp ) add_executable(paltest_swscanf_test15 diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test15/test15.c b/src/pal/tests/palsuite/c_runtime/swscanf/test15/test15.cpp index 9b7d277e17..9b7d277e17 100644 --- a/src/pal/tests/palsuite/c_runtime/swscanf/test15/test15.c +++ b/src/pal/tests/palsuite/c_runtime/swscanf/test15/test15.cpp diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test16/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swscanf/test16/CMakeLists.txt index a2a00f11b6..ba28c4dc2f 100644 --- a/src/pal/tests/palsuite/c_runtime/swscanf/test16/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/swscanf/test16/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test16.c + test16.cpp ) add_executable(paltest_swscanf_test16 diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test16/test16.c b/src/pal/tests/palsuite/c_runtime/swscanf/test16/test16.cpp index c83b64468b..c83b64468b 100644 --- a/src/pal/tests/palsuite/c_runtime/swscanf/test16/test16.c +++ b/src/pal/tests/palsuite/c_runtime/swscanf/test16/test16.cpp diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test17/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swscanf/test17/CMakeLists.txt index c224f5d9a6..225ce868ed 100644 --- a/src/pal/tests/palsuite/c_runtime/swscanf/test17/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/swscanf/test17/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test17.c + test17.cpp ) add_executable(paltest_swscanf_test17 diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test17/test17.c b/src/pal/tests/palsuite/c_runtime/swscanf/test17/test17.cpp index 9023f7020a..9023f7020a 100644 --- a/src/pal/tests/palsuite/c_runtime/swscanf/test17/test17.c +++ b/src/pal/tests/palsuite/c_runtime/swscanf/test17/test17.cpp diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swscanf/test2/CMakeLists.txt index a5335ddb48..15411ecf21 100644 --- a/src/pal/tests/palsuite/c_runtime/swscanf/test2/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/swscanf/test2/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test2.c + test2.cpp ) add_executable(paltest_swscanf_test2 diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test2/test2.c b/src/pal/tests/palsuite/c_runtime/swscanf/test2/test2.cpp index 8fbd3f86ba..8fbd3f86ba 100644 --- a/src/pal/tests/palsuite/c_runtime/swscanf/test2/test2.c +++ b/src/pal/tests/palsuite/c_runtime/swscanf/test2/test2.cpp diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swscanf/test3/CMakeLists.txt index 5c229c26d3..927026107a 100644 --- a/src/pal/tests/palsuite/c_runtime/swscanf/test3/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/swscanf/test3/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test3.c + test3.cpp ) add_executable(paltest_swscanf_test3 diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test3/test3.c b/src/pal/tests/palsuite/c_runtime/swscanf/test3/test3.cpp index 8b05df20f2..8b05df20f2 100644 --- a/src/pal/tests/palsuite/c_runtime/swscanf/test3/test3.c +++ b/src/pal/tests/palsuite/c_runtime/swscanf/test3/test3.cpp diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test4/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swscanf/test4/CMakeLists.txt index 5e281aaf34..eec701645b 100644 --- a/src/pal/tests/palsuite/c_runtime/swscanf/test4/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/swscanf/test4/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test4.c + test4.cpp ) add_executable(paltest_swscanf_test4 diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test4/test4.c b/src/pal/tests/palsuite/c_runtime/swscanf/test4/test4.cpp index d63d25b7d0..d63d25b7d0 100644 --- a/src/pal/tests/palsuite/c_runtime/swscanf/test4/test4.c +++ b/src/pal/tests/palsuite/c_runtime/swscanf/test4/test4.cpp diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test5/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swscanf/test5/CMakeLists.txt index 8b259aa78d..3f022db16c 100644 --- a/src/pal/tests/palsuite/c_runtime/swscanf/test5/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/swscanf/test5/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test5.c + test5.cpp ) add_executable(paltest_swscanf_test5 diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test5/test5.c b/src/pal/tests/palsuite/c_runtime/swscanf/test5/test5.cpp index 8ae2d81da6..8ae2d81da6 100644 --- a/src/pal/tests/palsuite/c_runtime/swscanf/test5/test5.c +++ b/src/pal/tests/palsuite/c_runtime/swscanf/test5/test5.cpp diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test6/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swscanf/test6/CMakeLists.txt index c3fd8696ab..c55666d95c 100644 --- a/src/pal/tests/palsuite/c_runtime/swscanf/test6/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/swscanf/test6/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test6.c + test6.cpp ) add_executable(paltest_swscanf_test6 diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test6/test6.c b/src/pal/tests/palsuite/c_runtime/swscanf/test6/test6.cpp index 982f799cfc..982f799cfc 100644 --- a/src/pal/tests/palsuite/c_runtime/swscanf/test6/test6.c +++ b/src/pal/tests/palsuite/c_runtime/swscanf/test6/test6.cpp diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test7/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swscanf/test7/CMakeLists.txt index 00541306df..adb0abe80d 100644 --- a/src/pal/tests/palsuite/c_runtime/swscanf/test7/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/swscanf/test7/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test7.c + test7.cpp ) add_executable(paltest_swscanf_test7 diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test7/test7.c b/src/pal/tests/palsuite/c_runtime/swscanf/test7/test7.cpp index 45e9400549..45e9400549 100644 --- a/src/pal/tests/palsuite/c_runtime/swscanf/test7/test7.c +++ b/src/pal/tests/palsuite/c_runtime/swscanf/test7/test7.cpp diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test8/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swscanf/test8/CMakeLists.txt index d6aa631ab9..a69c552337 100644 --- a/src/pal/tests/palsuite/c_runtime/swscanf/test8/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/swscanf/test8/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test8.c + test8.cpp ) add_executable(paltest_swscanf_test8 diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test8/test8.c b/src/pal/tests/palsuite/c_runtime/swscanf/test8/test8.cpp index a244de748f..a244de748f 100644 --- a/src/pal/tests/palsuite/c_runtime/swscanf/test8/test8.c +++ b/src/pal/tests/palsuite/c_runtime/swscanf/test8/test8.cpp diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test9/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swscanf/test9/CMakeLists.txt index 4f7595a205..70a9fe2064 100644 --- a/src/pal/tests/palsuite/c_runtime/swscanf/test9/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/swscanf/test9/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test9.c + test9.cpp ) add_executable(paltest_swscanf_test9 diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test9/test9.c b/src/pal/tests/palsuite/c_runtime/swscanf/test9/test9.cpp index e289d26f58..e289d26f58 100644 --- a/src/pal/tests/palsuite/c_runtime/swscanf/test9/test9.c +++ b/src/pal/tests/palsuite/c_runtime/swscanf/test9/test9.cpp diff --git a/src/pal/tests/palsuite/c_runtime/tan/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/tan/test1/CMakeLists.txt index 665fc22d5e..cea661f2bb 100644 --- a/src/pal/tests/palsuite/c_runtime/tan/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/tan/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_tan_test1 diff --git a/src/pal/tests/palsuite/c_runtime/tan/test1/test1.c b/src/pal/tests/palsuite/c_runtime/tan/test1/test1.cpp index 443e5da6d6..443e5da6d6 100644 --- a/src/pal/tests/palsuite/c_runtime/tan/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/tan/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/tanf/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/tanf/CMakeLists.txt new file mode 100644 index 0000000000..5e1ef7f28b --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/tanf/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +add_subdirectory(test1) diff --git a/src/pal/tests/palsuite/c_runtime/tanf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/tanf/test1/CMakeLists.txt new file mode 100644 index 0000000000..cd588ea23e --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/tanf/test1/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test1.c +) + +add_executable(paltest_tanf_test1 + ${SOURCES} +) + +add_dependencies(paltest_tanf_test1 coreclrpal) + +target_link_libraries(paltest_tanf_test1 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/tanf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/tanf/test1/test1.c new file mode 100644 index 0000000000..18d5c4e59d --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/tanf/test1/test1.c @@ -0,0 +1,136 @@ +// 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: test1.c +** +** Purpose: Test to ensure that tanf return the correct values +** +** Dependencies: PAL_Initialize +** PAL_Terminate +** Fail +** fabs +** +**===========================================================================*/ + +#include <palsuite.h> + +// binary32 (float) has a machine epsilon of 2^-23 (approx. 1.19e-07). However, this +// is slightly too accurate when writing tests meant to run against libm implementations +// for various platforms. 2^-21 (approx. 4.76e-07) seems to be as accurate as we can get. +// +// The tests themselves will take PAL_EPSILON and adjust it according to the expected result +// so that the delta used for comparison will compare the most significant digits and ignore +// any digits that are outside the double precision range (6-9 digits). + +// For example, a test with an expect result in the format of 0.xxxxxxxxx will use PAL_EPSILON +// for the variance, while an expected result in the format of 0.0xxxxxxxxx will use +// PAL_EPSILON / 10 and and expected result in the format of x.xxxxxx will use PAL_EPSILON * 10. +#define PAL_EPSILON 4.76837158e-07 + +#define PAL_NAN sqrtf(-1.0f) +#define PAL_POSINF -logf(0.0f) +#define PAL_NEGINF logf(0.0f) + +/** + * Helper test structure + */ +struct test +{ + float value; /* value to test the function with */ + float expected; /* expected result */ + float variance; /* maximum delta between the expected and actual result */ +}; + +/** + * validate + * + * test validation function + */ +void __cdecl validate(float value, float expected, float variance) +{ + float result = tanf(value); + + /* + * The test is valid when the difference between result + * and expected is less than or equal to variance + */ + float delta = fabsf(result - expected); + + if (delta > variance) + { + Fail("tanf(%g) returned %10.9g when it should have returned %10.9g", + value, result, expected); + } +} + +/** + * validate + * + * test validation function for values returning NaN + */ +void __cdecl validate_isnan(float value) +{ + float result = tanf(value); + + if (!_isnanf(result)) + { + Fail("tanf(%g) returned %10.9g when it should have returned %10.9g", + value, result, PAL_NAN); + } +} + +/** + * main + * + * executable entry point + */ +int __cdecl main(int argc, char **argv) +{ + struct test tests[] = + { + /* value expected variance */ + { 0, 0, PAL_EPSILON }, + { 0.318309886f, 0.329514733f, PAL_EPSILON }, // value: 1 / pi + { 0.434294482f, 0.463829067f, PAL_EPSILON }, // value: log10f(e) + { 0.636619772f, 0.739302950f, PAL_EPSILON }, // value: 2 / pi + { 0.693147181f, 0.830640878f, PAL_EPSILON }, // value: ln(2) + { 0.707106781f, 0.854510432f, PAL_EPSILON }, // value: 1 / sqrtf(2) + { 0.785398163f, 1, PAL_EPSILON * 10 }, // value: pi / 4 + { 1, 1.55740772f, PAL_EPSILON * 10 }, + { 1.12837917f, 2.11087684f, PAL_EPSILON * 10 }, // value: 2 / sqrtf(pi) + { 1.41421356f, 6.33411917f, PAL_EPSILON * 10 }, // value: sqrtf(2) + { 1.44269504f, 7.76357567f, PAL_EPSILON * 10 }, // value: logf2(e) + // SEE BELOW -- { 1.57079633f, PAL_POSINF, 0 }, // value: pi / 2 + { 2.30258509f, -1.11340715f, PAL_EPSILON * 10 }, // value: ln(10) + { 2.71828183f, -0.450549534f, PAL_EPSILON }, // value: e + { 3.14159265f, 0, PAL_EPSILON }, // value: pi + }; + + /* PAL initialization */ + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) + { + validate( tests[i].value, tests[i].expected, tests[i].variance); + validate(-tests[i].value, -tests[i].expected, tests[i].variance); + } + + // -- SPECIAL CASE -- + // Normally, tanf(pi / 2) would return PAL_POSINF (atan2f(PAL_POSINF) does return (pi / 2)). + // However, it seems instead (on all supported systems), we get a different number entirely. + validate( 1.57079633f, -22877332.0, PAL_EPSILON * 100000000); + validate(-1.57079633f, 22877332.0, PAL_EPSILON * 100000000); + + validate_isnan(PAL_NEGINF); + validate_isnan(PAL_NAN); + validate_isnan(PAL_POSINF); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/tanf/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/tanf/test1/testinfo.dat new file mode 100644 index 0000000000..aa33232adc --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/tanf/test1/testinfo.dat @@ -0,0 +1,13 @@ +# 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 = tanf +Name = Positive Test for tanf +TYPE = DEFAULT +EXE1 = test1 +Description += Passes to tanf() a series of angle value, checking that += each one return to correct value. diff --git a/src/pal/tests/palsuite/c_runtime/tanh/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/tanh/test1/CMakeLists.txt index f8e439dd95..9fe926d441 100644 --- a/src/pal/tests/palsuite/c_runtime/tanh/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/tanh/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_tanh_test1 diff --git a/src/pal/tests/palsuite/c_runtime/tanh/test1/test1.c b/src/pal/tests/palsuite/c_runtime/tanh/test1/test1.cpp index 3b8f87964a..3b8f87964a 100644 --- a/src/pal/tests/palsuite/c_runtime/tanh/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/tanh/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/tanhf/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/tanhf/CMakeLists.txt new file mode 100644 index 0000000000..5e1ef7f28b --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/tanhf/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +add_subdirectory(test1) diff --git a/src/pal/tests/palsuite/c_runtime/tanhf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/tanhf/test1/CMakeLists.txt new file mode 100644 index 0000000000..fd0af2a46f --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/tanhf/test1/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test1.c +) + +add_executable(paltest_tanhf_test1 + ${SOURCES} +) + +add_dependencies(paltest_tanhf_test1 coreclrpal) + +target_link_libraries(paltest_tanhf_test1 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/tanhf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/tanhf/test1/test1.c new file mode 100644 index 0000000000..904729a2c4 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/tanhf/test1/test1.c @@ -0,0 +1,129 @@ +// 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: test1.c +** +** Purpose: Test to ensure that tanhf return the correct values +** +** Dependencies: PAL_Initialize +** PAL_Terminate +** Fail +** fabs +** +**===========================================================================*/ + +#include <palsuite.h> + +// binary32 (float) has a machine epsilon of 2^-23 (approx. 1.19e-07). However, this +// is slightly too accurate when writing tests meant to run against libm implementations +// for various platforms. 2^-21 (approx. 4.76e-07) seems to be as accurate as we can get. +// +// The tests themselves will take PAL_EPSILON and adjust it according to the expected result +// so that the delta used for comparison will compare the most significant digits and ignore +// any digits that are outside the double precision range (6-9 digits). + +// For example, a test with an expect result in the format of 0.xxxxxxxxx will use PAL_EPSILON +// for the variance, while an expected result in the format of 0.0xxxxxxxxx will use +// PAL_EPSILON / 10 and and expected result in the format of x.xxxxxx will use PAL_EPSILON * 10. +#define PAL_EPSILON 4.76837158e-07 + +#define PAL_NAN sqrtf(-1.0f) +#define PAL_POSINF -logf(0.0f) +#define PAL_NEGINF logf(0.0f) + +/** + * Helper test structure + */ +struct test +{ + float value; /* value to test the function with */ + float expected; /* expected result */ + float variance; /* maximum delta between the expected and actual result */ +}; + +/** + * validate + * + * test validation function + */ +void __cdecl validate(float value, float expected, float variance) +{ + float result = tanhf(value); + + /* + * The test is valid when the difference between result + * and expected is less than or equal to variance + */ + float delta = fabsf(result - expected); + + if (delta > variance) + { + Fail("tanhf(%g) returned %10.9g when it should have returned %10.9g", + value, result, expected); + } +} + +/** + * validate + * + * test validation function for values returning NaN + */ +void __cdecl validate_isnan(float value) +{ + float result = tanhf(value); + + if (!_isnanf(result)) + { + Fail("tanhf(%g) returned %10.9g when it should have returned %10.9g", + value, result, PAL_NAN); + } +} + +/** + * main + * + * executable entry point + */ +int __cdecl main(int argc, char **argv) +{ + struct test tests[] = + { + /* value expected variance */ + { 0, 0, PAL_EPSILON }, + { 0.318309886f, 0.307977913f, PAL_EPSILON }, // value: 1 / pi + { 0.434294482f, 0.408904012f, PAL_EPSILON }, // value: log10f(e) + { 0.636619772f, 0.562593600f, PAL_EPSILON }, // value: 2 / pi + { 0.693147181f, 0.6f, PAL_EPSILON }, // value: ln(2) + { 0.707106781f, 0.608859365f, PAL_EPSILON }, // value: 1 / sqrtf(2) + { 0.785398163f, 0.655794203f, PAL_EPSILON }, // value: pi / 4 + { 1, 0.761594156f, PAL_EPSILON }, + { 1.12837917f, 0.810463806f, PAL_EPSILON }, // value: 2 / sqrtf(pi) + { 1.41421356f, 0.888385562f, PAL_EPSILON }, // value: sqrtf(2) + { 1.44269504f, 0.894238946f, PAL_EPSILON }, // value: logf2(e) + { 1.57079633f, 0.917152336f, PAL_EPSILON }, // value: pi / 2 + { 2.30258509f, 0.980198020f, PAL_EPSILON }, // value: ln(10) + { 2.71828183f, 0.991328916f, PAL_EPSILON }, // value: e + { 3.14159265f, 0.996272076f, PAL_EPSILON }, // value: pi + { PAL_POSINF, 1, PAL_EPSILON * 10 } + }; + + /* PAL initialization */ + if (PAL_Initialize(argc, argv) != 0) + { + return FAIL; + } + + for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) + { + validate( tests[i].value, tests[i].expected, tests[i].variance); + validate(-tests[i].value, -tests[i].expected, tests[i].variance); + } + + validate_isnan(PAL_NAN); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/tanhf/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/tanhf/test1/testinfo.dat new file mode 100644 index 0000000000..6c7594fc5a --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/tanhf/test1/testinfo.dat @@ -0,0 +1,13 @@ +# 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 = tanhf +Name = Positive Test for tanhf +TYPE = DEFAULT +EXE1 = test1 +Description += Passes to tanhf() a series of angle value, checking that += each one return to correct value. diff --git a/src/pal/tests/palsuite/c_runtime/time/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/time/test1/CMakeLists.txt index d495266cef..64df144557 100644 --- a/src/pal/tests/palsuite/c_runtime/time/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/time/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_time_test1 diff --git a/src/pal/tests/palsuite/c_runtime/time/test1/test1.c b/src/pal/tests/palsuite/c_runtime/time/test1/test1.cpp index c668bf38e7..c668bf38e7 100644 --- a/src/pal/tests/palsuite/c_runtime/time/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/time/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/tolower/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/tolower/test1/CMakeLists.txt index 537f239cf8..214a509010 100644 --- a/src/pal/tests/palsuite/c_runtime/tolower/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/tolower/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_tolower_test1 diff --git a/src/pal/tests/palsuite/c_runtime/tolower/test1/test1.c b/src/pal/tests/palsuite/c_runtime/tolower/test1/test1.cpp index cab623d3f9..cab623d3f9 100644 --- a/src/pal/tests/palsuite/c_runtime/tolower/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/tolower/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/toupper/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/toupper/test1/CMakeLists.txt index e5aa375a9b..3dd536c590 100644 --- a/src/pal/tests/palsuite/c_runtime/toupper/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/toupper/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_toupper_test1 diff --git a/src/pal/tests/palsuite/c_runtime/toupper/test1/test1.c b/src/pal/tests/palsuite/c_runtime/toupper/test1/test1.cpp index c580699e3b..c580699e3b 100644 --- a/src/pal/tests/palsuite/c_runtime/toupper/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/toupper/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/towlower/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/towlower/test1/CMakeLists.txt index 2a3e6a07ef..77a46344d4 100644 --- a/src/pal/tests/palsuite/c_runtime/towlower/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/towlower/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_towlower_test1 diff --git a/src/pal/tests/palsuite/c_runtime/towlower/test1/test1.c b/src/pal/tests/palsuite/c_runtime/towlower/test1/test1.cpp index 5f2457a5fe..5f2457a5fe 100644 --- a/src/pal/tests/palsuite/c_runtime/towlower/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/towlower/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/towupper/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/towupper/test1/CMakeLists.txt index 537efbe0fa..6a2f813cc9 100644 --- a/src/pal/tests/palsuite/c_runtime/towupper/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/towupper/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_towupper_test1 diff --git a/src/pal/tests/palsuite/c_runtime/towupper/test1/test1.c b/src/pal/tests/palsuite/c_runtime/towupper/test1/test1.cpp index 63f051fa66..63f051fa66 100644 --- a/src/pal/tests/palsuite/c_runtime/towupper/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/towupper/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/ungetc/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/ungetc/test1/CMakeLists.txt index da19397e2c..0286f99b77 100644 --- a/src/pal/tests/palsuite/c_runtime/ungetc/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/ungetc/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - ungetc.c + ungetc.cpp ) add_executable(paltest_ungetc_test1 diff --git a/src/pal/tests/palsuite/c_runtime/ungetc/test1/ungetc.c b/src/pal/tests/palsuite/c_runtime/ungetc/test1/ungetc.cpp index 397e42ac64..397e42ac64 100644 --- a/src/pal/tests/palsuite/c_runtime/ungetc/test1/ungetc.c +++ b/src/pal/tests/palsuite/c_runtime/ungetc/test1/ungetc.cpp diff --git a/src/pal/tests/palsuite/c_runtime/ungetc/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/ungetc/test2/CMakeLists.txt index 7b63423628..0710074bd0 100644 --- a/src/pal/tests/palsuite/c_runtime/ungetc/test2/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/ungetc/test2/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - ungetc.c + ungetc.cpp ) add_executable(paltest_ungetc_test2 diff --git a/src/pal/tests/palsuite/c_runtime/ungetc/test2/ungetc.c b/src/pal/tests/palsuite/c_runtime/ungetc/test2/ungetc.cpp index cbc8102eec..cbc8102eec 100644 --- a/src/pal/tests/palsuite/c_runtime/ungetc/test2/ungetc.c +++ b/src/pal/tests/palsuite/c_runtime/ungetc/test2/ungetc.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vfprintf/test1/CMakeLists.txt index 4c967fbc5b..fcff4a2074 100644 --- a/src/pal/tests/palsuite/c_runtime/vfprintf/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_vfprintf_test1 diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/vfprintf/test1/test1.cpp index 302c914e3a..302c914e3a 100644 --- a/src/pal/tests/palsuite/c_runtime/vfprintf/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test10/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vfprintf/test10/CMakeLists.txt index e154107e36..97c7b167ab 100644 --- a/src/pal/tests/palsuite/c_runtime/vfprintf/test10/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test10/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test10.c + test10.cpp ) add_executable(paltest_vfprintf_test10 diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test10/test10.c b/src/pal/tests/palsuite/c_runtime/vfprintf/test10/test10.cpp index ecb4b0314a..ecb4b0314a 100644 --- a/src/pal/tests/palsuite/c_runtime/vfprintf/test10/test10.c +++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test10/test10.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test11/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vfprintf/test11/CMakeLists.txt index f51f379bcd..9250eb957d 100644 --- a/src/pal/tests/palsuite/c_runtime/vfprintf/test11/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test11/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test11.c + test11.cpp ) add_executable(paltest_vfprintf_test11 diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test11/test11.c b/src/pal/tests/palsuite/c_runtime/vfprintf/test11/test11.cpp index 5f7bc118cc..5f7bc118cc 100644 --- a/src/pal/tests/palsuite/c_runtime/vfprintf/test11/test11.c +++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test11/test11.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test12/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vfprintf/test12/CMakeLists.txt index 3ef68cff70..53d3488b4a 100644 --- a/src/pal/tests/palsuite/c_runtime/vfprintf/test12/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test12/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test12.c + test12.cpp ) add_executable(paltest_vfprintf_test12 diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test12/test12.c b/src/pal/tests/palsuite/c_runtime/vfprintf/test12/test12.cpp index 0bf61d3ecc..0bf61d3ecc 100644 --- a/src/pal/tests/palsuite/c_runtime/vfprintf/test12/test12.c +++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test12/test12.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test13/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vfprintf/test13/CMakeLists.txt index cd34f6649c..c35813b420 100644 --- a/src/pal/tests/palsuite/c_runtime/vfprintf/test13/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test13/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test13.c + test13.cpp ) add_executable(paltest_vfprintf_test13 diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test13/test13.c b/src/pal/tests/palsuite/c_runtime/vfprintf/test13/test13.cpp index 1e42ce9e8d..1e42ce9e8d 100644 --- a/src/pal/tests/palsuite/c_runtime/vfprintf/test13/test13.c +++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test13/test13.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test14/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vfprintf/test14/CMakeLists.txt index 396a4631c5..bd91f509b5 100644 --- a/src/pal/tests/palsuite/c_runtime/vfprintf/test14/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test14/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test14.c + test14.cpp ) add_executable(paltest_vfprintf_test14 diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test14/test14.c b/src/pal/tests/palsuite/c_runtime/vfprintf/test14/test14.cpp index 82f247430f..82f247430f 100644 --- a/src/pal/tests/palsuite/c_runtime/vfprintf/test14/test14.c +++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test14/test14.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test15/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vfprintf/test15/CMakeLists.txt index b9ddbe3b4a..30003b82f8 100644 --- a/src/pal/tests/palsuite/c_runtime/vfprintf/test15/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test15/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test15.c + test15.cpp ) add_executable(paltest_vfprintf_test15 diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test15/test15.c b/src/pal/tests/palsuite/c_runtime/vfprintf/test15/test15.cpp index 53cc2ceb87..53cc2ceb87 100644 --- a/src/pal/tests/palsuite/c_runtime/vfprintf/test15/test15.c +++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test15/test15.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test16/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vfprintf/test16/CMakeLists.txt index 0fd4177ed8..a287f120a0 100644 --- a/src/pal/tests/palsuite/c_runtime/vfprintf/test16/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test16/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test16.c + test16.cpp ) add_executable(paltest_vfprintf_test16 diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test16/test16.c b/src/pal/tests/palsuite/c_runtime/vfprintf/test16/test16.cpp index 2b7674bb94..2b7674bb94 100644 --- a/src/pal/tests/palsuite/c_runtime/vfprintf/test16/test16.c +++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test16/test16.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test17/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vfprintf/test17/CMakeLists.txt index afc0b3828d..cf1afd9d2d 100644 --- a/src/pal/tests/palsuite/c_runtime/vfprintf/test17/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test17/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test17.c + test17.cpp ) add_executable(paltest_vfprintf_test17 diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test17/test17.c b/src/pal/tests/palsuite/c_runtime/vfprintf/test17/test17.cpp index 956be15f6f..956be15f6f 100644 --- a/src/pal/tests/palsuite/c_runtime/vfprintf/test17/test17.c +++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test17/test17.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test18/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vfprintf/test18/CMakeLists.txt index 9e373b999e..143eade9b3 100644 --- a/src/pal/tests/palsuite/c_runtime/vfprintf/test18/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test18/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test18.c + test18.cpp ) add_executable(paltest_vfprintf_test18 diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test18/test18.c b/src/pal/tests/palsuite/c_runtime/vfprintf/test18/test18.cpp index c61c8cbdab..c61c8cbdab 100644 --- a/src/pal/tests/palsuite/c_runtime/vfprintf/test18/test18.c +++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test18/test18.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test19/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vfprintf/test19/CMakeLists.txt index 3120c9117f..452d929b7d 100644 --- a/src/pal/tests/palsuite/c_runtime/vfprintf/test19/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test19/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test19.c + test19.cpp ) add_executable(paltest_vfprintf_test19 diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test19/test19.c b/src/pal/tests/palsuite/c_runtime/vfprintf/test19/test19.c deleted file mode 100644 index e88ce23663..0000000000 --- a/src/pal/tests/palsuite/c_runtime/vfprintf/test19/test19.c +++ /dev/null @@ -1,76 +0,0 @@ -// 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: test19.c -** -** Purpose: Test #19 for the vfprintf function. Tests the variable length -** precision argument. -** -** -**==========================================================================*/ - - -#include <palsuite.h> -#include "../vfprintf.h" - - - - -int __cdecl main(int argc, char *argv[]) -{ - int n = -1; - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - DoArgumentPrecTest("%.*s", 2, "bar", "bar", "ba", "ba"); - DoArgumentPrecTest("%.*S", 2, convert("bar"), "bar", "ba", "ba"); - - DoArgumentPrecTest("%.*n ", 3, &n, "pointer to int", " ", " "); - if (n != 0) - { - Fail("ERROR: Expected count parameter to resolve to %d, got %X\n", - 0, n); - } - - DoArgumentPrecTest("%.*c", 0, (void*)'a', "a", "a", "a"); - DoArgumentPrecTest("%.*c", 4, (void*)'a', "a", "a", "a"); - DoArgumentPrecTest("%.*C", 0, (void*)'a', "a", "a", "a"); - DoArgumentPrecTest("%.*C", 4, (void*)'a', "a", "a", "a"); - DoArgumentPrecTest("%.*d", 1, (void*)42, "42", "42", "42"); - DoArgumentPrecTest("%.*d", 3, (void*)42, "42", "042", "042"); - DoArgumentPrecTest("%.*i", 1, (void*)42, "42", "42", "42"); - DoArgumentPrecTest("%.*i", 3, (void*)42, "42", "042", "042"); - DoArgumentPrecTest("%.*o", 1, (void*)42, "42", "52", "52"); - DoArgumentPrecTest("%.*o", 3, (void*)42, "42", "052", "052"); - DoArgumentPrecTest("%.*u", 1, (void*)42, "42", "42", "42"); - DoArgumentPrecTest("%.*u", 3, (void*)42, "42", "042", "042"); - DoArgumentPrecTest("%.*x", 1, (void*)0x42, "0x42", "42", "42"); - DoArgumentPrecTest("%.*x", 3, (void*)0x42, "0x42", "042", "042"); - DoArgumentPrecTest("%.*X", 1, (void*)0x42, "0x42", "42", "42"); - DoArgumentPrecTest("%.*X", 3, (void*)0x42, "0x42", "042", "042"); - - - DoArgumentPrecDoubleTest("%.*e", 1, 2.01, "2.0e+000", "2.0e+00"); - DoArgumentPrecDoubleTest("%.*e", 3, 2.01, "2.010e+000", "2.010e+00"); - DoArgumentPrecDoubleTest("%.*E", 1, 2.01, "2.0E+000", "2.0E+00"); - DoArgumentPrecDoubleTest("%.*E", 3, 2.01, "2.010E+000", "2.010E+00"); - DoArgumentPrecDoubleTest("%.*f", 1, 2.01, "2.0", "2.0"); - DoArgumentPrecDoubleTest("%.*f", 3, 2.01, "2.010", "2.010"); - DoArgumentPrecDoubleTest("%.*g", 1, 256.01, "3e+002", "3e+02"); - DoArgumentPrecDoubleTest("%.*g", 3, 256.01, "256", "256"); - DoArgumentPrecDoubleTest("%.*g", 4, 256.01, "256", "256"); - DoArgumentPrecDoubleTest("%.*g", 6, 256.01, "256.01", "256.01"); - DoArgumentPrecDoubleTest("%.*G", 1, 256.01, "3E+002", "3E+02"); - DoArgumentPrecDoubleTest("%.*G", 3, 256.01, "256", "256"); - DoArgumentPrecDoubleTest("%.*G", 4, 256.01, "256", "256"); - DoArgumentPrecDoubleTest("%.*G", 6, 256.01, "256.01", "256.01"); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test19/test19.cpp b/src/pal/tests/palsuite/c_runtime/vfprintf/test19/test19.cpp new file mode 100644 index 0000000000..d8e8f9301d --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test19/test19.cpp @@ -0,0 +1,76 @@ +// 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: test19.c +** +** Purpose: Test #19 for the vfprintf function. Tests the variable length +** precision argument. +** +** +**==========================================================================*/ + + +#include <palsuite.h> +#include "../vfprintf.h" + + + + +int __cdecl main(int argc, char *argv[]) +{ + int n = -1; + + if (PAL_Initialize(argc, argv)) + { + return FAIL; + } + + DoArgumentPrecTest("%.*s", 2, (void*)"bar", "bar", "ba", "ba"); + DoArgumentPrecTest("%.*S", 2, (void*)convert("bar"), "bar", "ba", "ba"); + + DoArgumentPrecTest("%.*n ", 3, (void*)&n, "pointer to int", " ", " "); + if (n != 0) + { + Fail("ERROR: Expected count parameter to resolve to %d, got %X\n", + 0, n); + } + + DoArgumentPrecTest("%.*c", 0, (void*)'a', "a", "a", "a"); + DoArgumentPrecTest("%.*c", 4, (void*)'a', "a", "a", "a"); + DoArgumentPrecTest("%.*C", 0, (void*)'a', "a", "a", "a"); + DoArgumentPrecTest("%.*C", 4, (void*)'a', "a", "a", "a"); + DoArgumentPrecTest("%.*d", 1, (void*)42, "42", "42", "42"); + DoArgumentPrecTest("%.*d", 3, (void*)42, "42", "042", "042"); + DoArgumentPrecTest("%.*i", 1, (void*)42, "42", "42", "42"); + DoArgumentPrecTest("%.*i", 3, (void*)42, "42", "042", "042"); + DoArgumentPrecTest("%.*o", 1, (void*)42, "42", "52", "52"); + DoArgumentPrecTest("%.*o", 3, (void*)42, "42", "052", "052"); + DoArgumentPrecTest("%.*u", 1, (void*)42, "42", "42", "42"); + DoArgumentPrecTest("%.*u", 3, (void*)42, "42", "042", "042"); + DoArgumentPrecTest("%.*x", 1, (void*)0x42, "0x42", "42", "42"); + DoArgumentPrecTest("%.*x", 3, (void*)0x42, "0x42", "042", "042"); + DoArgumentPrecTest("%.*X", 1, (void*)0x42, "0x42", "42", "42"); + DoArgumentPrecTest("%.*X", 3, (void*)0x42, "0x42", "042", "042"); + + + DoArgumentPrecDoubleTest("%.*e", 1, 2.01, "2.0e+000", "2.0e+00"); + DoArgumentPrecDoubleTest("%.*e", 3, 2.01, "2.010e+000", "2.010e+00"); + DoArgumentPrecDoubleTest("%.*E", 1, 2.01, "2.0E+000", "2.0E+00"); + DoArgumentPrecDoubleTest("%.*E", 3, 2.01, "2.010E+000", "2.010E+00"); + DoArgumentPrecDoubleTest("%.*f", 1, 2.01, "2.0", "2.0"); + DoArgumentPrecDoubleTest("%.*f", 3, 2.01, "2.010", "2.010"); + DoArgumentPrecDoubleTest("%.*g", 1, 256.01, "3e+002", "3e+02"); + DoArgumentPrecDoubleTest("%.*g", 3, 256.01, "256", "256"); + DoArgumentPrecDoubleTest("%.*g", 4, 256.01, "256", "256"); + DoArgumentPrecDoubleTest("%.*g", 6, 256.01, "256.01", "256.01"); + DoArgumentPrecDoubleTest("%.*G", 1, 256.01, "3E+002", "3E+02"); + DoArgumentPrecDoubleTest("%.*G", 3, 256.01, "256", "256"); + DoArgumentPrecDoubleTest("%.*G", 4, 256.01, "256", "256"); + DoArgumentPrecDoubleTest("%.*G", 6, 256.01, "256.01", "256.01"); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vfprintf/test2/CMakeLists.txt index 6e700090d6..b18fb712c6 100644 --- a/src/pal/tests/palsuite/c_runtime/vfprintf/test2/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test2/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test2.c + test2.cpp ) add_executable(paltest_vfprintf_test2 diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test2/test2.c b/src/pal/tests/palsuite/c_runtime/vfprintf/test2/test2.cpp index d01117f047..d01117f047 100644 --- a/src/pal/tests/palsuite/c_runtime/vfprintf/test2/test2.c +++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test2/test2.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vfprintf/test3/CMakeLists.txt index 1a14d85603..a8f7eb1991 100644 --- a/src/pal/tests/palsuite/c_runtime/vfprintf/test3/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test3/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test3.c + test3.cpp ) add_executable(paltest_vfprintf_test3 diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test3/test3.c b/src/pal/tests/palsuite/c_runtime/vfprintf/test3/test3.cpp index 0081daa426..0081daa426 100644 --- a/src/pal/tests/palsuite/c_runtime/vfprintf/test3/test3.c +++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test3/test3.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test4/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vfprintf/test4/CMakeLists.txt index c1285942bc..60c31693a5 100644 --- a/src/pal/tests/palsuite/c_runtime/vfprintf/test4/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test4/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test4.c + test4.cpp ) add_executable(paltest_vfprintf_test4 diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test4/test4.c b/src/pal/tests/palsuite/c_runtime/vfprintf/test4/test4.cpp index d24f08d6e0..d24f08d6e0 100644 --- a/src/pal/tests/palsuite/c_runtime/vfprintf/test4/test4.c +++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test4/test4.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test5/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vfprintf/test5/CMakeLists.txt index 0cccdfd630..5f516fec6a 100644 --- a/src/pal/tests/palsuite/c_runtime/vfprintf/test5/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test5/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test5.c + test5.cpp ) add_executable(paltest_vfprintf_test5 diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test5/test5.c b/src/pal/tests/palsuite/c_runtime/vfprintf/test5/test5.cpp index 44f21b61db..44f21b61db 100644 --- a/src/pal/tests/palsuite/c_runtime/vfprintf/test5/test5.c +++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test5/test5.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test6/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vfprintf/test6/CMakeLists.txt index 2c036a45ae..7f0cc710af 100644 --- a/src/pal/tests/palsuite/c_runtime/vfprintf/test6/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test6/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test6.c + test6.cpp ) add_executable(paltest_vfprintf_test6 diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test6/test6.c b/src/pal/tests/palsuite/c_runtime/vfprintf/test6/test6.cpp index 36c6fe51ca..36c6fe51ca 100644 --- a/src/pal/tests/palsuite/c_runtime/vfprintf/test6/test6.c +++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test6/test6.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test7/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vfprintf/test7/CMakeLists.txt index ca483af773..a2cd9a2e8f 100644 --- a/src/pal/tests/palsuite/c_runtime/vfprintf/test7/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test7/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test7.c + test7.cpp ) add_executable(paltest_vfprintf_test7 diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test7/test7.c b/src/pal/tests/palsuite/c_runtime/vfprintf/test7/test7.cpp index a9cfe319bd..a9cfe319bd 100644 --- a/src/pal/tests/palsuite/c_runtime/vfprintf/test7/test7.c +++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test7/test7.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test8/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vfprintf/test8/CMakeLists.txt index 89459b4e93..a7b20ee43e 100644 --- a/src/pal/tests/palsuite/c_runtime/vfprintf/test8/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test8/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test8.c + test8.cpp ) add_executable(paltest_vfprintf_test8 diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test8/test8.c b/src/pal/tests/palsuite/c_runtime/vfprintf/test8/test8.cpp index 5cef99741a..5cef99741a 100644 --- a/src/pal/tests/palsuite/c_runtime/vfprintf/test8/test8.c +++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test8/test8.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test9/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vfprintf/test9/CMakeLists.txt index 3e3b5b99ed..242b635f93 100644 --- a/src/pal/tests/palsuite/c_runtime/vfprintf/test9/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test9/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test9.c + test9.cpp ) add_executable(paltest_vfprintf_test9 diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test9/test9.c b/src/pal/tests/palsuite/c_runtime/vfprintf/test9/test9.cpp index 45d0dc7a9e..45d0dc7a9e 100644 --- a/src/pal/tests/palsuite/c_runtime/vfprintf/test9/test9.c +++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test9/test9.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/vfprintf.h b/src/pal/tests/palsuite/c_runtime/vfprintf/vfprintf.h index f4ae7a53fa..7901b08b0d 100644 --- a/src/pal/tests/palsuite/c_runtime/vfprintf/vfprintf.h +++ b/src/pal/tests/palsuite/c_runtime/vfprintf/vfprintf.h @@ -14,7 +14,7 @@ #ifndef __vfprintf_H__ #define __vfprintf_H__ -int DoVfprintf(FILE *fp, char *format, ...) +int DoVfprintf(FILE *fp, const char *format, ...) { int retVal; va_list arglist; @@ -26,7 +26,7 @@ int DoVfprintf(FILE *fp, char *format, ...) return (retVal); } -void DoStrTest(char *formatstr, char* param, char *checkstr) +void DoStrTest(const char *formatstr, char* param, const char *checkstr) { FILE *fp; char buf[256] = { 0 }; @@ -57,7 +57,7 @@ void DoStrTest(char *formatstr, char* param, char *checkstr) fclose(fp); } -void DoWStrTest(char *formatstr, WCHAR* param, char *checkstr) +void DoWStrTest(const char *formatstr, WCHAR* param, const char *checkstr) { FILE *fp; char buf[256] = { 0 }; @@ -89,8 +89,8 @@ void DoWStrTest(char *formatstr, WCHAR* param, char *checkstr) } -void DoPointerTest(char *formatstr, void* param, char* paramstr, - char *checkstr1) +void DoPointerTest(const char *formatstr, void* param, char* paramstr, + const char *checkstr1) { FILE *fp; char buf[256] = { 0 }; @@ -130,7 +130,7 @@ void DoPointerTest(char *formatstr, void* param, char* paramstr, -void DoCountTest(char *formatstr, int param, char *checkstr) +void DoCountTest(const char *formatstr, int param, const char *checkstr) { FILE *fp; char buf[512] = { 0 }; @@ -173,7 +173,7 @@ void DoCountTest(char *formatstr, int param, char *checkstr) } } -void DoShortCountTest(char *formatstr, int param, char *checkstr) +void DoShortCountTest(const char *formatstr, int param, const char *checkstr) { FILE *fp; char buf[512] = { 0 }; @@ -217,7 +217,7 @@ void DoShortCountTest(char *formatstr, int param, char *checkstr) } -void DoCharTest(char *formatstr, char param, char *checkstr) +void DoCharTest(const char *formatstr, char param, const char *checkstr) { FILE *fp; char buf[256] = { 0 }; @@ -248,7 +248,7 @@ void DoCharTest(char *formatstr, char param, char *checkstr) fclose(fp); } -void DoWCharTest(char *formatstr, WCHAR param, char *checkstr) +void DoWCharTest(const char *formatstr, WCHAR param, const char *checkstr) { FILE *fp; char buf[256] = { 0 }; @@ -279,7 +279,7 @@ void DoWCharTest(char *formatstr, WCHAR param, char *checkstr) fclose(fp); } -void DoNumTest(char *formatstr, int value, char *checkstr) +void DoNumTest(const char *formatstr, int value, const char *checkstr) { FILE *fp; char buf[256] = { 0 }; @@ -310,7 +310,7 @@ void DoNumTest(char *formatstr, int value, char *checkstr) fclose(fp); } -void DoI64Test(char *formatstr, INT64 value, char *valuestr, char *checkstr1) +void DoI64Test(const char *formatstr, INT64 value, char *valuestr, const char *checkstr1) { FILE *fp; char buf[256] = { 0 }; @@ -341,8 +341,8 @@ void DoI64Test(char *formatstr, INT64 value, char *valuestr, char *checkstr1) fclose(fp); } -void DoDoubleTest(char *formatstr, double value, char *checkstr1, - char *checkstr2) +void DoDoubleTest(const char *formatstr, double value, const char *checkstr1, + const char *checkstr2) { FILE *fp; char buf[256] = { 0 }; @@ -376,8 +376,8 @@ void DoDoubleTest(char *formatstr, double value, char *checkstr1, } -void DoArgumentPrecTest(char *formatstr, int precision, void *param, - char *paramstr, char *checkstr1, char *checkstr2) +void DoArgumentPrecTest(const char *formatstr, int precision, void *param, + char *paramstr, const char *checkstr1, const char *checkstr2) { FILE *fp; char buf[256]; @@ -418,8 +418,8 @@ void DoArgumentPrecTest(char *formatstr, int precision, void *param, } -void DoArgumentPrecDoubleTest(char *formatstr, int precision, double param, - char *checkstr1, char *checkstr2) +void DoArgumentPrecDoubleTest(const char *formatstr, int precision, double param, + const char *checkstr1, const char *checkstr2) { FILE *fp; char buf[256]; diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vprintf/test1/CMakeLists.txt index eabdf87393..9d866e16a2 100644 --- a/src/pal/tests/palsuite/c_runtime/vprintf/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vprintf/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_vprintf_test1 diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/vprintf/test1/test1.cpp index 404d7a0dc9..404d7a0dc9 100644 --- a/src/pal/tests/palsuite/c_runtime/vprintf/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/vprintf/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test10/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vprintf/test10/CMakeLists.txt index 47a21d909a..4ed04b46c6 100644 --- a/src/pal/tests/palsuite/c_runtime/vprintf/test10/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vprintf/test10/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test10.c + test10.cpp ) add_executable(paltest_vprintf_test10 diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test10/test10.c b/src/pal/tests/palsuite/c_runtime/vprintf/test10/test10.cpp index b363d7c02c..b363d7c02c 100644 --- a/src/pal/tests/palsuite/c_runtime/vprintf/test10/test10.c +++ b/src/pal/tests/palsuite/c_runtime/vprintf/test10/test10.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test11/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vprintf/test11/CMakeLists.txt index 4c750b72ac..5dc3c6dc69 100644 --- a/src/pal/tests/palsuite/c_runtime/vprintf/test11/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vprintf/test11/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test11.c + test11.cpp ) add_executable(paltest_vprintf_test11 diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test11/test11.c b/src/pal/tests/palsuite/c_runtime/vprintf/test11/test11.cpp index f5157ac99f..f5157ac99f 100644 --- a/src/pal/tests/palsuite/c_runtime/vprintf/test11/test11.c +++ b/src/pal/tests/palsuite/c_runtime/vprintf/test11/test11.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test12/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vprintf/test12/CMakeLists.txt index 1feb886fc1..a8104296c4 100644 --- a/src/pal/tests/palsuite/c_runtime/vprintf/test12/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vprintf/test12/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test12.c + test12.cpp ) add_executable(paltest_vprintf_test12 diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test12/test12.c b/src/pal/tests/palsuite/c_runtime/vprintf/test12/test12.cpp index 703a8c4fdc..703a8c4fdc 100644 --- a/src/pal/tests/palsuite/c_runtime/vprintf/test12/test12.c +++ b/src/pal/tests/palsuite/c_runtime/vprintf/test12/test12.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test13/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vprintf/test13/CMakeLists.txt index cd7535a1ad..df98081ed7 100644 --- a/src/pal/tests/palsuite/c_runtime/vprintf/test13/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vprintf/test13/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test13.c + test13.cpp ) add_executable(paltest_vprintf_test13 diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test13/test13.c b/src/pal/tests/palsuite/c_runtime/vprintf/test13/test13.cpp index ecb83ba38d..ecb83ba38d 100644 --- a/src/pal/tests/palsuite/c_runtime/vprintf/test13/test13.c +++ b/src/pal/tests/palsuite/c_runtime/vprintf/test13/test13.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test14/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vprintf/test14/CMakeLists.txt index 82cfd68ecf..b903d4e241 100644 --- a/src/pal/tests/palsuite/c_runtime/vprintf/test14/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vprintf/test14/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test14.c + test14.cpp ) add_executable(paltest_vprintf_test14 diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test14/test14.c b/src/pal/tests/palsuite/c_runtime/vprintf/test14/test14.cpp index 536c1950e3..536c1950e3 100644 --- a/src/pal/tests/palsuite/c_runtime/vprintf/test14/test14.c +++ b/src/pal/tests/palsuite/c_runtime/vprintf/test14/test14.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test15/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vprintf/test15/CMakeLists.txt index 29a134d48c..659ed9cb44 100644 --- a/src/pal/tests/palsuite/c_runtime/vprintf/test15/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vprintf/test15/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test15.c + test15.cpp ) add_executable(paltest_vprintf_test15 diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test15/test15.c b/src/pal/tests/palsuite/c_runtime/vprintf/test15/test15.cpp index 9aff6e457d..9aff6e457d 100644 --- a/src/pal/tests/palsuite/c_runtime/vprintf/test15/test15.c +++ b/src/pal/tests/palsuite/c_runtime/vprintf/test15/test15.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test16/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vprintf/test16/CMakeLists.txt index 7fbf43ac84..b2f7fe8b78 100644 --- a/src/pal/tests/palsuite/c_runtime/vprintf/test16/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vprintf/test16/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test16.c + test16.cpp ) add_executable(paltest_vprintf_test16 diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test16/test16.c b/src/pal/tests/palsuite/c_runtime/vprintf/test16/test16.cpp index 66e9afe2d7..66e9afe2d7 100644 --- a/src/pal/tests/palsuite/c_runtime/vprintf/test16/test16.c +++ b/src/pal/tests/palsuite/c_runtime/vprintf/test16/test16.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test17/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vprintf/test17/CMakeLists.txt index 25970cba15..76cfc9ad06 100644 --- a/src/pal/tests/palsuite/c_runtime/vprintf/test17/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vprintf/test17/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test17.c + test17.cpp ) add_executable(paltest_vprintf_test17 diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test17/test17.c b/src/pal/tests/palsuite/c_runtime/vprintf/test17/test17.cpp index d36a084903..d36a084903 100644 --- a/src/pal/tests/palsuite/c_runtime/vprintf/test17/test17.c +++ b/src/pal/tests/palsuite/c_runtime/vprintf/test17/test17.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test18/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vprintf/test18/CMakeLists.txt index 45676b93dd..633fb7ee51 100644 --- a/src/pal/tests/palsuite/c_runtime/vprintf/test18/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vprintf/test18/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test18.c + test18.cpp ) add_executable(paltest_vprintf_test18 diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test18/test18.c b/src/pal/tests/palsuite/c_runtime/vprintf/test18/test18.cpp index 6fde79b5fb..6fde79b5fb 100644 --- a/src/pal/tests/palsuite/c_runtime/vprintf/test18/test18.c +++ b/src/pal/tests/palsuite/c_runtime/vprintf/test18/test18.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test19/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vprintf/test19/CMakeLists.txt index 25bc2fccd1..1a6256ad0b 100644 --- a/src/pal/tests/palsuite/c_runtime/vprintf/test19/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vprintf/test19/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test19.c + test19.cpp ) add_executable(paltest_vprintf_test19 diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test19/test19.c b/src/pal/tests/palsuite/c_runtime/vprintf/test19/test19.c deleted file mode 100644 index d79f2e2591..0000000000 --- a/src/pal/tests/palsuite/c_runtime/vprintf/test19/test19.c +++ /dev/null @@ -1,76 +0,0 @@ -// 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: test19.c -** -** Purpose: Test #19 for the vprintf function. Tests the variable length -** precision argument. -** -** -**==========================================================================*/ - - -#include <palsuite.h> -#include "../vprintf.h" - - - - -int __cdecl main(int argc, char *argv[]) -{ - int n = -1; - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - DoArgumentPrecTest("%.*s", 2, "bar", "bar", "ba", "ba"); - DoArgumentPrecTest("%.*S", 2, convert("bar"), "bar", "ba", "ba"); - - DoArgumentPrecTest("%.*n", 3, &n, "pointer to int", "", ""); - if (n != 0) - { - Fail("ERROR: Expected count parameter to resolve to %d, got %X\n", - 0, n); - } - - DoArgumentPrecTest("%.*c", 0, (void*)'a', "a", "a", "a"); - DoArgumentPrecTest("%.*c", 4, (void*)'a', "a", "a", "a"); - DoArgumentPrecTest("%.*C", 0, (void*)'a', "a", "a", "a"); - DoArgumentPrecTest("%.*C", 4, (void*)'a', "a", "a", "a"); - DoArgumentPrecTest("%.*d", 1, (void*)42, "42", "42", "42"); - DoArgumentPrecTest("%.*d", 3, (void*)42, "42", "042", "042"); - DoArgumentPrecTest("%.*i", 1, (void*)42, "42", "42", "42"); - DoArgumentPrecTest("%.*i", 3, (void*)42, "42", "042", "042"); - DoArgumentPrecTest("%.*o", 1, (void*)42, "42", "52", "52"); - DoArgumentPrecTest("%.*o", 3, (void*)42, "42", "052", "052"); - DoArgumentPrecTest("%.*u", 1, (void*)42, "42", "42", "42"); - DoArgumentPrecTest("%.*u", 3, (void*)42, "42", "042", "042"); - DoArgumentPrecTest("%.*x", 1, (void*)0x42, "0x42", "42", "42"); - DoArgumentPrecTest("%.*x", 3, (void*)0x42, "0x42", "042", "042"); - DoArgumentPrecTest("%.*X", 1, (void*)0x42, "0x42", "42", "42"); - DoArgumentPrecTest("%.*X", 3, (void*)0x42, "0x42", "042", "042"); - - - DoArgumentPrecDoubleTest("%.*e", 1, 2.01, "2.0e+000", "2.0e+00"); - DoArgumentPrecDoubleTest("%.*e", 3, 2.01, "2.010e+000", "2.010e+00"); - DoArgumentPrecDoubleTest("%.*E", 1, 2.01, "2.0E+000", "2.0E+00"); - DoArgumentPrecDoubleTest("%.*E", 3, 2.01, "2.010E+000", "2.010E+00"); - DoArgumentPrecDoubleTest("%.*f", 1, 2.01, "2.0", "2.0"); - DoArgumentPrecDoubleTest("%.*f", 3, 2.01, "2.010", "2.010"); - DoArgumentPrecDoubleTest("%.*g", 1, 256.01, "3e+002", "3e+02"); - DoArgumentPrecDoubleTest("%.*g", 3, 256.01, "256", "256"); - DoArgumentPrecDoubleTest("%.*g", 4, 256.01, "256", "256"); - DoArgumentPrecDoubleTest("%.*g", 6, 256.01, "256.01", "256.01"); - DoArgumentPrecDoubleTest("%.*G", 1, 256.01, "3E+002", "3E+02"); - DoArgumentPrecDoubleTest("%.*G", 3, 256.01, "256", "256"); - DoArgumentPrecDoubleTest("%.*G", 4, 256.01, "256", "256"); - DoArgumentPrecDoubleTest("%.*G", 6, 256.01, "256.01", "256.01"); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test19/test19.cpp b/src/pal/tests/palsuite/c_runtime/vprintf/test19/test19.cpp new file mode 100644 index 0000000000..a3e0877369 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/vprintf/test19/test19.cpp @@ -0,0 +1,76 @@ +// 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: test19.c +** +** Purpose: Test #19 for the vprintf function. Tests the variable length +** precision argument. +** +** +**==========================================================================*/ + + +#include <palsuite.h> +#include "../vprintf.h" + + + + +int __cdecl main(int argc, char *argv[]) +{ + int n = -1; + + if (PAL_Initialize(argc, argv)) + { + return FAIL; + } + + DoArgumentPrecTest("%.*s", 2, (void*)"bar", "bar", "ba", "ba"); + DoArgumentPrecTest("%.*S", 2, (void*)convert("bar"), "bar", "ba", "ba"); + + DoArgumentPrecTest("%.*n", 3, (void*)&n, "pointer to int", "", ""); + if (n != 0) + { + Fail("ERROR: Expected count parameter to resolve to %d, got %X\n", + 0, n); + } + + DoArgumentPrecTest("%.*c", 0, (void*)'a', "a", "a", "a"); + DoArgumentPrecTest("%.*c", 4, (void*)'a', "a", "a", "a"); + DoArgumentPrecTest("%.*C", 0, (void*)'a', "a", "a", "a"); + DoArgumentPrecTest("%.*C", 4, (void*)'a', "a", "a", "a"); + DoArgumentPrecTest("%.*d", 1, (void*)42, "42", "42", "42"); + DoArgumentPrecTest("%.*d", 3, (void*)42, "42", "042", "042"); + DoArgumentPrecTest("%.*i", 1, (void*)42, "42", "42", "42"); + DoArgumentPrecTest("%.*i", 3, (void*)42, "42", "042", "042"); + DoArgumentPrecTest("%.*o", 1, (void*)42, "42", "52", "52"); + DoArgumentPrecTest("%.*o", 3, (void*)42, "42", "052", "052"); + DoArgumentPrecTest("%.*u", 1, (void*)42, "42", "42", "42"); + DoArgumentPrecTest("%.*u", 3, (void*)42, "42", "042", "042"); + DoArgumentPrecTest("%.*x", 1, (void*)0x42, "0x42", "42", "42"); + DoArgumentPrecTest("%.*x", 3, (void*)0x42, "0x42", "042", "042"); + DoArgumentPrecTest("%.*X", 1, (void*)0x42, "0x42", "42", "42"); + DoArgumentPrecTest("%.*X", 3, (void*)0x42, "0x42", "042", "042"); + + + DoArgumentPrecDoubleTest("%.*e", 1, 2.01, "2.0e+000", "2.0e+00"); + DoArgumentPrecDoubleTest("%.*e", 3, 2.01, "2.010e+000", "2.010e+00"); + DoArgumentPrecDoubleTest("%.*E", 1, 2.01, "2.0E+000", "2.0E+00"); + DoArgumentPrecDoubleTest("%.*E", 3, 2.01, "2.010E+000", "2.010E+00"); + DoArgumentPrecDoubleTest("%.*f", 1, 2.01, "2.0", "2.0"); + DoArgumentPrecDoubleTest("%.*f", 3, 2.01, "2.010", "2.010"); + DoArgumentPrecDoubleTest("%.*g", 1, 256.01, "3e+002", "3e+02"); + DoArgumentPrecDoubleTest("%.*g", 3, 256.01, "256", "256"); + DoArgumentPrecDoubleTest("%.*g", 4, 256.01, "256", "256"); + DoArgumentPrecDoubleTest("%.*g", 6, 256.01, "256.01", "256.01"); + DoArgumentPrecDoubleTest("%.*G", 1, 256.01, "3E+002", "3E+02"); + DoArgumentPrecDoubleTest("%.*G", 3, 256.01, "256", "256"); + DoArgumentPrecDoubleTest("%.*G", 4, 256.01, "256", "256"); + DoArgumentPrecDoubleTest("%.*G", 6, 256.01, "256.01", "256.01"); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vprintf/test2/CMakeLists.txt index 6820069cb9..41e2073477 100644 --- a/src/pal/tests/palsuite/c_runtime/vprintf/test2/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vprintf/test2/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test2.c + test2.cpp ) add_executable(paltest_vprintf_test2 diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test2/test2.c b/src/pal/tests/palsuite/c_runtime/vprintf/test2/test2.cpp index 4d9c9bc6f5..4d9c9bc6f5 100644 --- a/src/pal/tests/palsuite/c_runtime/vprintf/test2/test2.c +++ b/src/pal/tests/palsuite/c_runtime/vprintf/test2/test2.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vprintf/test3/CMakeLists.txt index 676d19bf7a..8570666b11 100644 --- a/src/pal/tests/palsuite/c_runtime/vprintf/test3/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vprintf/test3/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test3.c + test3.cpp ) add_executable(paltest_vprintf_test3 diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test3/test3.c b/src/pal/tests/palsuite/c_runtime/vprintf/test3/test3.cpp index 5376c56b76..5376c56b76 100644 --- a/src/pal/tests/palsuite/c_runtime/vprintf/test3/test3.c +++ b/src/pal/tests/palsuite/c_runtime/vprintf/test3/test3.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test4/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vprintf/test4/CMakeLists.txt index 9ddb087e83..06b582b5ee 100644 --- a/src/pal/tests/palsuite/c_runtime/vprintf/test4/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vprintf/test4/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test4.c + test4.cpp ) add_executable(paltest_vprintf_test4 diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test4/test4.c b/src/pal/tests/palsuite/c_runtime/vprintf/test4/test4.cpp index 3b66cde22e..3b66cde22e 100644 --- a/src/pal/tests/palsuite/c_runtime/vprintf/test4/test4.c +++ b/src/pal/tests/palsuite/c_runtime/vprintf/test4/test4.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test5/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vprintf/test5/CMakeLists.txt index f453bb66ee..3a1828a28c 100644 --- a/src/pal/tests/palsuite/c_runtime/vprintf/test5/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vprintf/test5/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test5.c + test5.cpp ) add_executable(paltest_vprintf_test5 diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test5/test5.c b/src/pal/tests/palsuite/c_runtime/vprintf/test5/test5.cpp index c9e2901230..c9e2901230 100644 --- a/src/pal/tests/palsuite/c_runtime/vprintf/test5/test5.c +++ b/src/pal/tests/palsuite/c_runtime/vprintf/test5/test5.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test6/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vprintf/test6/CMakeLists.txt index 1ce8d5aa4c..2dac7703e6 100644 --- a/src/pal/tests/palsuite/c_runtime/vprintf/test6/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vprintf/test6/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test6.c + test6.cpp ) add_executable(paltest_vprintf_test6 diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test6/test6.c b/src/pal/tests/palsuite/c_runtime/vprintf/test6/test6.cpp index 6a83cccea6..6a83cccea6 100644 --- a/src/pal/tests/palsuite/c_runtime/vprintf/test6/test6.c +++ b/src/pal/tests/palsuite/c_runtime/vprintf/test6/test6.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test7/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vprintf/test7/CMakeLists.txt index 5627fe4c1e..5a520045a9 100644 --- a/src/pal/tests/palsuite/c_runtime/vprintf/test7/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vprintf/test7/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test7.c + test7.cpp ) add_executable(paltest_vprintf_test7 diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test7/test7.c b/src/pal/tests/palsuite/c_runtime/vprintf/test7/test7.cpp index 5096ace42c..5096ace42c 100644 --- a/src/pal/tests/palsuite/c_runtime/vprintf/test7/test7.c +++ b/src/pal/tests/palsuite/c_runtime/vprintf/test7/test7.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test8/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vprintf/test8/CMakeLists.txt index 0131e4943e..18e4e3a0c9 100644 --- a/src/pal/tests/palsuite/c_runtime/vprintf/test8/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vprintf/test8/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test8.c + test8.cpp ) add_executable(paltest_vprintf_test8 diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test8/test8.c b/src/pal/tests/palsuite/c_runtime/vprintf/test8/test8.cpp index 2683339ece..2683339ece 100644 --- a/src/pal/tests/palsuite/c_runtime/vprintf/test8/test8.c +++ b/src/pal/tests/palsuite/c_runtime/vprintf/test8/test8.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test9/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vprintf/test9/CMakeLists.txt index c70631f9dc..8bcbe81f51 100644 --- a/src/pal/tests/palsuite/c_runtime/vprintf/test9/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vprintf/test9/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test9.c + test9.cpp ) add_executable(paltest_vprintf_test9 diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test9/test9.c b/src/pal/tests/palsuite/c_runtime/vprintf/test9/test9.cpp index 8545bc760e..8545bc760e 100644 --- a/src/pal/tests/palsuite/c_runtime/vprintf/test9/test9.c +++ b/src/pal/tests/palsuite/c_runtime/vprintf/test9/test9.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/vprintf.h b/src/pal/tests/palsuite/c_runtime/vprintf/vprintf.h index 477db32f4d..fcd8f80370 100644 --- a/src/pal/tests/palsuite/c_runtime/vprintf/vprintf.h +++ b/src/pal/tests/palsuite/c_runtime/vprintf/vprintf.h @@ -14,7 +14,7 @@ #ifndef __vprintf_H__ #define __vprintf_H__ -int DoVprintf(char *format, ...) +int DoVprintf(const char *format, ...) { int retVal; va_list arglist; @@ -26,7 +26,7 @@ int DoVprintf(char *format, ...) return (retVal); } -void DoStrTest(char *formatstr, char* param, char *checkstr) +void DoStrTest(const char *formatstr, char* param, const char *checkstr) { int ret; @@ -38,7 +38,7 @@ void DoStrTest(char *formatstr, char* param, char *checkstr) } } -void DoWStrTest(char *formatstr, WCHAR* param, char *checkstr) +void DoWStrTest(const char *formatstr, WCHAR* param, const char *checkstr) { int ret; @@ -50,8 +50,8 @@ void DoWStrTest(char *formatstr, WCHAR* param, char *checkstr) } } -void DoPointerTest(char *formatstr, void* param, char* paramstr, - char *checkstr1) +void DoPointerTest(const char *formatstr, void* param, char* paramstr, + const char *checkstr1) { int ret; @@ -63,7 +63,7 @@ void DoPointerTest(char *formatstr, void* param, char* paramstr, } } -void DoCountTest(char *formatstr, int param, char *checkstr) +void DoCountTest(const char *formatstr, int param, const char *checkstr) { int ret; int n = -1; @@ -82,7 +82,7 @@ void DoCountTest(char *formatstr, int param, char *checkstr) } } -void DoShortCountTest(char *formatstr, int param, char *checkstr) +void DoShortCountTest(const char *formatstr, int param, const char *checkstr) { int ret; short int n = -1; @@ -102,7 +102,7 @@ void DoShortCountTest(char *formatstr, int param, char *checkstr) } -void DoCharTest(char *formatstr, char param, char *checkstr) +void DoCharTest(const char *formatstr, char param, const char *checkstr) { int ret; @@ -114,7 +114,7 @@ void DoCharTest(char *formatstr, char param, char *checkstr) } } -void DoWCharTest(char *formatstr, WCHAR param, char *checkstr) +void DoWCharTest(const char *formatstr, WCHAR param, const char *checkstr) { int ret; @@ -126,7 +126,7 @@ void DoWCharTest(char *formatstr, WCHAR param, char *checkstr) } } -void DoNumTest(char *formatstr, int param, char *checkstr) +void DoNumTest(const char *formatstr, int param, const char *checkstr) { int ret; @@ -138,7 +138,7 @@ void DoNumTest(char *formatstr, int param, char *checkstr) } } -void DoI64Test(char *formatstr, INT64 param, char *valuestr, char *checkstr1) +void DoI64Test(const char *formatstr, INT64 param, char *valuestr, const char *checkstr1) { int ret; @@ -150,8 +150,8 @@ void DoI64Test(char *formatstr, INT64 param, char *valuestr, char *checkstr1) } } -void DoDoubleTest(char *formatstr, double param, char *checkstr1, - char *checkstr2) +void DoDoubleTest(const char *formatstr, double param, const char *checkstr1, + const char *checkstr2) { int ret; @@ -163,8 +163,8 @@ void DoDoubleTest(char *formatstr, double param, char *checkstr1, } } -void DoArgumentPrecTest(char *formatstr, int precision, void *param, - char *paramstr, char *checkstr1, char *checkstr2) +void DoArgumentPrecTest(const char *formatstr, int precision, void *param, + char *paramstr, const char *checkstr1, const char *checkstr2) { int ret; @@ -176,8 +176,8 @@ void DoArgumentPrecTest(char *formatstr, int precision, void *param, } } -void DoArgumentPrecDoubleTest(char *formatstr, int precision, double param, - char *checkstr1, char *checkstr2) +void DoArgumentPrecDoubleTest(const char *formatstr, int precision, double param, + const char *checkstr1, const char *checkstr2) { int ret; diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test1/CMakeLists.txt index 4f0872eccc..6861157c1b 100644 --- a/src/pal/tests/palsuite/c_runtime/vsprintf/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_vsprintf_test1 diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/vsprintf/test1/test1.cpp index 2007fefc5b..2007fefc5b 100644 --- a/src/pal/tests/palsuite/c_runtime/vsprintf/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test10/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test10/CMakeLists.txt index d32de01ba1..6f535a5098 100644 --- a/src/pal/tests/palsuite/c_runtime/vsprintf/test10/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test10/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test10.c + test10.cpp ) add_executable(paltest_vsprintf_test10 diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test10/test10.c b/src/pal/tests/palsuite/c_runtime/vsprintf/test10/test10.cpp index 791213fccc..791213fccc 100644 --- a/src/pal/tests/palsuite/c_runtime/vsprintf/test10/test10.c +++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test10/test10.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test11/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test11/CMakeLists.txt index ce67444c39..3fa628f77d 100644 --- a/src/pal/tests/palsuite/c_runtime/vsprintf/test11/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test11/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test11.c + test11.cpp ) add_executable(paltest_vsprintf_test11 diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test11/test11.c b/src/pal/tests/palsuite/c_runtime/vsprintf/test11/test11.cpp index e0af94981b..e0af94981b 100644 --- a/src/pal/tests/palsuite/c_runtime/vsprintf/test11/test11.c +++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test11/test11.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test12/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test12/CMakeLists.txt index fe6ccb8399..f34f76abc5 100644 --- a/src/pal/tests/palsuite/c_runtime/vsprintf/test12/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test12/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test12.c + test12.cpp ) add_executable(paltest_vsprintf_test12 diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test12/test12.c b/src/pal/tests/palsuite/c_runtime/vsprintf/test12/test12.cpp index f86ddcade8..f86ddcade8 100644 --- a/src/pal/tests/palsuite/c_runtime/vsprintf/test12/test12.c +++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test12/test12.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test13/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test13/CMakeLists.txt index 97fdf8cdd0..df23693f10 100644 --- a/src/pal/tests/palsuite/c_runtime/vsprintf/test13/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test13/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test13.c + test13.cpp ) add_executable(paltest_vsprintf_test13 diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test13/test13.c b/src/pal/tests/palsuite/c_runtime/vsprintf/test13/test13.cpp index 36e7825531..36e7825531 100644 --- a/src/pal/tests/palsuite/c_runtime/vsprintf/test13/test13.c +++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test13/test13.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test14/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test14/CMakeLists.txt index 2851a8893e..394b5ab97c 100644 --- a/src/pal/tests/palsuite/c_runtime/vsprintf/test14/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test14/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test14.c + test14.cpp ) add_executable(paltest_vsprintf_test14 diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test14/test14.c b/src/pal/tests/palsuite/c_runtime/vsprintf/test14/test14.cpp index 360fafc37f..360fafc37f 100644 --- a/src/pal/tests/palsuite/c_runtime/vsprintf/test14/test14.c +++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test14/test14.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test15/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test15/CMakeLists.txt index 6fb1d321b8..4793b45663 100644 --- a/src/pal/tests/palsuite/c_runtime/vsprintf/test15/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test15/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test15.c + test15.cpp ) add_executable(paltest_vsprintf_test15 diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test15/test15.c b/src/pal/tests/palsuite/c_runtime/vsprintf/test15/test15.cpp index a5b4c94226..a5b4c94226 100644 --- a/src/pal/tests/palsuite/c_runtime/vsprintf/test15/test15.c +++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test15/test15.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test16/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test16/CMakeLists.txt index ccc21378fc..6a0a52ddf7 100644 --- a/src/pal/tests/palsuite/c_runtime/vsprintf/test16/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test16/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test16.c + test16.cpp ) add_executable(paltest_vsprintf_test16 diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test16/test16.c b/src/pal/tests/palsuite/c_runtime/vsprintf/test16/test16.cpp index a7258db9d6..a7258db9d6 100644 --- a/src/pal/tests/palsuite/c_runtime/vsprintf/test16/test16.c +++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test16/test16.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test17/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test17/CMakeLists.txt index 4c9dcd986f..4e220dab77 100644 --- a/src/pal/tests/palsuite/c_runtime/vsprintf/test17/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test17/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test17.c + test17.cpp ) add_executable(paltest_vsprintf_test17 diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test17/test17.c b/src/pal/tests/palsuite/c_runtime/vsprintf/test17/test17.cpp index 0ad246a1ae..0ad246a1ae 100644 --- a/src/pal/tests/palsuite/c_runtime/vsprintf/test17/test17.c +++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test17/test17.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test18/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test18/CMakeLists.txt index 2e8610d4a5..4dd68c2987 100644 --- a/src/pal/tests/palsuite/c_runtime/vsprintf/test18/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test18/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test18.c + test18.cpp ) add_executable(paltest_vsprintf_test18 diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test18/test18.c b/src/pal/tests/palsuite/c_runtime/vsprintf/test18/test18.cpp index 9a45305562..9a45305562 100644 --- a/src/pal/tests/palsuite/c_runtime/vsprintf/test18/test18.c +++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test18/test18.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test19/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test19/CMakeLists.txt index 92e39ab597..3156a59a15 100644 --- a/src/pal/tests/palsuite/c_runtime/vsprintf/test19/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test19/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test19.c + test19.cpp ) add_executable(paltest_vsprintf_test19 diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test19/test19.c b/src/pal/tests/palsuite/c_runtime/vsprintf/test19/test19.c deleted file mode 100644 index 18590ed51b..0000000000 --- a/src/pal/tests/palsuite/c_runtime/vsprintf/test19/test19.c +++ /dev/null @@ -1,67 +0,0 @@ -// 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: test19.c -** -** Purpose: Test #19 for the vsprintf function. -** -** -**===================================================================*/ - -#include <palsuite.h> -#include "../vsprintf.h" - -/* - * Notes: memcmp is used, as is strlen. - */ - -int __cdecl main(int argc, char *argv[]) -{ - - if (PAL_Initialize(argc, argv) != 0) - { - return(FAIL); - } - - - DoArgumentPrecTest("%.*s", 2, "bar", "bar", "ba", "ba"); - DoArgumentPrecTest("%.*S", 2, convert("bar"), "bar", "ba", "ba"); - DoArgumentPrecTest("%.*c", 0, (void*)'a', "a", "a", "a"); - DoArgumentPrecTest("%.*c", 4, (void*)'a', "a", "a", "a"); - DoArgumentPrecTest("%.*C", 0, (void*)'a', "a", "a", "a"); - DoArgumentPrecTest("%.*C", 4, (void*)'a', "a", "a", "a"); - DoArgumentPrecTest("%.*d", 1, (void*)42, "42", "42", "42"); - DoArgumentPrecTest("%.*d", 3, (void*)42, "42", "042", "042"); - DoArgumentPrecTest("%.*i", 1, (void*)42, "42", "42", "42"); - DoArgumentPrecTest("%.*i", 3, (void*)42, "42", "042", "042"); - DoArgumentPrecTest("%.*o", 1, (void*)42, "42", "52", "52"); - DoArgumentPrecTest("%.*o", 3, (void*)42, "42", "052", "052"); - DoArgumentPrecTest("%.*u", 1, (void*)42, "42", "42", "42"); - DoArgumentPrecTest("%.*u", 3, (void*)42, "42", "042", "042"); - DoArgumentPrecTest("%.*x", 1, (void*)0x42, "0x42", "42", "42"); - DoArgumentPrecTest("%.*x", 3, (void*)0x42, "0x42", "042", "042"); - DoArgumentPrecTest("%.*X", 1, (void*)0x42, "0x42", "42", "42"); - DoArgumentPrecTest("%.*X", 3, (void*)0x42, "0x42", "042", "042"); - - - DoArgumentPrecDoubleTest("%.*e", 1, 2.01, "2.0e+000", "2.0e+00"); - DoArgumentPrecDoubleTest("%.*e", 3, 2.01, "2.010e+000", "2.010e+00"); - DoArgumentPrecDoubleTest("%.*E", 1, 2.01, "2.0E+000", "2.0E+00"); - DoArgumentPrecDoubleTest("%.*E", 3, 2.01, "2.010E+000", "2.010E+00"); - DoArgumentPrecDoubleTest("%.*f", 1, 2.01, "2.0", "2.0"); - DoArgumentPrecDoubleTest("%.*f", 3, 2.01, "2.010", "2.010"); - DoArgumentPrecDoubleTest("%.*g", 1, 256.01, "3e+002", "3e+02"); - DoArgumentPrecDoubleTest("%.*g", 3, 256.01, "256", "256"); - DoArgumentPrecDoubleTest("%.*g", 4, 256.01, "256", "256"); - DoArgumentPrecDoubleTest("%.*g", 6, 256.01, "256.01", "256.01"); - DoArgumentPrecDoubleTest("%.*G", 1, 256.01, "3E+002", "3E+02"); - DoArgumentPrecDoubleTest("%.*G", 3, 256.01, "256", "256"); - DoArgumentPrecDoubleTest("%.*G", 4, 256.01, "256", "256"); - DoArgumentPrecDoubleTest("%.*G", 6, 256.01, "256.01", "256.01"); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test19/test19.cpp b/src/pal/tests/palsuite/c_runtime/vsprintf/test19/test19.cpp new file mode 100644 index 0000000000..698ff36e35 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test19/test19.cpp @@ -0,0 +1,67 @@ +// 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: test19.c +** +** Purpose: Test #19 for the vsprintf function. +** +** +**===================================================================*/ + +#include <palsuite.h> +#include "../vsprintf.h" + +/* + * Notes: memcmp is used, as is strlen. + */ + +int __cdecl main(int argc, char *argv[]) +{ + + if (PAL_Initialize(argc, argv) != 0) + { + return(FAIL); + } + + + DoArgumentPrecTest("%.*s", 2, (void*)"bar", "bar", "ba", "ba"); + DoArgumentPrecTest("%.*S", 2, (void*)convert("bar"), "bar", "ba", "ba"); + DoArgumentPrecTest("%.*c", 0, (void*)'a', "a", "a", "a"); + DoArgumentPrecTest("%.*c", 4, (void*)'a', "a", "a", "a"); + DoArgumentPrecTest("%.*C", 0, (void*)'a', "a", "a", "a"); + DoArgumentPrecTest("%.*C", 4, (void*)'a', "a", "a", "a"); + DoArgumentPrecTest("%.*d", 1, (void*)42, "42", "42", "42"); + DoArgumentPrecTest("%.*d", 3, (void*)42, "42", "042", "042"); + DoArgumentPrecTest("%.*i", 1, (void*)42, "42", "42", "42"); + DoArgumentPrecTest("%.*i", 3, (void*)42, "42", "042", "042"); + DoArgumentPrecTest("%.*o", 1, (void*)42, "42", "52", "52"); + DoArgumentPrecTest("%.*o", 3, (void*)42, "42", "052", "052"); + DoArgumentPrecTest("%.*u", 1, (void*)42, "42", "42", "42"); + DoArgumentPrecTest("%.*u", 3, (void*)42, "42", "042", "042"); + DoArgumentPrecTest("%.*x", 1, (void*)0x42, "0x42", "42", "42"); + DoArgumentPrecTest("%.*x", 3, (void*)0x42, "0x42", "042", "042"); + DoArgumentPrecTest("%.*X", 1, (void*)0x42, "0x42", "42", "42"); + DoArgumentPrecTest("%.*X", 3, (void*)0x42, "0x42", "042", "042"); + + + DoArgumentPrecDoubleTest("%.*e", 1, 2.01, "2.0e+000", "2.0e+00"); + DoArgumentPrecDoubleTest("%.*e", 3, 2.01, "2.010e+000", "2.010e+00"); + DoArgumentPrecDoubleTest("%.*E", 1, 2.01, "2.0E+000", "2.0E+00"); + DoArgumentPrecDoubleTest("%.*E", 3, 2.01, "2.010E+000", "2.010E+00"); + DoArgumentPrecDoubleTest("%.*f", 1, 2.01, "2.0", "2.0"); + DoArgumentPrecDoubleTest("%.*f", 3, 2.01, "2.010", "2.010"); + DoArgumentPrecDoubleTest("%.*g", 1, 256.01, "3e+002", "3e+02"); + DoArgumentPrecDoubleTest("%.*g", 3, 256.01, "256", "256"); + DoArgumentPrecDoubleTest("%.*g", 4, 256.01, "256", "256"); + DoArgumentPrecDoubleTest("%.*g", 6, 256.01, "256.01", "256.01"); + DoArgumentPrecDoubleTest("%.*G", 1, 256.01, "3E+002", "3E+02"); + DoArgumentPrecDoubleTest("%.*G", 3, 256.01, "256", "256"); + DoArgumentPrecDoubleTest("%.*G", 4, 256.01, "256", "256"); + DoArgumentPrecDoubleTest("%.*G", 6, 256.01, "256.01", "256.01"); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test2/CMakeLists.txt index 2308bc2573..210224f0f1 100644 --- a/src/pal/tests/palsuite/c_runtime/vsprintf/test2/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test2/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test2.c + test2.cpp ) add_executable(paltest_vsprintf_test2 diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test2/test2.c b/src/pal/tests/palsuite/c_runtime/vsprintf/test2/test2.cpp index fbd4b41068..fbd4b41068 100644 --- a/src/pal/tests/palsuite/c_runtime/vsprintf/test2/test2.c +++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test2/test2.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test3/CMakeLists.txt index aef24171fc..5581051f9f 100644 --- a/src/pal/tests/palsuite/c_runtime/vsprintf/test3/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test3/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test3.c + test3.cpp ) add_executable(paltest_vsprintf_test3 diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test3/test3.c b/src/pal/tests/palsuite/c_runtime/vsprintf/test3/test3.cpp index 742370ebe9..742370ebe9 100644 --- a/src/pal/tests/palsuite/c_runtime/vsprintf/test3/test3.c +++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test3/test3.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test4/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test4/CMakeLists.txt index 9570255475..88817fcffb 100644 --- a/src/pal/tests/palsuite/c_runtime/vsprintf/test4/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test4/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test4.c + test4.cpp ) add_executable(paltest_vsprintf_test4 diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test4/test4.c b/src/pal/tests/palsuite/c_runtime/vsprintf/test4/test4.cpp index dc43a9e2c7..dc43a9e2c7 100644 --- a/src/pal/tests/palsuite/c_runtime/vsprintf/test4/test4.c +++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test4/test4.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test5/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test5/CMakeLists.txt index 34a3e6243f..6d14bf76bf 100644 --- a/src/pal/tests/palsuite/c_runtime/vsprintf/test5/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test5/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test5.c + test5.cpp ) add_executable(paltest_vsprintf_test5 diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test5/test5.c b/src/pal/tests/palsuite/c_runtime/vsprintf/test5/test5.cpp index e630d8863b..e630d8863b 100644 --- a/src/pal/tests/palsuite/c_runtime/vsprintf/test5/test5.c +++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test5/test5.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test6/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test6/CMakeLists.txt index dccca0b2b7..606fe3b965 100644 --- a/src/pal/tests/palsuite/c_runtime/vsprintf/test6/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test6/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test6.c + test6.cpp ) add_executable(paltest_vsprintf_test6 diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test6/test6.c b/src/pal/tests/palsuite/c_runtime/vsprintf/test6/test6.cpp index 0d38a3a114..0d38a3a114 100644 --- a/src/pal/tests/palsuite/c_runtime/vsprintf/test6/test6.c +++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test6/test6.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test7/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test7/CMakeLists.txt index 7f18de056e..2dee276968 100644 --- a/src/pal/tests/palsuite/c_runtime/vsprintf/test7/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test7/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test7.c + test7.cpp ) add_executable(paltest_vsprintf_test7 diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test7/test7.c b/src/pal/tests/palsuite/c_runtime/vsprintf/test7/test7.cpp index c9f87d4343..c9f87d4343 100644 --- a/src/pal/tests/palsuite/c_runtime/vsprintf/test7/test7.c +++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test7/test7.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test8/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test8/CMakeLists.txt index 34c92e1045..8dac76fc3a 100644 --- a/src/pal/tests/palsuite/c_runtime/vsprintf/test8/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test8/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test8.c + test8.cpp ) add_executable(paltest_vsprintf_test8 diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test8/test8.c b/src/pal/tests/palsuite/c_runtime/vsprintf/test8/test8.cpp index e741d1da8b..e741d1da8b 100644 --- a/src/pal/tests/palsuite/c_runtime/vsprintf/test8/test8.c +++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test8/test8.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test9/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test9/CMakeLists.txt index 1fe177de95..95f0faad87 100644 --- a/src/pal/tests/palsuite/c_runtime/vsprintf/test9/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test9/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test9.c + test9.cpp ) add_executable(paltest_vsprintf_test9 diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test9/test9.c b/src/pal/tests/palsuite/c_runtime/vsprintf/test9/test9.cpp index e1f7c84195..e1f7c84195 100644 --- a/src/pal/tests/palsuite/c_runtime/vsprintf/test9/test9.c +++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test9/test9.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/vsprintf.h b/src/pal/tests/palsuite/c_runtime/vsprintf/vsprintf.h index 10648d896f..7b04a777ca 100644 --- a/src/pal/tests/palsuite/c_runtime/vsprintf/vsprintf.h +++ b/src/pal/tests/palsuite/c_runtime/vsprintf/vsprintf.h @@ -26,7 +26,7 @@ int testvsp(char* buf, const char* format, ...) return (retVal); } -void DoStrTest(char *formatstr, char* param, char *checkstr) +void DoStrTest(const char *formatstr, char* param, const char *checkstr) { char buf[256] = { 0 }; @@ -39,7 +39,7 @@ void DoStrTest(char *formatstr, char* param, char *checkstr) } } -void DoWStrTest(char *formatstr, WCHAR* param, char *checkstr) +void DoWStrTest(const char *formatstr, WCHAR* param, const char *checkstr) { char buf[256] = { 0 }; @@ -53,7 +53,7 @@ void DoWStrTest(char *formatstr, WCHAR* param, char *checkstr) } -void DoCharTest(char *formatstr, char param, char *checkstr) +void DoCharTest(const char *formatstr, char param, const char *checkstr) { char buf[256] = { 0 }; @@ -66,7 +66,7 @@ void DoCharTest(char *formatstr, char param, char *checkstr) } } -void DoWCharTest(char *formatstr, WCHAR param, char *checkstr) +void DoWCharTest(const char *formatstr, WCHAR param, const char *checkstr) { char buf[256] = { 0 }; @@ -79,7 +79,7 @@ void DoWCharTest(char *formatstr, WCHAR param, char *checkstr) } } -void DoNumTest(char *formatstr, int value, char *checkstr) +void DoNumTest(const char *formatstr, int value, const char *checkstr) { char buf[256] = { 0 }; @@ -92,7 +92,7 @@ void DoNumTest(char *formatstr, int value, char *checkstr) } } -void DoI64Test(char *formatstr, INT64 value, char *valuestr, char *checkstr) +void DoI64Test(const char *formatstr, INT64 value, char *valuestr, const char *checkstr) { char buf[256] = { 0 }; @@ -104,7 +104,7 @@ void DoI64Test(char *formatstr, INT64 value, char *valuestr, char *checkstr) valuestr, formatstr, checkstr, buf); } } -void DoDoubleTest(char *formatstr, double value, char *checkstr1, char +void DoDoubleTest(const char *formatstr, double value, const char *checkstr1, char *checkstr2) { char buf[256] = { 0 }; @@ -119,8 +119,8 @@ void DoDoubleTest(char *formatstr, double value, char *checkstr1, char } } /*FROM TEST 9*/ -void DoArgumentPrecTest(char *formatstr, int precision, void *param, - char *paramstr, char *checkstr1, char *checkstr2) +void DoArgumentPrecTest(const char *formatstr, int precision, void *param, + char *paramstr, const char *checkstr1, const char *checkstr2) { char buf[256]; @@ -135,8 +135,8 @@ void DoArgumentPrecTest(char *formatstr, int precision, void *param, } -void DoArgumentPrecDoubleTest(char *formatstr, int precision, double param, - char *checkstr1, char *checkstr2) +void DoArgumentPrecDoubleTest(const char *formatstr, int precision, double param, + const char *checkstr1, const char *checkstr2) { char buf[256]; @@ -150,8 +150,8 @@ void DoArgumentPrecDoubleTest(char *formatstr, int precision, double param, } } /*FROM TEST4*/ -void DoPointerTest(char *formatstr, void* param, char* paramstr, - char *checkstr1) +void DoPointerTest(const char *formatstr, void* param, char* paramstr, + const char *checkstr1) { char buf[256] = { 0 }; @@ -164,8 +164,8 @@ void DoPointerTest(char *formatstr, void* param, char* paramstr, } } -void DoI64DoubleTest(char *formatstr, INT64 value, char *valuestr, - char *checkstr1) +void DoI64DoubleTest(const char *formatstr, INT64 value, char *valuestr, + const char *checkstr1) { char buf[256] = { 0 }; @@ -178,7 +178,7 @@ void DoI64DoubleTest(char *formatstr, INT64 value, char *valuestr, } } -void DoTest(char *formatstr, int param, char *checkstr) +void DoTest(const char *formatstr, int param, const char *checkstr) { char buf[256] = { 0 }; int n = -1; @@ -196,7 +196,7 @@ void DoTest(char *formatstr, int param, char *checkstr) } } -void DoShortTest(char *formatstr, int param, char *checkstr) +void DoShortTest(const char *formatstr, int param, const char *checkstr) { char buf[256] = { 0 }; short int n = -1; diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test1/CMakeLists.txt index 97fbeb4e28..1d6233744a 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_vswprintf_test1 diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test1/test1.cpp index d386ce104f..d386ce104f 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test10/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test10/CMakeLists.txt index 06c11f68ca..e5301427eb 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test10/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test10/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test10.c + test10.cpp ) add_executable(paltest_vswprintf_test10 diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test10/test10.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test10/test10.cpp index 7f316e28f6..7f316e28f6 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test10/test10.c +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test10/test10.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test11/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test11/CMakeLists.txt index 5237ba4e1d..1cfadb9300 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test11/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test11/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test11.c + test11.cpp ) add_executable(paltest_vswprintf_test11 diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test11/test11.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test11/test11.cpp index 608069f829..608069f829 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test11/test11.c +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test11/test11.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test12/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test12/CMakeLists.txt index 26199c3dcc..f5a582a970 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test12/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test12/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test12.c + test12.cpp ) add_executable(paltest_vswprintf_test12 diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test12/test12.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test12/test12.cpp index 36b203853a..36b203853a 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test12/test12.c +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test12/test12.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test13/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test13/CMakeLists.txt index d0acd98d64..5571d7336f 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test13/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test13/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test13.c + test13.cpp ) add_executable(paltest_vswprintf_test13 diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test13/test13.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test13/test13.cpp index 63dc36a960..63dc36a960 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test13/test13.c +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test13/test13.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test14/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test14/CMakeLists.txt index 06c12674a4..234029ead4 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test14/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test14/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test14.c + test14.cpp ) add_executable(paltest_vswprintf_test14 diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test14/test14.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test14/test14.cpp index bb4ab16a54..bb4ab16a54 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test14/test14.c +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test14/test14.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test15/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test15/CMakeLists.txt index 05dc41b0d8..b705268bc7 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test15/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test15/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test15.c + test15.cpp ) add_executable(paltest_vswprintf_test15 diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test15/test15.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test15/test15.cpp index 6296220c4e..6296220c4e 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test15/test15.c +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test15/test15.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test16/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test16/CMakeLists.txt index 3c42755043..da296bcf32 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test16/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test16/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test16.c + test16.cpp ) add_executable(paltest_vswprintf_test16 diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test16/test16.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test16/test16.cpp index 3a2059a491..3a2059a491 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test16/test16.c +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test16/test16.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test17/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test17/CMakeLists.txt index b94c466d5f..02234c1672 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test17/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test17/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test17.c + test17.cpp ) add_executable(paltest_vswprintf_test17 diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test17/test17.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test17/test17.cpp index 95e3bd9995..95e3bd9995 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test17/test17.c +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test17/test17.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test18/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test18/CMakeLists.txt index 57cc8ccb03..0c0e5b566b 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test18/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test18/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test18.c + test18.cpp ) add_executable(paltest_vswprintf_test18 diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test18/test18.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test18/test18.cpp index ae7ae4c44b..ae7ae4c44b 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test18/test18.c +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test18/test18.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test19/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test19/CMakeLists.txt index 2187b58727..066db8ab84 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test19/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test19/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test19.c + test19.cpp ) add_executable(paltest_vswprintf_test19 diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test19/test19.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test19/test19.c deleted file mode 100644 index c00185be6d..0000000000 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test19/test19.c +++ /dev/null @@ -1,137 +0,0 @@ -// 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: test18.c -** -** Purpose: Test #18 for the vswprintf function. -** -** -**===================================================================*/ - -#include <palsuite.h> -#include "../vswprintf.h" - -/* memcmp is used to verify the results, so this test is dependent on it. */ -/* ditto with wcslen */ - -#define DOTEST(a,b,c,d,e) DoTest(a,b,(void*)c,d,e) - -void DoArgumentPrecTest(WCHAR *formatstr, int precision, void *param, - WCHAR *paramstr, WCHAR *checkstr1, WCHAR *checkstr2) -{ - WCHAR buf[256]; - - testvswp(buf, formatstr, precision, param); - if (memcmp(buf, checkstr1, wcslen(checkstr1) + 2) != 0 && - memcmp(buf, checkstr2, wcslen(checkstr2) + 2) != 0) - { - Fail("ERROR: failed to insert %s into \"%s\" with precision %d\n" - "Expected \"%s\" or \"%s\", got \"%s\".\n", - paramstr, - convertC(formatstr), - precision, - convertC(checkstr1), - convertC(checkstr2), - convertC(buf)); - } -} -void DoArgumentPrecDoubleTest(WCHAR *formatstr, int precision, double param, - WCHAR *checkstr1, WCHAR *checkstr2) -{ - WCHAR buf[256]; - - testvswp(buf, formatstr, precision, param); - if (memcmp(buf, checkstr1, wcslen(checkstr1) + 2) != 0 && - memcmp(buf, checkstr2, wcslen(checkstr2) + 2) != 0) - { - Fail("ERROR: failed to insert %f into \"%s\" with precision %d\n" - "Expected \"%s\" or \"%s\", got \"%s\".\n", - param, convertC(formatstr), - precision, - convertC(checkstr1), - convertC(checkstr2), - convertC(buf)); - } -} - -/* - * Uses memcmp & wcslen - */ - -int __cdecl main(int argc, char *argv[]) -{ - - if (PAL_Initialize(argc, argv) != 0) - return(FAIL); - - DoArgumentPrecTest(convert("%.*s"), 2, convert("bar"), convert("bar"), - convert("ba"), convert("ba")); - DoArgumentPrecTest(convert("%.*c"), 0, (void*)'a', convert("a"), - convert("a"), convert("a")); - DoArgumentPrecTest(convert("%.*c"), 4, (void*)'a', convert("a"), - convert("a"), convert("a")); - DoArgumentPrecTest(convert("%.*C"), 0, (void*)'a', convert("a"), - convert("a"), convert("a")); - DoArgumentPrecTest(convert("%.*C"), 4, (void*)'a', convert("a"), - convert("a"), convert("a")); - DoArgumentPrecTest(convert("%.*d"), 1, (void*)42, convert("42"), - convert("42"), convert("42")); - DoArgumentPrecTest(convert("%.*d"), 3, (void*)42, convert("42"), - convert("042"), convert("042")); - DoArgumentPrecTest(convert("%.*i"), 1, (void*)42, convert("42"), - convert("42"), convert("42")); - DoArgumentPrecTest(convert("%.*i"), 3, (void*)42, convert("42"), - convert("042"), convert("042")); - DoArgumentPrecTest(convert("%.*o"), 1, (void*)42, convert("42"), - convert("52"), convert("52")); - DoArgumentPrecTest(convert("%.*o"), 3, (void*)42, convert("42"), - convert("052"), convert("052")); - DoArgumentPrecTest(convert("%.*u"), 1, (void*)42, convert("42"), - convert("42"), convert("42")); - DoArgumentPrecTest(convert("%.*u"), 3, (void*)42, convert("42"), - convert("042"), convert("042")); - DoArgumentPrecTest(convert("%.*x"), 1, (void*)0x42, convert("0x42"), - convert("42"), convert("42")); - DoArgumentPrecTest(convert("%.*x"), 3, (void*)0x42, convert("0x42"), - convert("042"), convert("042")); - DoArgumentPrecTest(convert("%.*X"), 1, (void*)0x42, convert("0x42"), - convert("42"), convert("42")); - DoArgumentPrecTest(convert("%.*X"), 3, (void*)0x42, convert("0x42"), - convert("042"), convert("042")); - - - DoArgumentPrecDoubleTest(convert("%.*e"), 1, 2.01, convert("2.0e+000"), - convert("2.0e+00")); - DoArgumentPrecDoubleTest(convert("%.*e"), 3, 2.01, convert("2.010e+000"), - convert("2.010e+00")); - DoArgumentPrecDoubleTest(convert("%.*E"), 1, 2.01, convert("2.0E+000"), - convert("2.0E+00")); - DoArgumentPrecDoubleTest(convert("%.*E"), 3, 2.01, convert("2.010E+000"), - convert("2.010E+00")); - DoArgumentPrecDoubleTest(convert("%.*f"), 1, 2.01, convert("2.0"), - convert("2.0")); - DoArgumentPrecDoubleTest(convert("%.*f"), 3, 2.01, convert("2.010"), - convert("2.010")); - DoArgumentPrecDoubleTest(convert("%.*g"), 1, 256.01, convert("3e+002"), - convert("3e+02")); - DoArgumentPrecDoubleTest(convert("%.*g"), 3, 256.01, convert("256"), - convert("256")); - DoArgumentPrecDoubleTest(convert("%.*g"), 4, 256.01, convert("256"), - convert("256")); - DoArgumentPrecDoubleTest(convert("%.*g"), 6, 256.01, convert("256.01"), - convert("256.01")); - DoArgumentPrecDoubleTest(convert("%.*G"), 1, 256.01, convert("3E+002"), - convert("3E+02")); - DoArgumentPrecDoubleTest(convert("%.*G"), 3, 256.01, convert("256"), - convert("256")); - DoArgumentPrecDoubleTest(convert("%.*G"), 4, 256.01, convert("256"), - convert("256")); - DoArgumentPrecDoubleTest(convert("%.*G"), 6, 256.01, convert("256.01"), - convert("256.01")); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test19/test19.cpp b/src/pal/tests/palsuite/c_runtime/vswprintf/test19/test19.cpp new file mode 100644 index 0000000000..1d1c5656b2 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test19/test19.cpp @@ -0,0 +1,137 @@ +// 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: test18.c +** +** Purpose: Test #18 for the vswprintf function. +** +** +**===================================================================*/ + +#include <palsuite.h> +#include "../vswprintf.h" + +/* memcmp is used to verify the results, so this test is dependent on it. */ +/* ditto with wcslen */ + +#define DOTEST(a,b,c,d,e) DoTest(a,b,(void*)c,d,e) + +void DoArgumentPrecTest(WCHAR *formatstr, int precision, void *param, + WCHAR *paramstr, WCHAR *checkstr1, WCHAR *checkstr2) +{ + WCHAR buf[256]; + + testvswp(buf, formatstr, precision, param); + if (memcmp(buf, checkstr1, wcslen(checkstr1) + 2) != 0 && + memcmp(buf, checkstr2, wcslen(checkstr2) + 2) != 0) + { + Fail("ERROR: failed to insert %s into \"%s\" with precision %d\n" + "Expected \"%s\" or \"%s\", got \"%s\".\n", + paramstr, + convertC(formatstr), + precision, + convertC(checkstr1), + convertC(checkstr2), + convertC(buf)); + } +} +void DoArgumentPrecDoubleTest(WCHAR *formatstr, int precision, double param, + WCHAR *checkstr1, WCHAR *checkstr2) +{ + WCHAR buf[256]; + + testvswp(buf, formatstr, precision, param); + if (memcmp(buf, checkstr1, wcslen(checkstr1) + 2) != 0 && + memcmp(buf, checkstr2, wcslen(checkstr2) + 2) != 0) + { + Fail("ERROR: failed to insert %f into \"%s\" with precision %d\n" + "Expected \"%s\" or \"%s\", got \"%s\".\n", + param, convertC(formatstr), + precision, + convertC(checkstr1), + convertC(checkstr2), + convertC(buf)); + } +} + +/* + * Uses memcmp & wcslen + */ + +int __cdecl main(int argc, char *argv[]) +{ + + if (PAL_Initialize(argc, argv) != 0) + return(FAIL); + + DoArgumentPrecTest(convert("%.*s"), 2, (void*)convert("bar"), convert("bar"), + convert("ba"), convert("ba")); + DoArgumentPrecTest(convert("%.*c"), 0, (void*)'a', convert("a"), + convert("a"), convert("a")); + DoArgumentPrecTest(convert("%.*c"), 4, (void*)'a', convert("a"), + convert("a"), convert("a")); + DoArgumentPrecTest(convert("%.*C"), 0, (void*)'a', convert("a"), + convert("a"), convert("a")); + DoArgumentPrecTest(convert("%.*C"), 4, (void*)'a', convert("a"), + convert("a"), convert("a")); + DoArgumentPrecTest(convert("%.*d"), 1, (void*)42, convert("42"), + convert("42"), convert("42")); + DoArgumentPrecTest(convert("%.*d"), 3, (void*)42, convert("42"), + convert("042"), convert("042")); + DoArgumentPrecTest(convert("%.*i"), 1, (void*)42, convert("42"), + convert("42"), convert("42")); + DoArgumentPrecTest(convert("%.*i"), 3, (void*)42, convert("42"), + convert("042"), convert("042")); + DoArgumentPrecTest(convert("%.*o"), 1, (void*)42, convert("42"), + convert("52"), convert("52")); + DoArgumentPrecTest(convert("%.*o"), 3, (void*)42, convert("42"), + convert("052"), convert("052")); + DoArgumentPrecTest(convert("%.*u"), 1, (void*)42, convert("42"), + convert("42"), convert("42")); + DoArgumentPrecTest(convert("%.*u"), 3, (void*)42, convert("42"), + convert("042"), convert("042")); + DoArgumentPrecTest(convert("%.*x"), 1, (void*)0x42, convert("0x42"), + convert("42"), convert("42")); + DoArgumentPrecTest(convert("%.*x"), 3, (void*)0x42, convert("0x42"), + convert("042"), convert("042")); + DoArgumentPrecTest(convert("%.*X"), 1, (void*)0x42, convert("0x42"), + convert("42"), convert("42")); + DoArgumentPrecTest(convert("%.*X"), 3, (void*)0x42, convert("0x42"), + convert("042"), convert("042")); + + + DoArgumentPrecDoubleTest(convert("%.*e"), 1, 2.01, convert("2.0e+000"), + convert("2.0e+00")); + DoArgumentPrecDoubleTest(convert("%.*e"), 3, 2.01, convert("2.010e+000"), + convert("2.010e+00")); + DoArgumentPrecDoubleTest(convert("%.*E"), 1, 2.01, convert("2.0E+000"), + convert("2.0E+00")); + DoArgumentPrecDoubleTest(convert("%.*E"), 3, 2.01, convert("2.010E+000"), + convert("2.010E+00")); + DoArgumentPrecDoubleTest(convert("%.*f"), 1, 2.01, convert("2.0"), + convert("2.0")); + DoArgumentPrecDoubleTest(convert("%.*f"), 3, 2.01, convert("2.010"), + convert("2.010")); + DoArgumentPrecDoubleTest(convert("%.*g"), 1, 256.01, convert("3e+002"), + convert("3e+02")); + DoArgumentPrecDoubleTest(convert("%.*g"), 3, 256.01, convert("256"), + convert("256")); + DoArgumentPrecDoubleTest(convert("%.*g"), 4, 256.01, convert("256"), + convert("256")); + DoArgumentPrecDoubleTest(convert("%.*g"), 6, 256.01, convert("256.01"), + convert("256.01")); + DoArgumentPrecDoubleTest(convert("%.*G"), 1, 256.01, convert("3E+002"), + convert("3E+02")); + DoArgumentPrecDoubleTest(convert("%.*G"), 3, 256.01, convert("256"), + convert("256")); + DoArgumentPrecDoubleTest(convert("%.*G"), 4, 256.01, convert("256"), + convert("256")); + DoArgumentPrecDoubleTest(convert("%.*G"), 6, 256.01, convert("256.01"), + convert("256.01")); + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test2/CMakeLists.txt index 295448cb0c..abfceca9e2 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test2/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test2/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test2.c + test2.cpp ) add_executable(paltest_vswprintf_test2 diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test2/test2.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test2/test2.cpp index 491d99f0cf..491d99f0cf 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test2/test2.c +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test2/test2.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test3/CMakeLists.txt index 1fb6272ae7..7f4798dbc5 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test3/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test3/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test3.c + test3.cpp ) add_executable(paltest_vswprintf_test3 diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test3/test3.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test3/test3.cpp index 1eb0b65ebe..1eb0b65ebe 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test3/test3.c +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test3/test3.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test4/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test4/CMakeLists.txt index cae0806e03..05701ac179 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test4/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test4/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test4.c + test4.cpp ) add_executable(paltest_vswprintf_test4 diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test4/test4.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test4/test4.cpp index 5c9047b5a7..5c9047b5a7 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test4/test4.c +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test4/test4.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test5/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test5/CMakeLists.txt index 7c480455ed..888ce27d22 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test5/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test5/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test5.c + test5.cpp ) add_executable(paltest_vswprintf_test5 diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test5/test5.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test5/test5.cpp index 42146c8be7..42146c8be7 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test5/test5.c +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test5/test5.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test6/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test6/CMakeLists.txt index d7de580853..bfbb17ccef 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test6/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test6/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test6.c + test6.cpp ) add_executable(paltest_vswprintf_test6 diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test6/test6.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test6/test6.cpp index 51e99267a1..51e99267a1 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test6/test6.c +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test6/test6.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test7/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test7/CMakeLists.txt index eb07ee2cae..8b980586bc 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test7/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test7/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test7.c + test7.cpp ) add_executable(paltest_vswprintf_test7 diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test7/test7.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test7/test7.cpp index 6037cb0fe7..6037cb0fe7 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test7/test7.c +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test7/test7.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test8/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test8/CMakeLists.txt index ed35ea8dd0..07ba473844 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test8/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test8/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test8.c + test8.cpp ) add_executable(paltest_vswprintf_test8 diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test8/test8.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test8/test8.cpp index baba524650..baba524650 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test8/test8.c +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test8/test8.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test9/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test9/CMakeLists.txt index 7098da31d0..11c77787e9 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test9/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test9/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test9.c + test9.cpp ) add_executable(paltest_vswprintf_test9 diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test9/test9.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test9/test9.cpp index 5de004f5ed..5de004f5ed 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test9/test9.c +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test9/test9.cpp diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/vswprintf.h b/src/pal/tests/palsuite/c_runtime/vswprintf/vswprintf.h index a79c9bb7a9..37a379212e 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/vswprintf.h +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/vswprintf.h @@ -27,7 +27,7 @@ int testvswp(wchar_t* buf, const wchar_t* format, ...) return( retVal); } -void DoWStrTest(WCHAR *formatstr, WCHAR *param, WCHAR *checkstr) +void DoWStrTest(const WCHAR *formatstr, WCHAR *param, const WCHAR *checkstr) { WCHAR buf[256] = { 0 }; @@ -42,7 +42,7 @@ void DoWStrTest(WCHAR *formatstr, WCHAR *param, WCHAR *checkstr) } } -void DoStrTest(WCHAR *formatstr, char *param, WCHAR *checkstr) +void DoStrTest(const WCHAR *formatstr, char *param, const WCHAR *checkstr) { WCHAR buf[256] = { 0 }; @@ -57,7 +57,7 @@ void DoStrTest(WCHAR *formatstr, char *param, WCHAR *checkstr) } } -void DoCharTest(WCHAR *formatstr, char param, WCHAR *checkstr) +void DoCharTest(const WCHAR *formatstr, char param, const WCHAR *checkstr) { WCHAR buf[256] = { 0 }; @@ -71,7 +71,7 @@ void DoCharTest(WCHAR *formatstr, char param, WCHAR *checkstr) } } -void DoWCharTest(WCHAR *formatstr, WCHAR param, WCHAR *checkstr) +void DoWCharTest(const WCHAR *formatstr, WCHAR param, const WCHAR *checkstr) { WCHAR buf[256] = { 0 }; @@ -85,7 +85,7 @@ void DoWCharTest(WCHAR *formatstr, WCHAR param, WCHAR *checkstr) } } -void DoNumTest(WCHAR *formatstr, int value, WCHAR*checkstr) +void DoNumTest(const WCHAR *formatstr, int value, const WCHAR *checkstr) { WCHAR buf[256] = { 0 }; @@ -98,7 +98,7 @@ void DoNumTest(WCHAR *formatstr, int value, WCHAR*checkstr) } } -void DoI64NumTest(WCHAR *formatstr, INT64 value, char *valuestr, WCHAR*checkstr) +void DoI64NumTest(const WCHAR *formatstr, INT64 value, char *valuestr, const WCHAR *checkstr) { WCHAR buf[256] = { 0 }; @@ -110,7 +110,7 @@ void DoI64NumTest(WCHAR *formatstr, INT64 value, char *valuestr, WCHAR*checkstr) convertC(checkstr), convertC(buf)); } } -void DoDoubleTest(WCHAR *formatstr, double value, WCHAR *checkstr1, WCHAR +void DoDoubleTest(const WCHAR *formatstr, double value, const WCHAR *checkstr1, WCHAR *checkstr2) { WCHAR buf[256] = { 0 }; diff --git a/src/pal/tests/palsuite/c_runtime/wcscat/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcscat/test1/CMakeLists.txt index 34dfee01bd..815c585de4 100644 --- a/src/pal/tests/palsuite/c_runtime/wcscat/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/wcscat/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_wcscat_test1 diff --git a/src/pal/tests/palsuite/c_runtime/wcscat/test1/test1.c b/src/pal/tests/palsuite/c_runtime/wcscat/test1/test1.c deleted file mode 100644 index 789eebf5a3..0000000000 --- a/src/pal/tests/palsuite/c_runtime/wcscat/test1/test1.c +++ /dev/null @@ -1,71 +0,0 @@ -// 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: test1.c -** -** Purpose: -** Test to that wcscat correctly concatanates wide strings, including placing -** null pointers. -** -** -**==========================================================================*/ - - - -#include <palsuite.h> - -/* - * Notes: uses memcmp and the (pal) sprintf - */ - -int __cdecl main(int argc, char *argv[]) -{ - WCHAR dest[80]; - WCHAR test[] = {'f','o','o',' ','b','a','r',' ','b','a','z',0}; - WCHAR str1[] = {'f','o','o',' ',0}; - WCHAR str2[] = {'b','a','r',' ',0}; - WCHAR str3[] = {'b','a','z',0}; - WCHAR *ptr; - char buffer[256]; - - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - - dest[0] = 0; - - ptr = wcscat(dest, str1); - if (ptr != dest) - { - Fail("ERROR: Expected wcscat to return ptr to %p, got %p", dest, ptr); - } - - ptr = wcscat(dest, str2); - if (ptr != dest) - { - Fail("ERROR: Expected wcscat to return ptr to %p, got %p", dest, ptr); - } - - ptr = wcscat(dest, str3); - if (ptr != dest) - { - Fail("ERROR: Expected wcscat to return ptr to %p, got %p", dest, ptr); - } - - if (memcmp(dest, test, sizeof(test)) != 0) - { - sprintf(buffer, "%S", dest); - Fail("ERROR: Expected wcscat to give \"%s\", got \"%s\"\n", - "foo bar baz", buffer); - } - - PAL_Terminate(); - return PASS; -} - diff --git a/src/pal/tests/palsuite/c_runtime/wcscat/test1/test1.cpp b/src/pal/tests/palsuite/c_runtime/wcscat/test1/test1.cpp new file mode 100644 index 0000000000..e9a79d3880 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/wcscat/test1/test1.cpp @@ -0,0 +1,71 @@ +// 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: test1.c +** +** Purpose: +** Test to that wcscat correctly concatanates wide strings, including placing +** null pointers. +** +** +**==========================================================================*/ + + + +#include <palsuite.h> + +/* + * Notes: uses memcmp and the (pal) sprintf_s + */ + +int __cdecl main(int argc, char *argv[]) +{ + WCHAR dest[80]; + WCHAR test[] = {'f','o','o',' ','b','a','r',' ','b','a','z',0}; + WCHAR str1[] = {'f','o','o',' ',0}; + WCHAR str2[] = {'b','a','r',' ',0}; + WCHAR str3[] = {'b','a','z',0}; + WCHAR *ptr; + char buffer[256]; + + + if (PAL_Initialize(argc, argv)) + { + return FAIL; + } + + + dest[0] = 0; + + ptr = wcscat(dest, str1); + if (ptr != dest) + { + Fail("ERROR: Expected wcscat to return ptr to %p, got %p", dest, ptr); + } + + ptr = wcscat(dest, str2); + if (ptr != dest) + { + Fail("ERROR: Expected wcscat to return ptr to %p, got %p", dest, ptr); + } + + ptr = wcscat(dest, str3); + if (ptr != dest) + { + Fail("ERROR: Expected wcscat to return ptr to %p, got %p", dest, ptr); + } + + if (memcmp(dest, test, sizeof(test)) != 0) + { + sprintf_s(buffer, _countof(buffer), "%S", dest); + Fail("ERROR: Expected wcscat to give \"%s\", got \"%s\"\n", + "foo bar baz", buffer); + } + + PAL_Terminate(); + return PASS; +} + diff --git a/src/pal/tests/palsuite/c_runtime/wcschr/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcschr/test1/CMakeLists.txt index 542d70b7e6..9cf0a918a0 100644 --- a/src/pal/tests/palsuite/c_runtime/wcschr/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/wcschr/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_wcschr_test1 diff --git a/src/pal/tests/palsuite/c_runtime/wcschr/test1/test1.c b/src/pal/tests/palsuite/c_runtime/wcschr/test1/test1.cpp index a4963672f8..a4963672f8 100644 --- a/src/pal/tests/palsuite/c_runtime/wcschr/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/wcschr/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/wcscmp/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcscmp/test1/CMakeLists.txt index 009e48e1ba..98c05352f3 100644 --- a/src/pal/tests/palsuite/c_runtime/wcscmp/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/wcscmp/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_wcscmp_test1 diff --git a/src/pal/tests/palsuite/c_runtime/wcscmp/test1/test1.c b/src/pal/tests/palsuite/c_runtime/wcscmp/test1/test1.cpp index 1c38dd6d58..1c38dd6d58 100644 --- a/src/pal/tests/palsuite/c_runtime/wcscmp/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/wcscmp/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/wcscpy/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcscpy/test1/CMakeLists.txt index 5f21b829ee..872b2dec5e 100644 --- a/src/pal/tests/palsuite/c_runtime/wcscpy/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/wcscpy/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_wcscpy_test1 diff --git a/src/pal/tests/palsuite/c_runtime/wcscpy/test1/test1.c b/src/pal/tests/palsuite/c_runtime/wcscpy/test1/test1.c deleted file mode 100644 index 4e45c86516..0000000000 --- a/src/pal/tests/palsuite/c_runtime/wcscpy/test1/test1.c +++ /dev/null @@ -1,47 +0,0 @@ -// 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: test1.c -** -** Purpose: Tests that wcscpy correctly copies a null-terminated wide string. -** -** -**==========================================================================*/ - - -#include <palsuite.h> - -/* - * Notes: uses memcmp and sprintf. - */ - -int __cdecl main(int argc, char *argv[]) -{ - WCHAR str[] = {'f','o','o',0,'b','a','r',0}; - WCHAR dest[80]; - WCHAR result[] = {'f','o','o',0}; - WCHAR *ret; - char buffer[256]; - - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - - ret = wcscpy(dest, str); - - if (ret != dest || memcmp(dest, result, sizeof(result)) != 0) - { - sprintf(buffer, "%S", dest); - Fail("Expected wcscpy to give \"%s\" with a return value of %p, got \"%s\" " - "with a return value of %p.\n", "foo", dest, buffer, ret); - } - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/wcscpy/test1/test1.cpp b/src/pal/tests/palsuite/c_runtime/wcscpy/test1/test1.cpp new file mode 100644 index 0000000000..2ecafa8307 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/wcscpy/test1/test1.cpp @@ -0,0 +1,47 @@ +// 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: test1.c +** +** Purpose: Tests that wcscpy correctly copies a null-terminated wide string. +** +** +**==========================================================================*/ + + +#include <palsuite.h> + +/* + * Notes: uses memcmp and sprintf_s. + */ + +int __cdecl main(int argc, char *argv[]) +{ + WCHAR str[] = {'f','o','o',0,'b','a','r',0}; + WCHAR dest[80]; + WCHAR result[] = {'f','o','o',0}; + WCHAR *ret; + char buffer[256]; + + + if (PAL_Initialize(argc, argv)) + { + return FAIL; + } + + + ret = wcscpy(dest, str); + + if (ret != dest || memcmp(dest, result, sizeof(result)) != 0) + { + sprintf_s(buffer, _countof(buffer), "%S", dest); + Fail("Expected wcscpy to give \"%s\" with a return value of %p, got \"%s\" " + "with a return value of %p.\n", "foo", dest, buffer, ret); + } + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/c_runtime/wcslen/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcslen/test1/CMakeLists.txt index de0f1c22d3..b641a830f5 100644 --- a/src/pal/tests/palsuite/c_runtime/wcslen/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/wcslen/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_wcslen_test1 diff --git a/src/pal/tests/palsuite/c_runtime/wcslen/test1/test1.c b/src/pal/tests/palsuite/c_runtime/wcslen/test1/test1.cpp index 17d0327628..17d0327628 100644 --- a/src/pal/tests/palsuite/c_runtime/wcslen/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/wcslen/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/wcsncat/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcsncat/test1/CMakeLists.txt index 12c286a43a..e90e2b7bc4 100644 --- a/src/pal/tests/palsuite/c_runtime/wcsncat/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/wcsncat/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_wcsncat_test1 diff --git a/src/pal/tests/palsuite/c_runtime/wcsncat/test1/test1.c b/src/pal/tests/palsuite/c_runtime/wcsncat/test1/test1.cpp index 0cd5c3e15a..0cd5c3e15a 100644 --- a/src/pal/tests/palsuite/c_runtime/wcsncat/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/wcsncat/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/wcsncmp/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcsncmp/test1/CMakeLists.txt index 56c9b25806..f5511a86c6 100644 --- a/src/pal/tests/palsuite/c_runtime/wcsncmp/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/wcsncmp/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_wcsncmp_test1 diff --git a/src/pal/tests/palsuite/c_runtime/wcsncmp/test1/test1.c b/src/pal/tests/palsuite/c_runtime/wcsncmp/test1/test1.cpp index 4e4488f5a1..4e4488f5a1 100644 --- a/src/pal/tests/palsuite/c_runtime/wcsncmp/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/wcsncmp/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/wcsncpy/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcsncpy/test1/CMakeLists.txt index 1c1d70ba04..a7254a709c 100644 --- a/src/pal/tests/palsuite/c_runtime/wcsncpy/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/wcsncpy/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_wcsncpy_test1 diff --git a/src/pal/tests/palsuite/c_runtime/wcsncpy/test1/test1.c b/src/pal/tests/palsuite/c_runtime/wcsncpy/test1/test1.cpp index 50d97b0e9c..50d97b0e9c 100644 --- a/src/pal/tests/palsuite/c_runtime/wcsncpy/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/wcsncpy/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/wcspbrk/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcspbrk/test1/CMakeLists.txt index c6a3f87d75..14c1fe83a4 100644 --- a/src/pal/tests/palsuite/c_runtime/wcspbrk/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/wcspbrk/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_wcspbrk_test1 diff --git a/src/pal/tests/palsuite/c_runtime/wcspbrk/test1/test1.c b/src/pal/tests/palsuite/c_runtime/wcspbrk/test1/test1.cpp index b0432f7819..b0432f7819 100644 --- a/src/pal/tests/palsuite/c_runtime/wcspbrk/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/wcspbrk/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/wcsrchr/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcsrchr/test1/CMakeLists.txt index 80513af1af..abdd6d56d2 100644 --- a/src/pal/tests/palsuite/c_runtime/wcsrchr/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/wcsrchr/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_wcsrchr_test1 diff --git a/src/pal/tests/palsuite/c_runtime/wcsrchr/test1/test1.c b/src/pal/tests/palsuite/c_runtime/wcsrchr/test1/test1.cpp index ae8765776e..ae8765776e 100644 --- a/src/pal/tests/palsuite/c_runtime/wcsrchr/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/wcsrchr/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/wcsstr/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcsstr/test1/CMakeLists.txt index e42619344d..0e1e0b47b0 100644 --- a/src/pal/tests/palsuite/c_runtime/wcsstr/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/wcsstr/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_wcsstr_test1 diff --git a/src/pal/tests/palsuite/c_runtime/wcsstr/test1/test1.c b/src/pal/tests/palsuite/c_runtime/wcsstr/test1/test1.cpp index 8296a74983..8296a74983 100644 --- a/src/pal/tests/palsuite/c_runtime/wcsstr/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/wcsstr/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/wcstod/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcstod/test1/CMakeLists.txt index cf585d051a..cca01ca964 100644 --- a/src/pal/tests/palsuite/c_runtime/wcstod/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/wcstod/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_wcstod_test1 diff --git a/src/pal/tests/palsuite/c_runtime/wcstod/test1/test1.c b/src/pal/tests/palsuite/c_runtime/wcstod/test1/test1.cpp index e41e92e961..e41e92e961 100644 --- a/src/pal/tests/palsuite/c_runtime/wcstod/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/wcstod/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/wcstod/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcstod/test2/CMakeLists.txt index 43d5bf8a40..ae7450891e 100644 --- a/src/pal/tests/palsuite/c_runtime/wcstod/test2/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/wcstod/test2/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test2.c + test2.cpp ) add_executable(paltest_wcstod_test2 diff --git a/src/pal/tests/palsuite/c_runtime/wcstod/test2/test2.c b/src/pal/tests/palsuite/c_runtime/wcstod/test2/test2.cpp index 8f9b5cbf58..8f9b5cbf58 100644 --- a/src/pal/tests/palsuite/c_runtime/wcstod/test2/test2.c +++ b/src/pal/tests/palsuite/c_runtime/wcstod/test2/test2.cpp diff --git a/src/pal/tests/palsuite/c_runtime/wcstok/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcstok/test1/CMakeLists.txt index 863f5d8c29..6b5bed9552 100644 --- a/src/pal/tests/palsuite/c_runtime/wcstok/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/wcstok/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_wcstok_test1 diff --git a/src/pal/tests/palsuite/c_runtime/wcstok/test1/test1.c b/src/pal/tests/palsuite/c_runtime/wcstok/test1/test1.cpp index 76d7dc02b3..76d7dc02b3 100644 --- a/src/pal/tests/palsuite/c_runtime/wcstok/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/wcstok/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/wcstol/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcstol/test1/CMakeLists.txt index 25e96e7de0..f76018fca3 100644 --- a/src/pal/tests/palsuite/c_runtime/wcstol/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/wcstol/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_wcstol_test1 diff --git a/src/pal/tests/palsuite/c_runtime/wcstol/test1/test1.c b/src/pal/tests/palsuite/c_runtime/wcstol/test1/test1.cpp index d84ba66adc..d84ba66adc 100644 --- a/src/pal/tests/palsuite/c_runtime/wcstol/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/wcstol/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/wcstol/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcstol/test2/CMakeLists.txt index ea33ec8c7e..8dc2ab6b65 100644 --- a/src/pal/tests/palsuite/c_runtime/wcstol/test2/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/wcstol/test2/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test2.c + test2.cpp ) add_executable(paltest_wcstol_test2 diff --git a/src/pal/tests/palsuite/c_runtime/wcstol/test2/test2.c b/src/pal/tests/palsuite/c_runtime/wcstol/test2/test2.cpp index 58309be6b4..58309be6b4 100644 --- a/src/pal/tests/palsuite/c_runtime/wcstol/test2/test2.c +++ b/src/pal/tests/palsuite/c_runtime/wcstol/test2/test2.cpp diff --git a/src/pal/tests/palsuite/c_runtime/wcstol/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcstol/test3/CMakeLists.txt index 509feca08c..310f97d6dc 100644 --- a/src/pal/tests/palsuite/c_runtime/wcstol/test3/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/wcstol/test3/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test3.c + test3.cpp ) add_executable(paltest_wcstol_test3 diff --git a/src/pal/tests/palsuite/c_runtime/wcstol/test3/test3.c b/src/pal/tests/palsuite/c_runtime/wcstol/test3/test3.cpp index 8b5ce6943d..8b5ce6943d 100644 --- a/src/pal/tests/palsuite/c_runtime/wcstol/test3/test3.c +++ b/src/pal/tests/palsuite/c_runtime/wcstol/test3/test3.cpp diff --git a/src/pal/tests/palsuite/c_runtime/wcstol/test4/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcstol/test4/CMakeLists.txt index 043c562102..23928aa704 100644 --- a/src/pal/tests/palsuite/c_runtime/wcstol/test4/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/wcstol/test4/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test4.c + test4.cpp ) add_executable(paltest_wcstol_test4 diff --git a/src/pal/tests/palsuite/c_runtime/wcstol/test4/test4.c b/src/pal/tests/palsuite/c_runtime/wcstol/test4/test4.cpp index a5e65946e9..a5e65946e9 100644 --- a/src/pal/tests/palsuite/c_runtime/wcstol/test4/test4.c +++ b/src/pal/tests/palsuite/c_runtime/wcstol/test4/test4.cpp diff --git a/src/pal/tests/palsuite/c_runtime/wcstol/test5/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcstol/test5/CMakeLists.txt index c887369880..16c709ffa0 100644 --- a/src/pal/tests/palsuite/c_runtime/wcstol/test5/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/wcstol/test5/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test5.c + test5.cpp ) add_executable(paltest_wcstol_test5 diff --git a/src/pal/tests/palsuite/c_runtime/wcstol/test5/test5.c b/src/pal/tests/palsuite/c_runtime/wcstol/test5/test5.cpp index 62f0a895a6..62f0a895a6 100644 --- a/src/pal/tests/palsuite/c_runtime/wcstol/test5/test5.c +++ b/src/pal/tests/palsuite/c_runtime/wcstol/test5/test5.cpp diff --git a/src/pal/tests/palsuite/c_runtime/wcstol/test6/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcstol/test6/CMakeLists.txt index d328161f39..80ccaf609b 100644 --- a/src/pal/tests/palsuite/c_runtime/wcstol/test6/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/wcstol/test6/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test6.c + test6.cpp ) add_executable(paltest_wcstol_test6 diff --git a/src/pal/tests/palsuite/c_runtime/wcstol/test6/test6.c b/src/pal/tests/palsuite/c_runtime/wcstol/test6/test6.cpp index 14f6208231..14f6208231 100644 --- a/src/pal/tests/palsuite/c_runtime/wcstol/test6/test6.c +++ b/src/pal/tests/palsuite/c_runtime/wcstol/test6/test6.cpp diff --git a/src/pal/tests/palsuite/c_runtime/wcstoul/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcstoul/test1/CMakeLists.txt index b24523e93b..58f002ab32 100644 --- a/src/pal/tests/palsuite/c_runtime/wcstoul/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/wcstoul/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_wcstoul_test1 diff --git a/src/pal/tests/palsuite/c_runtime/wcstoul/test1/test1.c b/src/pal/tests/palsuite/c_runtime/wcstoul/test1/test1.cpp index 5274905e30..5274905e30 100644 --- a/src/pal/tests/palsuite/c_runtime/wcstoul/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/wcstoul/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/wcstoul/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcstoul/test2/CMakeLists.txt index e262078e34..2c8d012310 100644 --- a/src/pal/tests/palsuite/c_runtime/wcstoul/test2/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/wcstoul/test2/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test2.c + test2.cpp ) add_executable(paltest_wcstoul_test2 diff --git a/src/pal/tests/palsuite/c_runtime/wcstoul/test2/test2.c b/src/pal/tests/palsuite/c_runtime/wcstoul/test2/test2.cpp index 2ab2dbf5d1..2ab2dbf5d1 100644 --- a/src/pal/tests/palsuite/c_runtime/wcstoul/test2/test2.c +++ b/src/pal/tests/palsuite/c_runtime/wcstoul/test2/test2.cpp diff --git a/src/pal/tests/palsuite/c_runtime/wcstoul/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcstoul/test3/CMakeLists.txt index aae268ac59..353df07f52 100644 --- a/src/pal/tests/palsuite/c_runtime/wcstoul/test3/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/wcstoul/test3/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test3.c + test3.cpp ) add_executable(paltest_wcstoul_test3 diff --git a/src/pal/tests/palsuite/c_runtime/wcstoul/test3/test3.c b/src/pal/tests/palsuite/c_runtime/wcstoul/test3/test3.cpp index eac46615e2..eac46615e2 100644 --- a/src/pal/tests/palsuite/c_runtime/wcstoul/test3/test3.c +++ b/src/pal/tests/palsuite/c_runtime/wcstoul/test3/test3.cpp diff --git a/src/pal/tests/palsuite/c_runtime/wcstoul/test4/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcstoul/test4/CMakeLists.txt index bd8073023f..e1e7d55420 100644 --- a/src/pal/tests/palsuite/c_runtime/wcstoul/test4/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/wcstoul/test4/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test4.c + test4.cpp ) add_executable(paltest_wcstoul_test4 diff --git a/src/pal/tests/palsuite/c_runtime/wcstoul/test4/test4.c b/src/pal/tests/palsuite/c_runtime/wcstoul/test4/test4.cpp index 0261da4275..0261da4275 100644 --- a/src/pal/tests/palsuite/c_runtime/wcstoul/test4/test4.c +++ b/src/pal/tests/palsuite/c_runtime/wcstoul/test4/test4.cpp diff --git a/src/pal/tests/palsuite/c_runtime/wcstoul/test5/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcstoul/test5/CMakeLists.txt index 1451e6ad57..9e83c6074c 100644 --- a/src/pal/tests/palsuite/c_runtime/wcstoul/test5/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/wcstoul/test5/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test5.c + test5.cpp ) add_executable(paltest_wcstoul_test5 diff --git a/src/pal/tests/palsuite/c_runtime/wcstoul/test5/test5.c b/src/pal/tests/palsuite/c_runtime/wcstoul/test5/test5.cpp index 00287cf7f4..00287cf7f4 100644 --- a/src/pal/tests/palsuite/c_runtime/wcstoul/test5/test5.c +++ b/src/pal/tests/palsuite/c_runtime/wcstoul/test5/test5.cpp diff --git a/src/pal/tests/palsuite/c_runtime/wcstoul/test6/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcstoul/test6/CMakeLists.txt index 15518bdcf8..8352d0cbbe 100644 --- a/src/pal/tests/palsuite/c_runtime/wcstoul/test6/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/wcstoul/test6/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test6.c + test6.cpp ) add_executable(paltest_wcstoul_test6 diff --git a/src/pal/tests/palsuite/c_runtime/wcstoul/test6/test6.c b/src/pal/tests/palsuite/c_runtime/wcstoul/test6/test6.cpp index 28397ec73f..28397ec73f 100644 --- a/src/pal/tests/palsuite/c_runtime/wcstoul/test6/test6.c +++ b/src/pal/tests/palsuite/c_runtime/wcstoul/test6/test6.cpp diff --git a/src/pal/tests/palsuite/c_runtime/wprintf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wprintf/test1/CMakeLists.txt index 701bbe4160..f95fc12ea1 100644 --- a/src/pal/tests/palsuite/c_runtime/wprintf/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/wprintf/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_wprintf_test1 diff --git a/src/pal/tests/palsuite/c_runtime/wprintf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/wprintf/test1/test1.cpp index d99dc8cf93..d99dc8cf93 100644 --- a/src/pal/tests/palsuite/c_runtime/wprintf/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/wprintf/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/wprintf/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wprintf/test2/CMakeLists.txt index 55c3d11913..325e8046d5 100644 --- a/src/pal/tests/palsuite/c_runtime/wprintf/test2/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/wprintf/test2/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test2.c + test2.cpp ) add_executable(paltest_wprintf_test2 diff --git a/src/pal/tests/palsuite/c_runtime/wprintf/test2/test2.c b/src/pal/tests/palsuite/c_runtime/wprintf/test2/test2.cpp index 254e98a394..254e98a394 100644 --- a/src/pal/tests/palsuite/c_runtime/wprintf/test2/test2.c +++ b/src/pal/tests/palsuite/c_runtime/wprintf/test2/test2.cpp diff --git a/src/pal/tests/palsuite/c_runtime/wprintf/wprintf.h b/src/pal/tests/palsuite/c_runtime/wprintf/wprintf.h index 7d3caf1b02..3a96248c35 100644 --- a/src/pal/tests/palsuite/c_runtime/wprintf/wprintf.h +++ b/src/pal/tests/palsuite/c_runtime/wprintf/wprintf.h @@ -14,7 +14,7 @@ #ifndef __wprintf_H__ #define __wprintf_H__ -void DoStrTest(WCHAR *formatstr, WCHAR* param, WCHAR *checkstr) +void DoStrTest(const WCHAR *formatstr, const WCHAR *param, const WCHAR *checkstr) { int ret; @@ -27,8 +27,8 @@ void DoStrTest(WCHAR *formatstr, WCHAR* param, WCHAR *checkstr) } -void DoPointerTest(WCHAR *formatstr, void* param, WCHAR* paramstr, - WCHAR *checkstr1) +void DoPointerTest(const WCHAR *formatstr, void* param, WCHAR* paramstr, + const WCHAR *checkstr1) { int ret; @@ -40,7 +40,7 @@ void DoPointerTest(WCHAR *formatstr, void* param, WCHAR* paramstr, } } -void DoCountTest(WCHAR *formatstr, int param, WCHAR *checkstr) +void DoCountTest(const WCHAR *formatstr, int param, const WCHAR *checkstr) { int ret; int n = -1; @@ -59,7 +59,7 @@ void DoCountTest(WCHAR *formatstr, int param, WCHAR *checkstr) } } -void DoShortCountTest(WCHAR *formatstr, int param, WCHAR *checkstr) +void DoShortCountTest(const WCHAR *formatstr, int param, const WCHAR *checkstr) { int ret; short int n = -1; @@ -79,7 +79,7 @@ void DoShortCountTest(WCHAR *formatstr, int param, WCHAR *checkstr) } -void DoCharTest(WCHAR *formatstr, WCHAR param, WCHAR *checkstr) +void DoCharTest(const WCHAR *formatstr, WCHAR param, const WCHAR *checkstr) { int ret; @@ -91,7 +91,7 @@ void DoCharTest(WCHAR *formatstr, WCHAR param, WCHAR *checkstr) } } -void DoWCharTest(WCHAR *formatstr, WCHAR param, WCHAR *checkstr) +void DoWCharTest(const WCHAR *formatstr, WCHAR param, const WCHAR *checkstr) { int ret; @@ -103,7 +103,7 @@ void DoWCharTest(WCHAR *formatstr, WCHAR param, WCHAR *checkstr) } } -void DoNumTest(WCHAR *formatstr, int param, WCHAR *checkstr) +void DoNumTest(const WCHAR *formatstr, int param, const WCHAR *checkstr) { int ret; @@ -115,8 +115,8 @@ void DoNumTest(WCHAR *formatstr, int param, WCHAR *checkstr) } } -void DoI64Test(WCHAR *formatstr, INT64 param, WCHAR *valuestr, - WCHAR *checkstr1) +void DoI64Test(const WCHAR *formatstr, INT64 param, const WCHAR *valuestr, + const WCHAR *checkstr1) { int ret; @@ -128,8 +128,8 @@ void DoI64Test(WCHAR *formatstr, INT64 param, WCHAR *valuestr, } } -void DoDoubleTest(WCHAR *formatstr, double param, - WCHAR *checkstr1, WCHAR *checkstr2) +void DoDoubleTest(const WCHAR *formatstr, double param, + const WCHAR *checkstr1, const WCHAR *checkstr2) { int ret; @@ -141,8 +141,8 @@ void DoDoubleTest(WCHAR *formatstr, double param, } } -void DoArgumentPrecTest(WCHAR *formatstr, int precision, void *param, - WCHAR *paramstr, WCHAR *checkstr1, WCHAR *checkstr2) +void DoArgumentPrecTest(const WCHAR *formatstr, int precision, void *param, + WCHAR *paramstr, const WCHAR *checkstr1, const WCHAR *checkstr2) { int ret; @@ -154,8 +154,8 @@ void DoArgumentPrecTest(WCHAR *formatstr, int precision, void *param, } } -void DoArgumentPrecDoubleTest(WCHAR *formatstr, int precision, double param, - WCHAR *checkstr1, WCHAR *checkstr2) +void DoArgumentPrecDoubleTest(const WCHAR *formatstr, int precision, double param, + const WCHAR *checkstr1, const WCHAR *checkstr2) { int ret; |