summaryrefslogtreecommitdiff
path: root/src/pal/tests/palsuite/c_runtime
diff options
context:
space:
mode:
Diffstat (limited to 'src/pal/tests/palsuite/c_runtime')
-rw-r--r--src/pal/tests/palsuite/c_runtime/CMakeLists.txt162
-rw-r--r--src/pal/tests/palsuite/c_runtime/__iscsym/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/__iscsym/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/__iscsym/test1/__iscsym.c93
-rw-r--r--src/pal/tests/palsuite/c_runtime/__iscsym/test1/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/_alloca/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_alloca/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_alloca/test1/test1.c62
-rw-r--r--src/pal/tests/palsuite/c_runtime/_alloca/test1/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/_ecvt/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_ecvt/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_ecvt/test1/test1.c135
-rw-r--r--src/pal/tests/palsuite/c_runtime/_ecvt/test1/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_fdopen/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_fdopen/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_fdopen/test1/test1.c112
-rw-r--r--src/pal/tests/palsuite/c_runtime/_fdopen/test1/testinfo.dat23
-rw-r--r--src/pal/tests/palsuite/c_runtime/_finite/CMakeLists.txt3
-rw-r--r--src/pal/tests/palsuite/c_runtime/_finite/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_finite/test1/test1.c119
-rw-r--r--src/pal/tests/palsuite/c_runtime/_finite/test1/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/_fullpath/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_fullpath/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_fullpath/test1/test1.c181
-rw-r--r--src/pal/tests/palsuite/c_runtime/_fullpath/test1/testinfo.dat23
-rw-r--r--src/pal/tests/palsuite/c_runtime/_gcvt/CMakeLists.txt5
-rw-r--r--src/pal/tests/palsuite/c_runtime/_gcvt/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_gcvt/test1/_gcvt.c58
-rw-r--r--src/pal/tests/palsuite/c_runtime/_gcvt/test1/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/_gcvt/test2/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_gcvt/test2/test2.c83
-rw-r--r--src/pal/tests/palsuite/c_runtime/_gcvt/test2/testinfo.dat15
-rw-r--r--src/pal/tests/palsuite/c_runtime/_getw/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_getw/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_getw/test1/test.datbin0 -> 28 bytes
-rw-r--r--src/pal/tests/palsuite/c_runtime/_getw/test1/test1.c96
-rw-r--r--src/pal/tests/palsuite/c_runtime/_getw/test1/testinfo.dat15
-rw-r--r--src/pal/tests/palsuite/c_runtime/_isnan/CMakeLists.txt3
-rw-r--r--src/pal/tests/palsuite/c_runtime/_isnan/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_isnan/test1/test1.c115
-rw-r--r--src/pal/tests/palsuite/c_runtime/_isnan/test1/testinfo.dat16
-rw-r--r--src/pal/tests/palsuite/c_runtime/_itow/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_itow/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_itow/test1/test1.c102
-rw-r--r--src/pal/tests/palsuite/c_runtime/_itow/test1/testinfo.dat18
-rw-r--r--src/pal/tests/palsuite/c_runtime/_makepath/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_makepath/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_makepath/test1/test1.c65
-rw-r--r--src/pal/tests/palsuite/c_runtime/_makepath/test1/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_mbsdec/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_mbsdec/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_mbsdec/test1/test1.c77
-rw-r--r--src/pal/tests/palsuite/c_runtime/_mbsdec/test1/testinfo.dat18
-rw-r--r--src/pal/tests/palsuite/c_runtime/_mbsinc/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_mbsinc/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_mbsinc/test1/test1.c62
-rw-r--r--src/pal/tests/palsuite/c_runtime/_mbsinc/test1/testinfo.dat15
-rw-r--r--src/pal/tests/palsuite/c_runtime/_mbslen/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_mbslen/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_mbslen/test1/test1.c66
-rw-r--r--src/pal/tests/palsuite/c_runtime/_mbslen/test1/testinfo.dat15
-rw-r--r--src/pal/tests/palsuite/c_runtime/_mbsninc/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_mbsninc/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_mbsninc/test1/test1.c65
-rw-r--r--src/pal/tests/palsuite/c_runtime/_mbsninc/test1/testinfo.dat17
-rw-r--r--src/pal/tests/palsuite/c_runtime/_open_osfhandle/CMakeLists.txt5
-rw-r--r--src/pal/tests/palsuite/c_runtime/_open_osfhandle/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_open_osfhandle/test1/test1.c132
-rw-r--r--src/pal/tests/palsuite/c_runtime/_open_osfhandle/test1/testinfo.dat17
-rw-r--r--src/pal/tests/palsuite/c_runtime/_open_osfhandle/test2/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_open_osfhandle/test2/test2.c86
-rw-r--r--src/pal/tests/palsuite/c_runtime/_open_osfhandle/test2/testinfo.dat16
-rw-r--r--src/pal/tests/palsuite/c_runtime/_putenv/CMakeLists.txt7
-rw-r--r--src/pal/tests/palsuite/c_runtime/_putenv/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_putenv/test1/test1.c99
-rw-r--r--src/pal/tests/palsuite/c_runtime/_putenv/test1/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/_putenv/test2/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_putenv/test2/test2.c76
-rw-r--r--src/pal/tests/palsuite/c_runtime/_putenv/test2/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/_putenv/test3/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_putenv/test3/test3.c102
-rw-r--r--src/pal/tests/palsuite/c_runtime/_putenv/test3/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_putenv/test4/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_putenv/test4/test4.c75
-rw-r--r--src/pal/tests/palsuite/c_runtime/_putenv/test4/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_putw/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_putw/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_putw/test1/test1.c112
-rw-r--r--src/pal/tests/palsuite/c_runtime/_putw/test1/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/_rotl/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_rotl/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_rotl/test1/test1.cpp55
-rw-r--r--src/pal/tests/palsuite/c_runtime/_rotl/test1/testinfo.dat17
-rw-r--r--src/pal/tests/palsuite/c_runtime/_rotr/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_rotr/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_rotr/test1/test1.cpp60
-rw-r--r--src/pal/tests/palsuite/c_runtime/_rotr/test1/testinfo.dat17
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/CMakeLists.txt22
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/_snprintf.h194
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test1/test1.c58
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test1/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test10/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test10/test10.c55
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test10/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test11/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test11/test11.c54
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test11/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test12/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test12/test12.c55
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test12/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test13/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test13/test13.c55
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test13/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test14/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test14/test14.c57
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test14/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test15/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test15/test15.c56
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test15/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test16/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test16/test16.c52
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test16/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test17/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test17/test17.c53
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test17/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test18/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test18/test18.c53
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test18/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test19/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test19/test19.c76
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test19/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test2/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test2/test2.c44
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test2/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test3/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test3/test3.c45
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test3/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test4/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test4/test4.c69
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test4/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test5/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test5/test5.c61
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test5/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test6/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test6/test6.c47
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test6/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test7/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test7/test7.c47
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test7/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test8/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test8/test8.c56
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test8/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test9/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test9/test9.c55
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test9/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/CMakeLists.txt22
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/_snwprintf.h199
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test1/test1.c62
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test1/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test10/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test10/test10.c54
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test10/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test11/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test11/test11.c54
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test11/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test12/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test12/test12.c54
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test12/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test13/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test13/test13.c54
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test13/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test14/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test14/test14.c66
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test14/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test15/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test15/test15.c67
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test15/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test16/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test16/test16.c65
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test16/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test17/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test17/test17.c68
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test17/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test18/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test18/test18.c69
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test18/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test19/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test19/test19.c90
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test19/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test2/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test2/test2.c44
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test2/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test3/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test3/test3.c44
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test3/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test4/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test4/test4.c71
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test4/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test5/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test5/test5.c63
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test5/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test6/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test6/test6.c46
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test6/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test7/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test7/test7.c46
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test7/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test8/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test8/test8.c53
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test8/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test9/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test9/test9.c53
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test9/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/_splitpath/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_splitpath/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_splitpath/test1/test1.c108
-rw-r--r--src/pal/tests/palsuite/c_runtime/_splitpath/test1/testinfo.dat15
-rw-r--r--src/pal/tests/palsuite/c_runtime/_stricmp/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_stricmp/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_stricmp/test1/test1.c70
-rw-r--r--src/pal/tests/palsuite/c_runtime/_stricmp/test1/testinfo.dat15
-rw-r--r--src/pal/tests/palsuite/c_runtime/_strlwr/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_strlwr/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_strlwr/test1/test1.c42
-rw-r--r--src/pal/tests/palsuite/c_runtime/_strlwr/test1/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/_strnicmp/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_strnicmp/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_strnicmp/test1/test1.c85
-rw-r--r--src/pal/tests/palsuite/c_runtime/_strnicmp/test1/testinfo.dat18
-rw-r--r--src/pal/tests/palsuite/c_runtime/_swab/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_swab/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_swab/test1/test1.c45
-rw-r--r--src/pal/tests/palsuite/c_runtime/_swab/test1/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/CMakeLists.txt22
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/_vsnprintf.h124
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test1/test1.c55
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test1/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test10/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test10/test10.c50
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test10/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test11/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test11/test11.c50
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test11/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test12/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test12/test12.c52
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test12/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test13/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test13/test13.c52
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test13/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test14/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test14/test14.c50
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test14/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test15/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test15/test15.c49
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test15/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test16/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test16/test16.c49
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test16/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test17/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test17/test17.c50
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test17/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test18/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test18/test18.c50
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test18/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test19/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test19/test19.c103
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test19/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test2/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test2/test2.c44
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test2/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test3/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test3/test3.c43
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test3/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test4/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test4/test4.c98
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test4/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test5/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test5/test5.c78
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test5/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test6/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test6/test6.c44
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test6/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test7/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test7/test7.c44
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test7/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test8/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test8/test8.c52
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test8/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test9/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test9/test9.c51
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test9/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/CMakeLists.txt22
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/_vsnwprintf.h133
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test1/test1.c60
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test1/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test10/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test10/test10.c50
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test10/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test11/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test11/test11.c50
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test11/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test12/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test12/test12.c50
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test12/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test13/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test13/test13.c50
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test13/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test14/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test14/test14.c63
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test14/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test15/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test15/test15.c64
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test15/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test16/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test16/test16.c63
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test16/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test17/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test17/test17.c65
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test17/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test18/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test18/test18.c65
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test18/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test19/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test19/test19.c139
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test19/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test2/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test2/test2.c40
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test2/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test3/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test3/test3.c40
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test3/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test4/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test4/test4.c121
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test4/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test5/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test5/test5.c81
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test5/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test6/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test6/test6.c43
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test6/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test7/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test7/test7.c43
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test7/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test8/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test8/test8.c49
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test8/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test9/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test9/test9.c49
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test9/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_wcsicmp/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_wcsicmp/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_wcsicmp/test1/test1.c68
-rw-r--r--src/pal/tests/palsuite/c_runtime/_wcsicmp/test1/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/_wcslwr/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_wcslwr/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_wcslwr/test1/test1.c50
-rw-r--r--src/pal/tests/palsuite/c_runtime/_wcslwr/test1/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_wcsnicmp/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_wcsnicmp/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_wcsnicmp/test1/test1.c95
-rw-r--r--src/pal/tests/palsuite/c_runtime/_wcsnicmp/test1/testinfo.dat18
-rw-r--r--src/pal/tests/palsuite/c_runtime/_wfopen/CMakeLists.txt10
-rw-r--r--src/pal/tests/palsuite/c_runtime/_wfopen/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_wfopen/test1/test1.c79
-rw-r--r--src/pal/tests/palsuite/c_runtime/_wfopen/test1/testinfo.dat15
-rw-r--r--src/pal/tests/palsuite/c_runtime/_wfopen/test2/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_wfopen/test2/test2.c68
-rw-r--r--src/pal/tests/palsuite/c_runtime/_wfopen/test2/testinfo.dat15
-rw-r--r--src/pal/tests/palsuite/c_runtime/_wfopen/test3/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_wfopen/test3/test3.c70
-rw-r--r--src/pal/tests/palsuite/c_runtime/_wfopen/test3/testinfo.dat15
-rw-r--r--src/pal/tests/palsuite/c_runtime/_wfopen/test4/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_wfopen/test4/test4.c87
-rw-r--r--src/pal/tests/palsuite/c_runtime/_wfopen/test4/testinfo.dat15
-rw-r--r--src/pal/tests/palsuite/c_runtime/_wfopen/test5/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_wfopen/test5/test5.c82
-rw-r--r--src/pal/tests/palsuite/c_runtime/_wfopen/test5/testinfo.dat15
-rw-r--r--src/pal/tests/palsuite/c_runtime/_wfopen/test6/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_wfopen/test6/test6.c152
-rw-r--r--src/pal/tests/palsuite/c_runtime/_wfopen/test6/testinfo.dat15
-rw-r--r--src/pal/tests/palsuite/c_runtime/_wfopen/test7/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_wfopen/test7/test7.c119
-rw-r--r--src/pal/tests/palsuite/c_runtime/_wfopen/test7/testinfo.dat15
-rw-r--r--src/pal/tests/palsuite/c_runtime/_wmakepath/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_wmakepath/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_wmakepath/test1/test1.c76
-rw-r--r--src/pal/tests/palsuite/c_runtime/_wmakepath/test1/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/_wsplitpath/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_wsplitpath/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_wsplitpath/test1/test1.c151
-rw-r--r--src/pal/tests/palsuite/c_runtime/_wsplitpath/test1/testinfo.dat15
-rw-r--r--src/pal/tests/palsuite/c_runtime/_wtoi/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_wtoi/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_wtoi/test1/test1.c79
-rw-r--r--src/pal/tests/palsuite/c_runtime/_wtoi/test1/testinfo.dat17
-rw-r--r--src/pal/tests/palsuite/c_runtime/abs/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/abs/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/abs/test1/abs.c54
-rw-r--r--src/pal/tests/palsuite/c_runtime/abs/test1/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/acos/CMakeLists.txt3
-rw-r--r--src/pal/tests/palsuite/c_runtime/acos/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/acos/test1/test1.c130
-rw-r--r--src/pal/tests/palsuite/c_runtime/acos/test1/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/asin/CMakeLists.txt3
-rw-r--r--src/pal/tests/palsuite/c_runtime/asin/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/asin/test1/test1.c146
-rw-r--r--src/pal/tests/palsuite/c_runtime/asin/test1/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/atan/CMakeLists.txt3
-rw-r--r--src/pal/tests/palsuite/c_runtime/atan/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/atan/test1/test1.c128
-rw-r--r--src/pal/tests/palsuite/c_runtime/atan/test1/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/atan2/CMakeLists.txt3
-rw-r--r--src/pal/tests/palsuite/c_runtime/atan2/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/atan2/test1/test1.c148
-rw-r--r--src/pal/tests/palsuite/c_runtime/atan2/test1/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/atof/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/atof/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/atof/test1/test1.c75
-rw-r--r--src/pal/tests/palsuite/c_runtime/atof/test1/testinfo.dat16
-rw-r--r--src/pal/tests/palsuite/c_runtime/atoi/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/atoi/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/atoi/test1/test1.c86
-rw-r--r--src/pal/tests/palsuite/c_runtime/atoi/test1/testinfo.dat17
-rw-r--r--src/pal/tests/palsuite/c_runtime/atol/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/atol/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/atol/test1/test1.c88
-rw-r--r--src/pal/tests/palsuite/c_runtime/atol/test1/testinfo.dat17
-rw-r--r--src/pal/tests/palsuite/c_runtime/bsearch/CMakeLists.txt5
-rw-r--r--src/pal/tests/palsuite/c_runtime/bsearch/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/bsearch/test1/test1.c48
-rw-r--r--src/pal/tests/palsuite/c_runtime/bsearch/test1/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/bsearch/test2/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/bsearch/test2/test2.c57
-rw-r--r--src/pal/tests/palsuite/c_runtime/bsearch/test2/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/ceil/CMakeLists.txt3
-rw-r--r--src/pal/tests/palsuite/c_runtime/ceil/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/ceil/test1/test1.c132
-rw-r--r--src/pal/tests/palsuite/c_runtime/ceil/test1/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/cos/CMakeLists.txt3
-rw-r--r--src/pal/tests/palsuite/c_runtime/cos/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/cos/test1/test1.c131
-rw-r--r--src/pal/tests/palsuite/c_runtime/cos/test1/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/cosh/CMakeLists.txt3
-rw-r--r--src/pal/tests/palsuite/c_runtime/cosh/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/cosh/test1/test1.c130
-rw-r--r--src/pal/tests/palsuite/c_runtime/cosh/test1/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/ctime/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/ctime/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/ctime/test1/test1.c154
-rw-r--r--src/pal/tests/palsuite/c_runtime/ctime/test1/testinfo.dat15
-rw-r--r--src/pal/tests/palsuite/c_runtime/errno/CMakeLists.txt5
-rw-r--r--src/pal/tests/palsuite/c_runtime/errno/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/errno/test1/test1.c43
-rw-r--r--src/pal/tests/palsuite/c_runtime/errno/test1/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/errno/test2/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/errno/test2/test2.c76
-rw-r--r--src/pal/tests/palsuite/c_runtime/errno/test2/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/exit/CMakeLists.txt5
-rw-r--r--src/pal/tests/palsuite/c_runtime/exit/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/exit/test1/test1.c37
-rw-r--r--src/pal/tests/palsuite/c_runtime/exit/test1/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/exit/test2/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/exit/test2/test2.c38
-rw-r--r--src/pal/tests/palsuite/c_runtime/exit/test2/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/exp/CMakeLists.txt3
-rw-r--r--src/pal/tests/palsuite/c_runtime/exp/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/exp/test1/test1.c138
-rw-r--r--src/pal/tests/palsuite/c_runtime/exp/test1/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/fabs/CMakeLists.txt3
-rw-r--r--src/pal/tests/palsuite/c_runtime/fabs/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fabs/test1/test1.c130
-rw-r--r--src/pal/tests/palsuite/c_runtime/fabs/test1/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fabsf/CMakeLists.txt3
-rw-r--r--src/pal/tests/palsuite/c_runtime/fabsf/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fabsf/test1/test1.c130
-rw-r--r--src/pal/tests/palsuite/c_runtime/fabsf/test1/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fclose/CMakeLists.txt5
-rw-r--r--src/pal/tests/palsuite/c_runtime/fclose/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fclose/test1/test1.c79
-rw-r--r--src/pal/tests/palsuite/c_runtime/fclose/test1/testinfo.dat18
-rw-r--r--src/pal/tests/palsuite/c_runtime/fclose/test2/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fclose/test2/test2.c77
-rw-r--r--src/pal/tests/palsuite/c_runtime/fclose/test2/testinfo.dat15
-rw-r--r--src/pal/tests/palsuite/c_runtime/feof/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/feof/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/feof/test1/test1.c88
-rw-r--r--src/pal/tests/palsuite/c_runtime/feof/test1/testfile1
-rw-r--r--src/pal/tests/palsuite/c_runtime/feof/test1/testinfo.dat16
-rw-r--r--src/pal/tests/palsuite/c_runtime/ferror/CMakeLists.txt5
-rw-r--r--src/pal/tests/palsuite/c_runtime/ferror/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/ferror/test1/test1.c74
-rw-r--r--src/pal/tests/palsuite/c_runtime/ferror/test1/testfile1
-rw-r--r--src/pal/tests/palsuite/c_runtime/ferror/test1/testinfo.dat16
-rw-r--r--src/pal/tests/palsuite/c_runtime/ferror/test2/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/ferror/test2/test2.c69
-rw-r--r--src/pal/tests/palsuite/c_runtime/ferror/test2/testfile1
-rw-r--r--src/pal/tests/palsuite/c_runtime/ferror/test2/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fflush/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/fflush/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fflush/test1/test1.c80
-rw-r--r--src/pal/tests/palsuite/c_runtime/fflush/test1/testinfo.dat15
-rw-r--r--src/pal/tests/palsuite/c_runtime/fgets/CMakeLists.txt6
-rw-r--r--src/pal/tests/palsuite/c_runtime/fgets/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fgets/test1/test1.c102
-rw-r--r--src/pal/tests/palsuite/c_runtime/fgets/test1/testinfo.dat15
-rw-r--r--src/pal/tests/palsuite/c_runtime/fgets/test2/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fgets/test2/test2.c97
-rw-r--r--src/pal/tests/palsuite/c_runtime/fgets/test2/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/fgets/test3/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fgets/test3/test3.c73
-rw-r--r--src/pal/tests/palsuite/c_runtime/fgets/test3/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/floor/CMakeLists.txt3
-rw-r--r--src/pal/tests/palsuite/c_runtime/floor/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/floor/test1/test1.c132
-rw-r--r--src/pal/tests/palsuite/c_runtime/floor/test1/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fmod/CMakeLists.txt3
-rw-r--r--src/pal/tests/palsuite/c_runtime/fmod/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fmod/test1/test1.c157
-rw-r--r--src/pal/tests/palsuite/c_runtime/fmod/test1/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fmodf/CMakeLists.txt3
-rw-r--r--src/pal/tests/palsuite/c_runtime/fmodf/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fmodf/test1/test1.c156
-rw-r--r--src/pal/tests/palsuite/c_runtime/fmodf/test1/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fopen/CMakeLists.txt10
-rw-r--r--src/pal/tests/palsuite/c_runtime/fopen/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fopen/test1/test1.c82
-rw-r--r--src/pal/tests/palsuite/c_runtime/fopen/test1/testinfo.dat15
-rw-r--r--src/pal/tests/palsuite/c_runtime/fopen/test2/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fopen/test2/test2.c65
-rw-r--r--src/pal/tests/palsuite/c_runtime/fopen/test2/testinfo.dat15
-rw-r--r--src/pal/tests/palsuite/c_runtime/fopen/test3/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fopen/test3/test3.c66
-rw-r--r--src/pal/tests/palsuite/c_runtime/fopen/test3/testinfo.dat15
-rw-r--r--src/pal/tests/palsuite/c_runtime/fopen/test4/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fopen/test4/test4.c82
-rw-r--r--src/pal/tests/palsuite/c_runtime/fopen/test4/testinfo.dat15
-rw-r--r--src/pal/tests/palsuite/c_runtime/fopen/test5/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fopen/test5/test5.c78
-rw-r--r--src/pal/tests/palsuite/c_runtime/fopen/test5/testinfo.dat15
-rw-r--r--src/pal/tests/palsuite/c_runtime/fopen/test6/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fopen/test6/test6.c131
-rw-r--r--src/pal/tests/palsuite/c_runtime/fopen/test6/testinfo.dat15
-rw-r--r--src/pal/tests/palsuite/c_runtime/fopen/test7/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fopen/test7/test7.c117
-rw-r--r--src/pal/tests/palsuite/c_runtime/fopen/test7/testinfo.dat15
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/CMakeLists.txt22
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/fprintf.h177
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test1/test1.c80
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test1/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test10/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test10/test10.c49
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test10/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test11/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test11/test11.c49
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test11/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test12/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test12/test12.c50
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test12/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test13/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test13/test13.c50
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test13/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test14/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test14/test14.c49
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test14/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test15/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test15/test15.c49
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test15/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test16/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test16/test16.c48
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test16/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test17/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test17/test17.c49
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test17/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test18/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test18/test18.c49
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test18/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test19/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test19/test19.c153
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test19/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test2/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test2/test2.c43
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test2/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test3/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test3/test3.c43
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test3/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test4/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test4/test4.c110
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test4/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test5/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test5/test5.c131
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test5/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test6/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test6/test6.c46
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test6/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test7/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test7/test7.c44
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test7/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test8/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test8/test8.c49
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test8/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test9/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test9/test9.c49
-rw-r--r--src/pal/tests/palsuite/c_runtime/fprintf/test9/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fputs/CMakeLists.txt5
-rw-r--r--src/pal/tests/palsuite/c_runtime/fputs/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fputs/test1/test1.c100
-rw-r--r--src/pal/tests/palsuite/c_runtime/fputs/test1/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/fputs/test2/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fputs/test2/test2.c88
-rw-r--r--src/pal/tests/palsuite/c_runtime/fputs/test2/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fread/CMakeLists.txt6
-rw-r--r--src/pal/tests/palsuite/c_runtime/fread/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fread/test1/test1.c135
-rw-r--r--src/pal/tests/palsuite/c_runtime/fread/test1/testfile1
-rw-r--r--src/pal/tests/palsuite/c_runtime/fread/test1/testinfo.dat15
-rw-r--r--src/pal/tests/palsuite/c_runtime/fread/test2/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fread/test2/test2.c143
-rw-r--r--src/pal/tests/palsuite/c_runtime/fread/test2/testfile1
-rw-r--r--src/pal/tests/palsuite/c_runtime/fread/test2/testinfo.dat16
-rw-r--r--src/pal/tests/palsuite/c_runtime/fread/test3/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fread/test3/test3.c131
-rw-r--r--src/pal/tests/palsuite/c_runtime/fread/test3/testfile1
-rw-r--r--src/pal/tests/palsuite/c_runtime/fread/test3/testinfo.dat15
-rw-r--r--src/pal/tests/palsuite/c_runtime/free/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/free/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/free/test1/test1.c62
-rw-r--r--src/pal/tests/palsuite/c_runtime/free/test1/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/fseek/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/fseek/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fseek/test1/test1.c193
-rw-r--r--src/pal/tests/palsuite/c_runtime/fseek/test1/testinfo.dat15
-rw-r--r--src/pal/tests/palsuite/c_runtime/ftell/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/ftell/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/ftell/test1/ftell.c145
-rw-r--r--src/pal/tests/palsuite/c_runtime/ftell/test1/testfile.txt1
-rw-r--r--src/pal/tests/palsuite/c_runtime/ftell/test1/testinfo.dat16
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/CMakeLists.txt22
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/fwprintf.h453
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test1/test1.c71
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test1/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test10/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test10/test10.c51
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test10/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test11/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test11/test11.c51
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test11/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test12/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test12/test12.c52
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test12/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test13/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test13/test13.c52
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test13/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test14/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test14/test14.c66
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test14/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test15/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test15/test15.c66
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test15/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test16/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test16/test16.c65
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test16/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test17/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test17/test17.c51
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test17/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test18/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test18/test18.c51
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test18/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test19/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test19/test19.c81
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test19/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test2/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test2/test2.c45
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test2/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test3/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test3/test3.c45
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test3/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test4/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test4/test4.c85
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test4/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test5/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test5/test5.c63
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test5/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test6/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test6/test6.c48
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test6/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test7/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test7/test7.c47
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test7/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test8/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test8/test8.c51
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test8/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test9/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test9/test9.c51
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test9/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwrite/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwrite/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwrite/test1/test1.c104
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwrite/test1/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/getc/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/getc/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/getc/test1/getc.c152
-rw-r--r--src/pal/tests/palsuite/c_runtime/getc/test1/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/getenv/CMakeLists.txt6
-rw-r--r--src/pal/tests/palsuite/c_runtime/getenv/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/getenv/test1/test1.c78
-rw-r--r--src/pal/tests/palsuite/c_runtime/getenv/test1/testinfo.dat16
-rw-r--r--src/pal/tests/palsuite/c_runtime/getenv/test2/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/getenv/test2/test2.c101
-rw-r--r--src/pal/tests/palsuite/c_runtime/getenv/test2/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/getenv/test3/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/getenv/test3/test3.c75
-rw-r--r--src/pal/tests/palsuite/c_runtime/getenv/test3/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/isalnum/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/isalnum/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/isalnum/test1/test1.c88
-rw-r--r--src/pal/tests/palsuite/c_runtime/isalnum/test1/testinfo.dat19
-rw-r--r--src/pal/tests/palsuite/c_runtime/isalpha/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/isalpha/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/isalpha/test1/test1.c86
-rw-r--r--src/pal/tests/palsuite/c_runtime/isalpha/test1/testinfo.dat19
-rw-r--r--src/pal/tests/palsuite/c_runtime/isdigit/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/isdigit/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/isdigit/test1/test1.c47
-rw-r--r--src/pal/tests/palsuite/c_runtime/isdigit/test1/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/islower/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/islower/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/islower/test1/test1.c85
-rw-r--r--src/pal/tests/palsuite/c_runtime/islower/test1/testinfo.dat19
-rw-r--r--src/pal/tests/palsuite/c_runtime/isprint/CMakeLists.txt5
-rw-r--r--src/pal/tests/palsuite/c_runtime/isprint/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/isprint/test1/isprint.c42
-rw-r--r--src/pal/tests/palsuite/c_runtime/isprint/test1/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/isprint/test2/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/isprint/test2/test2.c59
-rw-r--r--src/pal/tests/palsuite/c_runtime/isprint/test2/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/isspace/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/isspace/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/isspace/test1/test1.c82
-rw-r--r--src/pal/tests/palsuite/c_runtime/isspace/test1/testinfo.dat15
-rw-r--r--src/pal/tests/palsuite/c_runtime/isupper/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/isupper/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/isupper/test1/test1.c88
-rw-r--r--src/pal/tests/palsuite/c_runtime/isupper/test1/testinfo.dat19
-rw-r--r--src/pal/tests/palsuite/c_runtime/iswdigit/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/iswdigit/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/iswdigit/test1/test1.c69
-rw-r--r--src/pal/tests/palsuite/c_runtime/iswdigit/test1/testinfo.dat19
-rw-r--r--src/pal/tests/palsuite/c_runtime/iswprint/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/iswprint/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/iswprint/test1/test1.c59
-rw-r--r--src/pal/tests/palsuite/c_runtime/iswprint/test1/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/iswspace/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/iswspace/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/iswspace/test1/test1.c78
-rw-r--r--src/pal/tests/palsuite/c_runtime/iswspace/test1/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/iswupper/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/iswupper/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/iswupper/test1/test1.c91
-rw-r--r--src/pal/tests/palsuite/c_runtime/iswupper/test1/testinfo.dat19
-rw-r--r--src/pal/tests/palsuite/c_runtime/iswxdigit/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/iswxdigit/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/iswxdigit/test1/test1.c61
-rw-r--r--src/pal/tests/palsuite/c_runtime/iswxdigit/test1/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/isxdigit/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/isxdigit/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/isxdigit/test1/test1.c58
-rw-r--r--src/pal/tests/palsuite/c_runtime/isxdigit/test1/testinfo.dat15
-rw-r--r--src/pal/tests/palsuite/c_runtime/labs/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/labs/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/labs/test1/test1.c65
-rw-r--r--src/pal/tests/palsuite/c_runtime/labs/test1/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/llabs/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/llabs/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/llabs/test1/test1.c65
-rw-r--r--src/pal/tests/palsuite/c_runtime/llabs/test1/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/localtime/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/localtime/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/localtime/test1/test1.c69
-rw-r--r--src/pal/tests/palsuite/c_runtime/localtime/test1/testinfo.dat15
-rw-r--r--src/pal/tests/palsuite/c_runtime/log/CMakeLists.txt3
-rw-r--r--src/pal/tests/palsuite/c_runtime/log/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/log/test1/test1.c140
-rw-r--r--src/pal/tests/palsuite/c_runtime/log/test1/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/log10/CMakeLists.txt3
-rw-r--r--src/pal/tests/palsuite/c_runtime/log10/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/log10/test1/test1.c146
-rw-r--r--src/pal/tests/palsuite/c_runtime/log10/test1/testinfo.dat17
-rw-r--r--src/pal/tests/palsuite/c_runtime/malloc/CMakeLists.txt5
-rw-r--r--src/pal/tests/palsuite/c_runtime/malloc/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/malloc/test1/test1.c52
-rw-r--r--src/pal/tests/palsuite/c_runtime/malloc/test1/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/malloc/test2/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/malloc/test2/test2.c41
-rw-r--r--src/pal/tests/palsuite/c_runtime/malloc/test2/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/memchr/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/memchr/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/memchr/test1/test1.c122
-rw-r--r--src/pal/tests/palsuite/c_runtime/memchr/test1/testinfo.dat19
-rw-r--r--src/pal/tests/palsuite/c_runtime/memcmp/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/memcmp/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/memcmp/test1/test1.c57
-rw-r--r--src/pal/tests/palsuite/c_runtime/memcmp/test1/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/memcpy/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/memcpy/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/memcpy/test1/test1.c87
-rw-r--r--src/pal/tests/palsuite/c_runtime/memcpy/test1/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/memmove/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/memmove/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/memmove/test1/test1.c116
-rw-r--r--src/pal/tests/palsuite/c_runtime/memmove/test1/testinfo.dat19
-rw-r--r--src/pal/tests/palsuite/c_runtime/memset/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/memset/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/memset/test1/test1.c60
-rw-r--r--src/pal/tests/palsuite/c_runtime/memset/test1/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/modf/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/modf/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/modf/test1/test1.c136
-rw-r--r--src/pal/tests/palsuite/c_runtime/modf/test1/testinfo.dat16
-rw-r--r--src/pal/tests/palsuite/c_runtime/modff/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/modff/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/modff/test1/test1.c135
-rw-r--r--src/pal/tests/palsuite/c_runtime/modff/test1/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/pow/CMakeLists.txt3
-rw-r--r--src/pal/tests/palsuite/c_runtime/pow/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/pow/test1/test1.c230
-rw-r--r--src/pal/tests/palsuite/c_runtime/pow/test1/testinfo.dat17
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/CMakeLists.txt22
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/printf.h182
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test1/test1.c43
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test1/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test10/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test10/test10.c52
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test10/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test11/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test11/test11.c51
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test11/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test12/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test12/test12.c53
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test12/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test13/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test13/test13.c54
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test13/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test14/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test14/test14.c54
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test14/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test15/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test15/test15.c54
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test15/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test16/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test16/test16.c50
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test16/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test17/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test17/test17.c52
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test17/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test18/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test18/test18.c51
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test18/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test19/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test19/test19.c76
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test19/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test2/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test2/test2.c45
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test2/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test3/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test3/test3.c45
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test3/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test4/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test4/test4.c66
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test4/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test5/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test5/test5.c60
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test5/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test6/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test6/test6.c48
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test6/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test7/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test7/test7.c47
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test7/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test8/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test8/test8.c53
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test8/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test9/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test9/test9.c53
-rw-r--r--src/pal/tests/palsuite/c_runtime/printf/test9/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/qsort/CMakeLists.txt5
-rw-r--r--src/pal/tests/palsuite/c_runtime/qsort/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/qsort/test1/test1.c48
-rw-r--r--src/pal/tests/palsuite/c_runtime/qsort/test1/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/qsort/test2/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/qsort/test2/test2.c49
-rw-r--r--src/pal/tests/palsuite/c_runtime/qsort/test2/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/rand_srand/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/rand_srand/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/rand_srand/test1/test1.c100
-rw-r--r--src/pal/tests/palsuite/c_runtime/rand_srand/test1/testinfo.dat16
-rw-r--r--src/pal/tests/palsuite/c_runtime/realloc/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/realloc/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/realloc/test1/test1.c66
-rw-r--r--src/pal/tests/palsuite/c_runtime/realloc/test1/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/sin/CMakeLists.txt3
-rw-r--r--src/pal/tests/palsuite/c_runtime/sin/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/sin/test1/test1.c131
-rw-r--r--src/pal/tests/palsuite/c_runtime/sin/test1/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/sinh/CMakeLists.txt3
-rw-r--r--src/pal/tests/palsuite/c_runtime/sinh/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/sinh/test1/test1.c130
-rw-r--r--src/pal/tests/palsuite/c_runtime/sinh/test1/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/CMakeLists.txt22
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/sprintf.h195
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test1/test1.c45
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test1/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test10/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test10/test10.c55
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test10/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test11/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test11/test11.c55
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test11/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test12/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test12/test12.c56
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test12/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test13/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test13/test13.c56
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test13/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test14/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test14/test14.c53
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test14/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test15/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test15/test15.c53
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test15/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test16/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test16/test16.c52
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test16/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test17/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test17/test17.c54
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test17/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test18/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test18/test18.c53
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test18/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test19/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test19/test19.c78
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test19/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test2/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test2/test2.c47
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test2/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test3/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test3/test3.c47
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test3/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test4/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test4/test4.c69
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test4/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test5/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test5/test5.c62
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test5/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test6/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test6/test6.c50
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test6/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test7/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test7/test7.c49
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test7/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test8/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test8/test8.c55
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test8/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test9/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test9/test9.c55
-rw-r--r--src/pal/tests/palsuite/c_runtime/sprintf/test9/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/sqrt/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/sqrt/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/sqrt/test1/test1.c123
-rw-r--r--src/pal/tests/palsuite/c_runtime/sqrt/test1/testinfo.dat17
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/CMakeLists.txt20
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/sscanf.h246
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test1/test1.c53
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test1/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test10/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test10/test10.c37
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test10/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test11/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test11/test11.c36
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test11/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test12/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test12/test12.c35
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test12/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test13/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test13/test13.c37
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test13/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test14/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test14/test14.c36
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test14/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test15/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test15/test15.c36
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test15/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test16/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test16/test16.c37
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test16/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test17/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test17/test17.c37
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test17/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test2/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test2/test2.c44
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test2/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test3/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test3/test3.c35
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test3/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test4/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test4/test4.c44
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test4/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test5/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test5/test5.c43
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test5/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test6/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test6/test6.c43
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test6/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test7/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test7/test7.c43
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test7/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test8/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test8/test8.c43
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test8/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test9/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test9/test9.c38
-rw-r--r--src/pal/tests/palsuite/c_runtime/sscanf/test9/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/strcat/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/strcat/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/strcat/test1/test1.c66
-rw-r--r--src/pal/tests/palsuite/c_runtime/strcat/test1/testinfo.dat15
-rw-r--r--src/pal/tests/palsuite/c_runtime/strchr/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/strchr/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/strchr/test1/test1.c86
-rw-r--r--src/pal/tests/palsuite/c_runtime/strchr/test1/testinfo.dat15
-rw-r--r--src/pal/tests/palsuite/c_runtime/strcmp/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/strcmp/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/strcmp/test1/test1.c73
-rw-r--r--src/pal/tests/palsuite/c_runtime/strcmp/test1/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/strcpy/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/strcpy/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/strcpy/test1/test1.c51
-rw-r--r--src/pal/tests/palsuite/c_runtime/strcpy/test1/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/strcspn/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/strcspn/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/strcspn/test1/test1.c59
-rw-r--r--src/pal/tests/palsuite/c_runtime/strcspn/test1/testinfo.dat15
-rw-r--r--src/pal/tests/palsuite/c_runtime/strlen/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/strlen/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/strlen/test1/test1.c33
-rw-r--r--src/pal/tests/palsuite/c_runtime/strlen/test1/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/strncat/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/strncat/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/strncat/test1/test1.c77
-rw-r--r--src/pal/tests/palsuite/c_runtime/strncat/test1/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/strncmp/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/strncmp/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/strncmp/test1/test1.c80
-rw-r--r--src/pal/tests/palsuite/c_runtime/strncmp/test1/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/strncpy/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/strncpy/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/strncpy/test1/test1.c85
-rw-r--r--src/pal/tests/palsuite/c_runtime/strncpy/test1/testinfo.dat15
-rw-r--r--src/pal/tests/palsuite/c_runtime/strpbrk/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/strpbrk/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/strpbrk/test1/test1.c85
-rw-r--r--src/pal/tests/palsuite/c_runtime/strpbrk/test1/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/strrchr/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/strrchr/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/strrchr/test1/test1.c55
-rw-r--r--src/pal/tests/palsuite/c_runtime/strrchr/test1/testinfo.dat16
-rw-r--r--src/pal/tests/palsuite/c_runtime/strspn/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/strspn/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/strspn/test1/test1.c60
-rw-r--r--src/pal/tests/palsuite/c_runtime/strspn/test1/testinfo.dat15
-rw-r--r--src/pal/tests/palsuite/c_runtime/strstr/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/strstr/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/strstr/test1/test1.c83
-rw-r--r--src/pal/tests/palsuite/c_runtime/strstr/test1/testinfo.dat16
-rw-r--r--src/pal/tests/palsuite/c_runtime/strtod/CMakeLists.txt5
-rw-r--r--src/pal/tests/palsuite/c_runtime/strtod/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/strtod/test1/test1.c93
-rw-r--r--src/pal/tests/palsuite/c_runtime/strtod/test1/testinfo.dat17
-rw-r--r--src/pal/tests/palsuite/c_runtime/strtod/test2/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/strtod/test2/test2.c65
-rw-r--r--src/pal/tests/palsuite/c_runtime/strtod/test2/testinfo.dat16
-rw-r--r--src/pal/tests/palsuite/c_runtime/strtok/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/strtok/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/strtok/test1/test1.c78
-rw-r--r--src/pal/tests/palsuite/c_runtime/strtok/test1/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/strtoul/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/strtoul/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/strtoul/test1/test1.c73
-rw-r--r--src/pal/tests/palsuite/c_runtime/strtoul/test1/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/CMakeLists.txt22
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/swprintf.h202
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test1/test1.c44
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test1/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test10/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test10/test10.c55
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test10/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test11/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test11/test11.c55
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test11/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test12/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test12/test12.c56
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test12/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test13/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test13/test13.c55
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test13/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test14/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test14/test14.c67
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test14/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test15/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test15/test15.c67
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test15/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test16/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test16/test16.c67
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test16/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test17/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test17/test17.c69
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test17/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test18/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test18/test18.c69
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test18/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test19/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test19/test19.c109
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test19/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test2/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test2/test2.c46
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test2/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test3/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test3/test3.c43
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test3/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test4/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test4/test4.c71
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test4/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test5/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test5/test5.c67
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test5/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test6/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test6/test6.c47
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test6/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test7/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test7/test7.c48
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test7/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test8/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test8/test8.c55
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test8/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test9/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test9/test9.c55
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test9/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/CMakeLists.txt20
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/swscanf.h262
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test1/test1.c53
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test1/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test10/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test10/test10.c36
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test10/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test11/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test11/test11.c35
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test11/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test12/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test12/test12.c35
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test12/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test13/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test13/test13.c37
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test13/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test14/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test14/test14.c38
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test14/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test15/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test15/test15.c37
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test15/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test16/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test16/test16.c37
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test16/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test17/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test17/test17.c37
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test17/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test2/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test2/test2.c43
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test2/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test3/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test3/test3.c36
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test3/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test4/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test4/test4.c44
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test4/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test5/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test5/test5.c44
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test5/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test6/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test6/test6.c44
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test6/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test7/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test7/test7.c44
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test7/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test8/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test8/test8.c44
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test8/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test9/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test9/test9.c37
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test9/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/tan/CMakeLists.txt3
-rw-r--r--src/pal/tests/palsuite/c_runtime/tan/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/tan/test1/test1.c137
-rw-r--r--src/pal/tests/palsuite/c_runtime/tan/test1/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/tanh/CMakeLists.txt3
-rw-r--r--src/pal/tests/palsuite/c_runtime/tanh/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/tanh/test1/test1.c130
-rw-r--r--src/pal/tests/palsuite/c_runtime/tanh/test1/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/time/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/time/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/time/test1/test1.c51
-rw-r--r--src/pal/tests/palsuite/c_runtime/time/test1/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/tolower/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/tolower/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/tolower/test1/test1.c79
-rw-r--r--src/pal/tests/palsuite/c_runtime/tolower/test1/testinfo.dat19
-rw-r--r--src/pal/tests/palsuite/c_runtime/toupper/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/toupper/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/toupper/test1/test1.c64
-rw-r--r--src/pal/tests/palsuite/c_runtime/toupper/test1/testinfo.dat19
-rw-r--r--src/pal/tests/palsuite/c_runtime/towlower/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/towlower/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/towlower/test1/test1.c79
-rw-r--r--src/pal/tests/palsuite/c_runtime/towlower/test1/testinfo.dat19
-rw-r--r--src/pal/tests/palsuite/c_runtime/towupper/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/towupper/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/towupper/test1/test1.c65
-rw-r--r--src/pal/tests/palsuite/c_runtime/towupper/test1/testinfo.dat19
-rw-r--r--src/pal/tests/palsuite/c_runtime/ungetc/CMakeLists.txt5
-rw-r--r--src/pal/tests/palsuite/c_runtime/ungetc/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/ungetc/test1/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/ungetc/test1/ungetc.c130
-rw-r--r--src/pal/tests/palsuite/c_runtime/ungetc/test2/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/ungetc/test2/test2.txt1
-rw-r--r--src/pal/tests/palsuite/c_runtime/ungetc/test2/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/ungetc/test2/ungetc.c188
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/CMakeLists.txt22
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test1/test1.c68
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test1/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test10/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test10/test10.c52
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test10/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test11/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test11/test11.c51
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test11/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test12/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test12/test12.c53
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test12/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test13/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test13/test13.c54
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test13/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test14/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test14/test14.c54
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test14/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test15/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test15/test15.c54
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test15/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test16/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test16/test16.c50
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test16/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test17/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test17/test17.c52
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test17/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test18/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test18/test18.c51
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test18/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test19/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test19/test19.c76
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test19/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test2/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test2/test2.c45
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test2/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test3/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test3/test3.c45
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test3/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test4/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test4/test4.c70
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test4/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test5/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test5/test5.c60
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test5/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test6/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test6/test6.c48
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test6/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test7/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test7/test7.c47
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test7/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test8/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test8/test8.c53
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test8/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test9/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test9/test9.c53
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/test9/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/vfprintf/vfprintf.h463
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/CMakeLists.txt23
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test1/test1.c43
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test1/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test10/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test10/test10.c52
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test10/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test11/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test11/test11.c51
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test11/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test12/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test12/test12.c53
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test12/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test13/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test13/test13.c54
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test13/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test14/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test14/test14.c54
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test14/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test15/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test15/test15.c54
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test15/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test16/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test16/test16.c50
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test16/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test17/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test17/test17.c52
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test17/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test18/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test18/test18.c51
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test18/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test19/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test19/test19.c76
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test19/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test2/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test2/test2.c45
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test2/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test3/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test3/test3.c45
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test3/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test4/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test4/test4.c70
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test4/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test5/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test5/test5.c60
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test5/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test6/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test6/test6.c48
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test6/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test7/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test7/test7.c47
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test7/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test8/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test8/test8.c53
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test8/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test9/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test9/test9.c53
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/test9/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/vprintf/vprintf.h193
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/CMakeLists.txt22
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test1/test1.c55
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test1/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test10/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test10/test10.c50
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test10/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test11/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test11/test11.c50
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test11/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test12/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test12/test12.c52
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test12/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test13/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test13/test13.c52
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test13/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test14/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test14/test14.c50
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test14/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test15/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test15/test15.c64
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test15/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test16/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test16/test16.c49
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test16/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test17/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test17/test17.c50
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test17/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test18/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test18/test18.c50
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test18/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test19/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test19/test19.c67
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test19/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test2/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test2/test2.c42
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test2/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test3/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test3/test3.c43
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test3/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test4/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test4/test4.c72
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test4/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test5/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test5/test5.c43
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test5/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test6/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test6/test6.c44
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test6/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test7/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test7/test7.c44
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test7/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test8/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test8/test8.c52
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test8/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test9/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test9/test9.c51
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test9/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/vsprintf.h218
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/CMakeLists.txt22
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test1/test1.c41
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test1/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test10/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test10/test10.c48
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test10/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test11/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test11/test11.c48
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test11/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test12/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test12/test12.c48
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test12/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test13/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test13/test13.c48
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test13/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test14/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test14/test14.c61
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test14/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test15/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test15/test15.c62
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test15/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test16/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test16/test16.c61
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test16/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test17/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test17/test17.c63
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test17/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test18/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test18/test18.c63
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test18/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test19/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test19/test19.c137
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test19/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test2/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test2/test2.c40
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test2/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test3/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test3/test3.c40
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test3/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test4/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test4/test4.c118
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test4/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test5/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test5/test5.c79
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test5/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test6/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test6/test6.c41
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test6/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test7/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test7/test7.c41
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test7/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test8/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test8/test8.c47
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test8/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test9/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test9/test9.c47
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test9/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/vswprintf.h132
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcscat/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcscat/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcscat/test1/test1.c71
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcscat/test1/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcschr/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcschr/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcschr/test1/test1.c51
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcschr/test1/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcscmp/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcscmp/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcscmp/test1/test1.c57
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcscmp/test1/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcscpy/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcscpy/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcscpy/test1/test1.c47
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcscpy/test1/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcslen/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcslen/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcslen/test1/test1.c49
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcslen/test1/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcsncat/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcsncat/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcsncat/test1/test1.c77
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcsncat/test1/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcsncmp/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcsncmp/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcsncmp/test1/test1.c73
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcsncmp/test1/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcsncpy/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcsncpy/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcsncpy/test1/test1.c84
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcsncpy/test1/testinfo.dat15
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcspbrk/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcspbrk/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcspbrk/test1/test1.c61
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcspbrk/test1/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcsrchr/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcsrchr/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcsrchr/test1/test1.c50
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcsrchr/test1/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcsstr/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcsstr/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcsstr/test1/test1.c62
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcsstr/test1/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcstod/CMakeLists.txt5
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcstod/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcstod/test1/test1.c79
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcstod/test1/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcstod/test2/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcstod/test2/test2.c59
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcstod/test2/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcstok/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcstok/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcstok/test1/test1.c114
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcstok/test1/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcstol/CMakeLists.txt9
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcstol/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcstol/test1/test1.c53
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcstol/test1/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcstol/test2/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcstol/test2/test2.c53
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcstol/test2/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcstol/test3/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcstol/test3/test3.c52
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcstol/test3/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcstol/test4/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcstol/test4/test4.c77
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcstol/test4/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcstol/test5/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcstol/test5/test5.c76
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcstol/test5/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcstol/test6/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcstol/test6/test6.c86
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcstol/test6/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcstoul/CMakeLists.txt9
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcstoul/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcstoul/test1/test1.c49
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcstoul/test1/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcstoul/test2/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcstoul/test2/test2.c49
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcstoul/test2/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcstoul/test3/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcstoul/test3/test3.c49
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcstoul/test3/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcstoul/test4/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcstoul/test4/test4.c52
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcstoul/test4/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcstoul/test5/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcstoul/test5/test5.c69
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcstoul/test5/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcstoul/test6/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcstoul/test6/test6.c83
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcstoul/test6/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/wprintf/CMakeLists.txt5
-rw-r--r--src/pal/tests/palsuite/c_runtime/wprintf/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/wprintf/test1/test1.c47
-rw-r--r--src/pal/tests/palsuite/c_runtime/wprintf/test1/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/wprintf/test2/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/wprintf/test2/test2.c45
-rw-r--r--src/pal/tests/palsuite/c_runtime/wprintf/test2/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/wprintf/wprintf.h171
1582 files changed, 51457 insertions, 0 deletions
diff --git a/src/pal/tests/palsuite/c_runtime/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/CMakeLists.txt
new file mode 100644
index 0000000000..533454c285
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/CMakeLists.txt
@@ -0,0 +1,162 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(abs)
+add_subdirectory(acos)
+add_subdirectory(asin)
+add_subdirectory(atan)
+add_subdirectory(atan2)
+add_subdirectory(atof)
+add_subdirectory(atoi)
+add_subdirectory(atol)
+add_subdirectory(bsearch)
+add_subdirectory(ceil)
+add_subdirectory(cos)
+add_subdirectory(cosh)
+
+# TODO: make this test compile
+# add_subdirectory(ctime)
+
+add_subdirectory(errno)
+add_subdirectory(exit)
+add_subdirectory(exp)
+add_subdirectory(fabs)
+add_subdirectory(fabsf)
+add_subdirectory(fclose)
+add_subdirectory(feof)
+add_subdirectory(ferror)
+add_subdirectory(fflush)
+add_subdirectory(fgets)
+add_subdirectory(floor)
+add_subdirectory(fmod)
+add_subdirectory(fmodf)
+add_subdirectory(fopen)
+add_subdirectory(fprintf)
+add_subdirectory(fputs)
+add_subdirectory(fread)
+add_subdirectory(free)
+add_subdirectory(fseek)
+add_subdirectory(ftell)
+add_subdirectory(fwprintf)
+add_subdirectory(fwrite)
+add_subdirectory(getc)
+add_subdirectory(getenv)
+add_subdirectory(isalnum)
+add_subdirectory(isalpha)
+add_subdirectory(isdigit)
+add_subdirectory(islower)
+add_subdirectory(isprint)
+add_subdirectory(isspace)
+add_subdirectory(isupper)
+add_subdirectory(iswdigit)
+add_subdirectory(iswspace)
+add_subdirectory(iswupper)
+add_subdirectory(iswxdigit)
+add_subdirectory(isxdigit)
+add_subdirectory(labs)
+add_subdirectory(llabs)
+add_subdirectory(localtime)
+add_subdirectory(log)
+add_subdirectory(log10)
+add_subdirectory(malloc)
+add_subdirectory(memchr)
+add_subdirectory(memcmp)
+add_subdirectory(memcpy)
+add_subdirectory(memmove)
+add_subdirectory(memset)
+add_subdirectory(modf)
+add_subdirectory(modff)
+add_subdirectory(pow)
+add_subdirectory(printf)
+add_subdirectory(qsort)
+add_subdirectory(rand_srand)
+add_subdirectory(realloc)
+add_subdirectory(sin)
+add_subdirectory(sinh)
+add_subdirectory(sprintf)
+add_subdirectory(sqrt)
+add_subdirectory(sscanf)
+add_subdirectory(strcat)
+add_subdirectory(strchr)
+add_subdirectory(strcmp)
+add_subdirectory(strcpy)
+add_subdirectory(strcspn)
+add_subdirectory(strlen)
+add_subdirectory(strncat)
+add_subdirectory(strncmp)
+add_subdirectory(strncpy)
+add_subdirectory(strpbrk)
+add_subdirectory(strrchr)
+add_subdirectory(strspn)
+add_subdirectory(strstr)
+add_subdirectory(strtod)
+add_subdirectory(strtok)
+add_subdirectory(strtoul)
+add_subdirectory(swprintf)
+add_subdirectory(swscanf)
+add_subdirectory(tan)
+add_subdirectory(tanh)
+add_subdirectory(time)
+add_subdirectory(tolower)
+add_subdirectory(toupper)
+add_subdirectory(towlower)
+add_subdirectory(towupper)
+add_subdirectory(ungetc)
+add_subdirectory(vfprintf)
+add_subdirectory(vprintf)
+add_subdirectory(vsprintf)
+add_subdirectory(vswprintf)
+add_subdirectory(wcscat)
+add_subdirectory(wcschr)
+add_subdirectory(wcscmp)
+add_subdirectory(wcscpy)
+add_subdirectory(wcslen)
+add_subdirectory(wcsncat)
+add_subdirectory(wcsncmp)
+add_subdirectory(wcsncpy)
+add_subdirectory(wcspbrk)
+add_subdirectory(wcsrchr)
+add_subdirectory(wcsstr)
+add_subdirectory(wcstod)
+add_subdirectory(wcstok)
+add_subdirectory(wcstol)
+add_subdirectory(wcstoul)
+add_subdirectory(wprintf)
+add_subdirectory(_alloca)
+add_subdirectory(_ecvt)
+add_subdirectory(_fdopen)
+add_subdirectory(_finite)
+add_subdirectory(_fullpath)
+
+# TODO: make this test compile
+# add_subdirectory(_gcvt)
+
+add_subdirectory(_getw)
+add_subdirectory(_isnan)
+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(_stricmp)
+add_subdirectory(_strlwr)
+add_subdirectory(_strnicmp)
+add_subdirectory(_swab)
+add_subdirectory(_vsnprintf)
+add_subdirectory(_vsnwprintf)
+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/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/__iscsym/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/__iscsym/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/__iscsym/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/__iscsym/test1/CMakeLists.txt
new file mode 100644
index 0000000000..a283161f7d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/__iscsym/test1/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ __iscsym.c
+)
+
+add_executable(paltest_iscsym_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_iscsym_test1 coreclrpal)
+
+target_link_libraries(paltest_iscsym_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/__iscsym/test1/__iscsym.c b/src/pal/tests/palsuite/c_runtime/__iscsym/test1/__iscsym.c
new file mode 100644
index 0000000000..9c8f1d0f25
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/__iscsym/test1/__iscsym.c
@@ -0,0 +1,93 @@
+// Licensed to the .NET Foundation under one or more 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: __iscsym.c
+**
+** Purpose: Positive test the __iscsym API.
+** Call __iscsym to letter, digit and underscore
+**
+**
+**============================================================*/
+#include <palsuite.h>
+
+int __cdecl main(int argc, char *argv[])
+{
+ int err;
+ int index;
+ char non_letter_set[]=
+ {'~','`','!','@','#','$','%','^','&','*','(',')',')',
+ '-','+','=','|','\\',';',':','"','\'','<','>',
+ ',','.','?','/','\0'};
+ char errBuffer[200];
+
+ /*Initialize the PAL environment*/
+ err = PAL_Initialize(argc, argv);
+ if(0 != err)
+ {
+ return FAIL;
+ }
+
+ /*To check if the parameter passed in is a character*/
+ for(index = 'a'; index <= 'z'; index++)
+ {
+ err = __iscsym(index);
+ if(0 == err)
+ {
+ Fail("\n__iscsym failed to recognize a "
+ "lower-case letter:%c!\n", index);
+ }
+ }
+
+ /*To check if the parameter passed in is a character*/
+ for(index = 'A'; index <= 'Z'; index++)
+ {
+ err = __iscsym(index);
+ if(0 == err)
+ {
+ Fail("\n__iscsym failed to recognize an "
+ "upper-case letter: %c!\n", index);
+ }
+ }
+
+ /*To check if the parameter passed in is a digit*/
+ for(index = '0'; index <= '9'; index++)
+ {
+ err = __iscsym(index);
+ if(0 == err)
+ {
+ Fail("\n__iscsym failed to recognize a digit %c!\n",
+ index);
+ }
+ }
+
+ /*To check if the parameter passed in is a underscore*/
+ err = __iscsym('_');
+ if(0 == err)
+ {
+ Fail("\n__iscsym failed to recognize an underscore!\n");
+ }
+
+ memset(errBuffer, 0, 200);
+
+ for(index = 0; non_letter_set[index]; index++)
+ {
+ err = __iscsym(non_letter_set[index]);
+ if(0 != err)
+ {
+ strncat(errBuffer, &non_letter_set[index], 1);
+ strcat(errBuffer, ", ");
+ }
+ }
+
+ if(strlen(errBuffer) > 0)
+ {
+ Fail("\n__iscsym failed to identify the characters '%s' "
+ "as not letters, digits "
+ "or underscores\n", errBuffer);
+ }
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/__iscsym/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/__iscsym/test1/testinfo.dat
new file mode 100644
index 0000000000..e6668edccf
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/__iscsym/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 = __iscsym
+Name = Positive test for __iscsym to test letter, digit and underscore
+TYPE = DEFAULT
+EXE1 = __iscsym
+Description
+=Test the __iscsym to test letter, digit and underscore
diff --git a/src/pal/tests/palsuite/c_runtime/_alloca/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_alloca/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_alloca/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/_alloca/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_alloca/test1/CMakeLists.txt
new file mode 100644
index 0000000000..236b356185
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_alloca/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_alloca_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_alloca_test1 coreclrpal)
+
+target_link_libraries(paltest_alloca_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_alloca/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_alloca/test1/test1.c
new file mode 100644
index 0000000000..c533d84234
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_alloca/test1/test1.c
@@ -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: Checks that _alloca allocates memory, and that the memory is
+** readable and writeable.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char **argv)
+{
+
+ char *testA = NULL;
+ int i = 0;
+
+ /*
+ * Initialize the PAL and return FAIL if this fails
+ */
+ if (0 != (PAL_Initialize(argc, argv)))
+ {
+ return FAIL;
+ }
+
+
+ /* check that _alloca really gives us addressable memory */
+ testA = (char *)_alloca(20 * sizeof(char));
+ if (testA == NULL)
+ {
+ Fail ("The call to _alloca failed\n");
+ }
+
+ memset(testA, 'a', 20);
+
+ for (i = 0; i < 20; i++)
+ {
+ if (testA[i] != 'a')
+ {
+ Fail ("The memory returned by _alloca doesn't seem to be"
+ " properly allocated\n");
+ }
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/_alloca/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_alloca/test1/testinfo.dat
new file mode 100644
index 0000000000..e21562195e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_alloca/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 = _alloca
+Name = Positive Test for _alloca
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Checks that _alloca allocates memory, and that the memory is
+= readable and writeable.
diff --git a/src/pal/tests/palsuite/c_runtime/_ecvt/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_ecvt/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_ecvt/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/_ecvt/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_ecvt/test1/CMakeLists.txt
new file mode 100644
index 0000000000..86f4547b2b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_ecvt/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_ecvt_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_ecvt_test1 coreclrpal)
+
+target_link_libraries(paltest_ecvt_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_ecvt/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_ecvt/test1/test1.c
new file mode 100644
index 0000000000..fbcf11ecfc
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_ecvt/test1/test1.c
@@ -0,0 +1,135 @@
+// Licensed to the .NET Foundation under one or more 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: c_runtime/_ecvt/test1/test1.c
+**
+** Purpose: Call the _ecvt function on a number of cases. Check that it
+** handles negatives, positives and double bounds correctly. Also check that
+** the 'digit' specification works.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+#define INT64_TO_DOUBLE(a) (*(double*)&a)
+
+INT64 NaN = 0x7ff8000000000000;
+INT64 NegativeInfinity = 0xfff0000000000000;
+INT64 NegativeSmall = 0x8000000000000001;
+INT64 PositiveInfinity = 0x7ff0000000000000;
+INT64 PositiveSmall = 0x0000000000000001;
+
+struct testCase
+{
+ double value; /* number to be converted */
+ int precision; /* number of digits to be stored */
+ int decimal; /* (expected) decimal point position for stored
+ * number */
+ int sign; /* (expected) return value */
+ char expResult[256]; /* (expected) character array to be returned
+ * NOTE: this necessarily limits precision
+ * to a value between 0 and 255 */
+ char bsdExpResult[256]; /* (expected) character array to be returned
+ * NOTE: this necessarily limits precision
+ * to a value between 0 and 255 */
+};
+
+int __cdecl main(int argc, char **argv)
+{
+ char *result;
+ int testDecimal;
+ int testSign;
+ int i=0;
+
+ struct testCase testCases[] =
+ {
+ /* odd ball values */
+ {INT64_TO_DOUBLE(NaN), 7, 1, 0, "1#QNAN0" },
+ /* positive values */
+ {0, 0, 0, 0, ""},
+ {INT64_TO_DOUBLE(PositiveSmall), 17, -323, 0,
+ "49406564584124654"},
+ {.00123, 3, -2, 0, "123"},
+ {.123, 3, 0, 0, "123"},
+ {123, 3, 3, 0, "123"},
+ {3.1415926535, 9, 1, 0, "314159265"},
+ {3.1415926535, 10, 1, 0, "3141592654"},
+ {3.1415926535, 11, 1, 0, "31415926535"},
+ {3.1415926535, 12, 1, 0, "314159265350"},
+ {184467444073709570000.0, 21, 21, 0, "184467444073709570000",
+ "184467444073709568000" },
+ {184467444073709570000.0, 22, 21, 0, "1844674440737095700000",
+ "1844674440737095680000" },
+ {INT64_TO_DOUBLE(PositiveInfinity), 7, 1, 0, "1#INF00" },
+ /* negative values */
+ {-0, 0, 0, 0, ""},
+ {INT64_TO_DOUBLE(NegativeSmall), 17, -323, 1,
+ "49406564584124654"},
+ {-.00123, 3, -2, 1, "123"},
+ {-.123, 3, 0, 1, "123"},
+ {-123, 3, 3, 1, "123"},
+ {-3.1415926535, 9, 1, 1, "314159265"},
+ {-3.1415926535, 10, 1, 1, "3141592654"},
+ {-3.1415926535, 11, 1, 1, "31415926535"},
+ {-3.1415926535, 12, 1, 1, "314159265350"},
+ {-184467444073709570000.0, 21, 21, 1, "184467444073709570000",
+ "184467444073709568000" },
+ {-184467444073709570000.0, 22, 21, 1, "1844674440737095700000",
+ "1844674440737095680000" },
+ {INT64_TO_DOUBLE(NegativeInfinity), 7, 1, 1, "1#INF00"}
+
+ };
+
+ if (0 != (PAL_Initialize(argc, argv)))
+ {
+ return FAIL;
+ }
+
+ /* Loop through each case. Call _ecvt on each test case and check the
+ result.
+ */
+
+ for(i = 0; i < sizeof(testCases) / sizeof(struct testCase); i++)
+ {
+ result = _ecvt(testCases[i].value,
+ testCases[i].precision,
+ &testDecimal,
+ &testSign);
+
+ if (( strcmp(testCases[i].expResult, result) != 0 &&
+ strcmp(testCases[i].bsdExpResult, result) != 0 ) ||
+
+ ( testCases[i].sign != testSign ) ||
+ ( testCases[i].decimal != testDecimal ))
+
+ {
+ Fail("PALSUITE ERROR: Test %d\n"
+ "-----------------------\n"
+ "testCases[i].value = '%f'\n"
+ "testCases[i].precision = '%d'\n"
+ "testCases[i].decimal = '%d'\n"
+ "testCases[i].sign = '%d'\n"
+ "testCases[i].expResult = '%s'\n"
+ "result = '%s'\n"
+ "testDecimal = '%d'\n"
+ "testSign = '%d'\n\n",
+ i,
+ testCases[i].value,
+ testCases[i].precision,
+ testCases[i].decimal,
+ testCases[i].sign,
+ testCases[i].expResult,
+ result,
+ testDecimal,
+ testSign);
+ }
+
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/_ecvt/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_ecvt/test1/testinfo.dat
new file mode 100644
index 0000000000..12e7292ec7
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_ecvt/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 = _ecvt
+Name = Call _ecvt on normal values, negatives, exponents and hex digits.
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Call the _ecvt function on a number of cases. Check that it
+= handles negatives, positives and double bounds correctly. Also check that
+= the 'digit' specification works.
diff --git a/src/pal/tests/palsuite/c_runtime/_fdopen/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_fdopen/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_fdopen/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/_fdopen/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_fdopen/test1/CMakeLists.txt
new file mode 100644
index 0000000000..441d32bd5c
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_fdopen/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_fdopen_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fdopen_test1 coreclrpal)
+
+target_link_libraries(paltest_fdopen_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_fdopen/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_fdopen/test1/test1.c
new file mode 100644
index 0000000000..b88267c6e4
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_fdopen/test1/test1.c
@@ -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 (fdopen)
+**
+** Purpose: Tests the PAL implementation of the fdopen function.
+** This will test fdopen in r (read) mode. This test
+** creates and opens a test pipe, to write and read
+** from. fdopen requires a file handle(int), therefore
+** _open_osfhandle is used to get that handle.
+** _open_osfhandle is only used with CreatePipe. The
+** test will write and read from the pipe comparing
+** the results.
+**
+** See /tests/palsuite/README.txt for more information.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+const char* cTestString = "one fish, two fish, read fish, blue fish.";
+
+int __cdecl main(int argc, char **argv)
+{
+ HANDLE hReadPipe = NULL;
+ HANDLE hWritePipe = NULL;
+ BOOL bRetVal = FALSE;
+ int iFiledes = 0;
+ DWORD dwBytesWritten;
+ char buffer[45];
+ FILE *fp;
+
+ SECURITY_ATTRIBUTES lpPipeAttributes;
+
+ /*Initialize the PAL*/
+ if ((PAL_Initialize(argc, argv)) != 0)
+ {
+ return (FAIL);
+ }
+
+ /*Setup SECURITY_ATTRIBUTES structure for CreatePipe*/
+ lpPipeAttributes.nLength = sizeof(lpPipeAttributes);
+ lpPipeAttributes.lpSecurityDescriptor = NULL;
+ lpPipeAttributes.bInheritHandle = TRUE;
+
+ /*Create a Pipe*/
+ bRetVal = CreatePipe(&hReadPipe, // read handle
+ &hWritePipe, // write handle
+ &lpPipeAttributes, // security attributes
+ 0); // pipe size
+
+ if (bRetVal == FALSE)
+ {
+ Fail("ERROR: unable to create pipe");
+ }
+
+ /*Write to the write pipe handle*/
+ bRetVal = WriteFile(hWritePipe, // handle to file
+ cTestString, // data buffer
+ (DWORD)strlen(cTestString), // number of bytes to write
+ &dwBytesWritten, // number of bytes written
+ NULL); // overlapped buffer
+
+ if (bRetVal == FALSE)
+ {
+ Fail("ERROR: unable to write to pipe write handle "
+ "hWritePipe=0x%lx", hWritePipe);
+ }
+
+ /*Get a file descriptor for the read pipe handle*/
+ iFiledes = _open_osfhandle((long)hReadPipe, _O_RDONLY);
+
+ if (iFiledes == -1)
+ {
+ Fail("ERROR: _open_osfhandle failed to open "
+ " hReadPipe=0x%lx", hReadPipe);
+ }
+
+ /*Open read pipe handle in read mode*/
+ fp = _fdopen(iFiledes, "r");
+
+ if (fp == NULL)
+ {
+ Fail("ERROR: unable to fdopen file descriptor"
+ " iFiledes=%d", iFiledes);
+ }
+
+ /*Read from the read pipe handle*/
+ if((fread(buffer, sizeof(char), strlen(cTestString), fp)) == 0)
+ {
+ Fail("ERROR: Unable to read from file stream fp=0x%lx\n", fp);
+ }
+
+ /*Compare what was read with what was written.*/
+ if ((memcmp(cTestString, buffer, strlen(cTestString))) != 0)
+ {
+ Fail("ERROR: read \"%s\" expected \"%s\" \n", buffer, cTestString);
+ }
+
+ /*Close the file handle*/
+ if (_close(iFiledes) != 0)
+ {
+ Fail("ERROR: Unable to close file handle iFiledes=%d\n", iFiledes);
+ }
+
+ PAL_Terminate();
+ return (PASS);
+}
diff --git a/src/pal/tests/palsuite/c_runtime/_fdopen/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_fdopen/test1/testinfo.dat
new file mode 100644
index 0000000000..89e48bb4c1
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_fdopen/test1/testinfo.dat
@@ -0,0 +1,23 @@
+# Licensed to the .NET Foundation under one or more 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 = fdopen
+Name = test for fdopen and _close
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Tests the PAL implementation of the fdopen function.
+= This will test fdopen in r (read) mode. This test
+= creates and opens a test pipe, to write and read
+= from. fdopen requires a file handle(int), therefore
+= _open_osfhandle is used to get that handle.
+= _open_osfhandle is only used with CreatePipe. The
+= test will write and read from the pipe comparing
+= the results.
+= As a secondary test, _close is tested since it needs
+= the handle returned by _open_osfhandle. The handle is
+= closed, then a read is attempted on the handle which
+= should fail.
diff --git a/src/pal/tests/palsuite/c_runtime/_finite/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_finite/CMakeLists.txt
new file mode 100644
index 0000000000..5e1ef7f28b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_finite/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/_finite/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_finite/test1/CMakeLists.txt
new file mode 100644
index 0000000000..8aca58a8dc
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_finite/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_finite_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_finite_test1 coreclrpal)
+
+target_link_libraries(paltest_finite_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_finite/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_finite/test1/test1.c
new file mode 100644
index 0000000000..c815055b38
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_finite/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 _finite correctly classifies all types
+** of floating point numbers (NaN, -Infinity, Infinity,
+** finite nonzero, unnormalized, 0, and -0)
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+/*
+The IEEE double precision floating point standard looks like this:
+
+ S EEEEEEEEEEE FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
+ 0 1 11 12 63
+
+S is the sign bit. The E bits are the exponent, and the 52 F bits are
+the fraction. These represent a value, V.
+
+If E=2047 and F is nonzero, then V=NaN ("Not a number")
+If E=2047 and F is zero and S is 1, then V=-Infinity
+If E=2047 and F is zero and S is 0, then V=Infinity
+If 0<E<2047 then V=(-1)^S * 2^(E-1023) * (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^(-1022) * (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_DOUBLE(x) (*((double*)((void*)&x)))
+
+int __cdecl main(int argc, char **argv)
+{
+ /*non-finite numbers*/
+ UINT64 lsnan = UI64(0xffffffffffffffff);
+ UINT64 lqnan = UI64(0x7fffffffffffffff);
+ UINT64 lneginf = UI64(0xfff0000000000000);
+ UINT64 lposinf = UI64(0x7ff0000000000000);
+
+ double snan = TO_DOUBLE(lsnan);
+ double qnan = TO_DOUBLE(lqnan);
+ double neginf = TO_DOUBLE(lneginf);
+ double posinf = TO_DOUBLE(lposinf);
+
+ /*finite numbers*/
+ UINT64 lnegunnormalized = UI64(0x800fffffffffffff);
+ UINT64 lposunnormalized = UI64(0x000fffffffffffff);
+ UINT64 lnegzero = UI64(0x8000000000000000);
+
+ double negunnormalized = TO_DOUBLE(lnegunnormalized);
+ double posunnormalized = TO_DOUBLE(lposunnormalized);
+ double negzero = TO_DOUBLE(lnegzero);
+
+ /*
+ * Initialize the PAL and return FAIL if this fails
+ */
+ if (PAL_Initialize(argc, argv) != 0)
+ {
+ return FAIL;
+ }
+
+ /*non-finite numbers*/
+ if (_finite(snan) || _finite(qnan))
+ {
+ Fail("_finite() found NAN to be finite.\n");
+ }
+
+ if (_finite(neginf))
+ {
+ Fail("_finite() found negative infinity to be finite.\n");
+ }
+
+ if (_finite(posinf))
+ {
+ Fail("_finite() found infinity to be finite.\n");
+ }
+
+ /*finite numbers*/
+ if (!_finite(negunnormalized))
+ {
+ Fail("_finite() found a negative unnormalized value to be infinite.\n");
+ }
+
+ if (!_finite(posunnormalized))
+ {
+ Fail("_finite() found an unnormalized value to be infinite.\n");
+ }
+
+ if (!_finite(negzero))
+ {
+ Fail("_finite() found negative zero to be infinite.\n");
+ }
+
+ if (!_finite(+0.0))
+ {
+ Fail("_finite() found zero to be infinite.\n");
+ }
+
+ if (!_finite(-123.456))
+ {
+ Fail("_finite() found %f to be infinite.\n", -123.456);
+ }
+
+ if (!_finite(+123.456))
+ {
+ Fail("_finite() found %f to be infinite.\n", +123.456);
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/_finite/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_finite/test1/testinfo.dat
new file mode 100644
index 0000000000..cec0f8ae4a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_finite/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 = _finite
+Name = Positive Test for _finite
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Checks that _finite 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/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_fullpath/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_fullpath/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/_fullpath/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_fullpath/test1/CMakeLists.txt
new file mode 100644
index 0000000000..9306efa700
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_fullpath/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_fullpath_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fullpath_test1 coreclrpal)
+
+target_link_libraries(paltest_fullpath_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_fullpath/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_fullpath/test1/test1.c
new file mode 100644
index 0000000000..f390f4309b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_fullpath/test1/test1.c
@@ -0,0 +1,181 @@
+// Licensed to the .NET Foundation under one or more 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: _fullpath/test1/test1.c
+**
+** Purpose: Test to see if the _fullpath function returns the
+** proper values. A check is done to ensure NULL is returned
+** by _fullpath only for the condition where the length of the
+** created absolute path name (absPath) is greater than
+** maxLength.
+**
+** Dependencies: strlen
+** strncmp
+** SetCurrentDirectory
+** GetCurrentDirectory
+**
+
+**
+**=========================================================*/
+
+#include <palsuite.h>
+
+struct testcase
+{
+ char relPath[50]; /* relative path array */
+ int maxLength; /* pathlength to pass */
+ BOOL bRet; /* TRUE if testcase expects function to return NULL */
+};
+
+int __cdecl main( int argc, char **argv )
+{
+
+ DWORD dwOrigDirLength;
+ DWORD dwNewDirLength;
+ DWORD dwRetStrLength;
+ BOOL bRet;
+ char *retPath;
+ char szAbsPath[_MAX_PATH + 1];
+ char szDirNameOWD[_MAX_DIR];
+ char szDirNameNWD[_MAX_DIR];
+ int i;
+
+ struct testcase testcases[]=
+ {
+ {"." , _MAX_PATH, FALSE},
+ {".." , _MAX_PATH, FALSE},
+ {"..\\..", _MAX_PATH, FALSE},
+ {"..\\..\\..", _MAX_PATH, FALSE},
+ {"..", 1, TRUE}
+ };
+
+ if(0 != (PAL_Initialize(argc, argv)))
+ {
+ return ( FAIL );
+ }
+
+ for (i = 0; i < sizeof(testcases)/sizeof(struct testcase) ; i++)
+ {
+
+ /* reset variables */
+ memset(szAbsPath, 0, _MAX_PATH + 1);
+ memset(szDirNameOWD, 0, _MAX_DIR);
+ memset(szDirNameNWD, 0, _MAX_DIR);
+
+ dwOrigDirLength = 0;
+ dwNewDirLength = 0;
+ dwRetStrLength = 0;
+
+ /* Get the current directory name */
+ dwOrigDirLength = GetCurrentDirectory(_MAX_PATH, szDirNameOWD);
+ if (0 == dwOrigDirLength)
+ {
+ Fail ("PALSUITE ERROR: _fullpath (char *, %s, %d) test failed."
+ "\nGetCurrentDirectory (%d, %s) call failed. GetLastError"
+ " returned '%d'\n", testcases[i].relPath,
+ testcases[i].maxLength, _MAX_PATH, szDirNameOWD,
+ GetLastError());
+ }
+
+ /*
+ * Set the current directory to relPath.
+ */
+ bRet = SetCurrentDirectory(testcases[i].relPath);
+ if (0 == bRet)
+ {
+ Fail ("PALSUITE ERROR: _fullpath (char *, %s, %d) test failed."
+ "\nSetCurrentDirectory (%s) call failed. GetLastError"
+ " returned '%d'\n", testcases[i].relPath,
+ testcases[i].maxLength, testcases[i].relPath,
+ GetLastError());
+ }
+
+ /* Get the new current directory name */
+ dwNewDirLength = GetCurrentDirectory(_MAX_PATH, szDirNameNWD);
+ if (0 == dwNewDirLength)
+ {
+ Fail ("PALSUITE ERROR: _fullpath (char *, %s, %d) test failed."
+ "\nGetCurrentDirectory(%d, %s) call failed. GetLastError"
+ " returned '%d'\n", testcases[i].relPath,
+ testcases[i].maxLength, _MAX_PATH, szDirNameNWD,
+ GetLastError());
+ }
+
+ /* Set the current directory back to the original one */
+ bRet = SetCurrentDirectory(szDirNameOWD);
+ if (0 == bRet)
+ {
+ Fail ("PALSUITE ERROR: _fullpath (char *, %s, %d) test failed."
+ "\nSetCurrentDirectory(%s) call failed. GetLastError"
+ " returned '%d'\n", testcases[i].relPath,
+ testcases[i].maxLength, szDirNameOWD, GetLastError());
+ }
+
+ retPath = _fullpath( szAbsPath,
+ testcases[i].relPath,
+ testcases[i].maxLength );
+
+ if ( NULL == retPath )
+ {
+ /* The function returned NULL when a value was expected */
+ if ( FALSE == testcases[i].bRet )
+ {
+ Fail("PALSUITE ERROR: test failed.\n"
+ "_fullpath (char *, %s, %d) returned NULL\n"
+ "when '%s' was expected\n", testcases[i].relPath,
+ testcases[i].maxLength, szDirNameNWD );
+ }
+ }
+ else
+ {
+ dwRetStrLength = strlen ( szAbsPath );
+
+ /* Check that the path lengths are identical. */
+ if ( dwRetStrLength != dwNewDirLength )
+ {
+ Fail ("PALSUITE ERROR: _fullpath (char *, %s, %d) test failed."
+ "\ndwRetStringLength '%d' is not equal to "
+ "dwNewDirLength '%d'.\nszAbsPath is '%s' retPath is '%s'\n"
+ "szDirNameNWD is '%s'\n" , testcases[i].relPath,
+ testcases[i].maxLength, dwRetStrLength ,dwNewDirLength
+ ,szAbsPath ,retPath ,szDirNameNWD);
+ }
+
+ /*
+ * Perform a string comparison on the path provided by
+ * GetCurrentDirectory and the path provided by _fullpath
+ * to ensure they are identical.
+ */
+ if ( 0 != strncmp( szDirNameNWD, szAbsPath, dwNewDirLength ))
+ {
+ Fail ("PALSUITE ERROR: _fullpath (char *, %s, %d) test failed."
+ "strncmp ( %s, %s, %d ) call failed.\n",
+ testcases[i].relPath, testcases[i].maxLength,
+ szDirNameNWD, szAbsPath, dwNewDirLength );
+ }
+
+ /*
+ * Perform a string comparison on both paths provided by
+ * _fullpath to ensure they are identical.
+ */
+ if ( 0 != strncmp( retPath, szAbsPath, dwNewDirLength ))
+ {
+ Fail ("PALSUITE ERROR: _fullpath (char *, %s, %d) test failed."
+ "strncmp ( %s, %s, %d ) call failed.\n",
+ testcases[i].relPath, testcases[i].maxLength,
+ szDirNameNWD, szAbsPath, dwNewDirLength );
+ }
+ }
+ }
+
+ PAL_Terminate();
+ return ( PASS );
+}
+
+
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/_fullpath/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_fullpath/test1/testinfo.dat
new file mode 100644
index 0000000000..cd4db831a4
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_fullpath/test1/testinfo.dat
@@ -0,0 +1,23 @@
+# Licensed to the .NET Foundation under one or more 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 = _fullpath
+Name = Positive Test for _fullpath
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Test to see if the _fullpath function returns the
+= proper values. A check is done to ensure NULL is returned
+= by _fullpath only for the condition where the length of the
+= created absolute path name (absPath) is greater than
+= maxLength.
+
+
+
+
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/_gcvt/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_gcvt/CMakeLists.txt
new file mode 100644
index 0000000000..ef14ea5352
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_gcvt/CMakeLists.txt
@@ -0,0 +1,5 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+add_subdirectory(test2)
+
diff --git a/src/pal/tests/palsuite/c_runtime/_gcvt/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_gcvt/test1/CMakeLists.txt
new file mode 100644
index 0000000000..33eb5cf19c
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_gcvt/test1/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ _gcvt.c
+)
+
+add_executable(paltest_gcvt_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_gcvt_test1 coreclrpal)
+
+target_link_libraries(paltest_gcvt_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_gcvt/test1/_gcvt.c b/src/pal/tests/palsuite/c_runtime/_gcvt/test1/_gcvt.c
new file mode 100644
index 0000000000..ccfc286898
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_gcvt/test1/_gcvt.c
@@ -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: _gcvt.c
+**
+** Purpose: Positive test the _gcvt API.
+** Call _gcvt to convert a floatable value to a string
+** with specified sigficant digits stored
+**
+**
+**============================================================*/
+#include <palsuite.h>
+
+int __cdecl main(int argc, char *argv[])
+{
+ int err;
+ double dValue = -3.1415926535;
+ char buffer[1024];
+ char *pChar7 = "-3.141593";
+
+ /*Initialize the PAL environment*/
+ err = PAL_Initialize(argc, argv);
+ if(0 != err)
+ {
+ return FAIL;
+ }
+
+
+ /* zero the buffer */
+ memset(buffer, 0, 1024);
+
+
+ /*
+
+ Testing
+ =======
+
+ To convert a floating-point value to
+ a string to save 7 significant digits
+ */
+ _gcvt(dValue, 7, buffer);
+ if(strcmp(pChar7, buffer))
+ {
+ Fail("\nFailed to call _gcvt to convert a floating-point value "
+ "to a string with 7 sigficants digits stored\n");
+ }
+
+
+ /*
+ Clean up and exit
+ */
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/_gcvt/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_gcvt/test1/testinfo.dat
new file mode 100644
index 0000000000..d527418108
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_gcvt/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 = _gcvt
+Name = Positive test for _gcvt API to convert a floatable value to a string
+TYPE = DEFAULT
+EXE1 = _gcvt
+Description
+=Test the _gcvt to convert a floatable value to a string
+=with specified sigficant digits stored
diff --git a/src/pal/tests/palsuite/c_runtime/_gcvt/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_gcvt/test2/CMakeLists.txt
new file mode 100644
index 0000000000..05641b9b78
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_gcvt/test2/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test2.c
+)
+
+add_executable(paltest_gcvt_test2
+ ${SOURCES}
+)
+
+add_dependencies(paltest_gcvt_test2 coreclrpal)
+
+target_link_libraries(paltest_gcvt_test2
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_gcvt/test2/test2.c b/src/pal/tests/palsuite/c_runtime/_gcvt/test2/test2.c
new file mode 100644
index 0000000000..7ac9a4fcf0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_gcvt/test2/test2.c
@@ -0,0 +1,83 @@
+// Licensed to the .NET Foundation under one or more 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: Call the _gcvt function on a number of cases. Check that it
+** handles negatives, exponents and hex digits properly. Also check that
+** the 'digit' specification works. (And that it doesn't truncate negative
+** signs or decimals)
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+struct testCase
+{
+ double Value;
+ int Digits;
+ char WinCorrectResult[128];
+ char BsdCorrectResult[128]; /* for the odd case where bsd sprintf
+ varies from windows sprintf */
+};
+
+int __cdecl main(int argc, char **argv)
+{
+ char result[128];
+ int i=0;
+
+ struct testCase testCases[] =
+ {
+ {1234567, 7, "1234567"},
+ {1234.123, 7, "1234.123"},
+ {1234.1234, 7, "1234.123"},
+ {12.325678e+2, 7, "1232.568"},
+ {-12.3233333, 8, "-12.323333"},
+ {-12.32, 8, "-12.32"},
+ {-12.32e+2, 8, "-1232.", "-1232" },
+ {0x21DDFABC, 8, "5.6819577e+008", "5.6819577e+08" },
+ {123456789012345.0, 15, "123456789012345" },
+ {12340000.0, 8, "12340000"},
+ {12340000000000000.0, 15, "1.234e+016", "1.234e+16" },
+ {12340000000000000.0, 17, "12340000000000000" },
+
+ };
+
+ if (0 != (PAL_Initialize(argc, argv)))
+ {
+ return FAIL;
+ }
+
+ /* Loop through each case. Call _gcvt on each test case and check the
+ result.
+ */
+
+ for(i = 0; i < sizeof(testCases) / sizeof(struct testCase); i++)
+ {
+ _gcvt(testCases[i].Value, testCases[i].Digits, result);
+
+ if (strcmp(testCases[i].WinCorrectResult, result) != 0 &&
+
+ ( testCases[i].BsdCorrectResult &&
+ strcmp(testCases[i].BsdCorrectResult, result) != 0 ) )
+ {
+ Fail("ERROR: _gcvt attempted to convert %f with %d digits "
+ "signifigant, which resulted in "
+ "the string '%s' instead of the correct(Win) string '%s' or the"
+ "correct(bsd) string '%s'.\n",
+ testCases[i].Value,
+ testCases[i].Digits,
+ result,
+ testCases[i].WinCorrectResult,
+ testCases[i].BsdCorrectResult);
+ }
+
+ memset(result, '\0', 128);
+ }
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/_gcvt/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_gcvt/test2/testinfo.dat
new file mode 100644
index 0000000000..e9e192849a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_gcvt/test2/testinfo.dat
@@ -0,0 +1,15 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = _gcvt
+Name = Call _gcvt on normal values, negatives, exponents and hex digits.
+TYPE = DEFAULT
+EXE1 = test2
+Description
+= Call the _gcvt function on a number of cases. Check that it
+= handles negatives, exponents and hex digits properly. Also check that
+= the 'digit' specification works. (And that it doesn't truncate negative
+= signs or decimals)
diff --git a/src/pal/tests/palsuite/c_runtime/_getw/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_getw/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_getw/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/_getw/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_getw/test1/CMakeLists.txt
new file mode 100644
index 0000000000..d44477b232
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_getw/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_getw_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_getw_test1 coreclrpal)
+
+target_link_libraries(paltest_getw_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_getw/test1/test.dat b/src/pal/tests/palsuite/c_runtime/_getw/test1/test.dat
new file mode 100644
index 0000000000..b20eae054c
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_getw/test1/test.dat
Binary files differ
diff --git a/src/pal/tests/palsuite/c_runtime/_getw/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_getw/test1/test1.c
new file mode 100644
index 0000000000..34ce4ee7de
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_getw/test1/test1.c
@@ -0,0 +1,96 @@
+// Licensed to the .NET Foundation under one or more 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: Several integers are read from a previously written file
+** using _getw. The test passes if the values read match those known to
+** be in the file.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+/*Tests _getw using a previously written data file */
+int __cdecl main(int argc, char **argv)
+{
+ const int testValues[] =
+ {
+ 0,
+ 1,
+ -1,
+ 0x7FFFFFFF, /* largest positive integer on 32 bit systems */
+ 0x80000000, /* largest negative integer on 32 bit systems */
+ 0xFFFFFFFF,
+ 0xFFFFAAAA
+ };
+
+ int i = 0;
+ int input = 0;
+
+ const char filename[] = "test.dat";
+
+
+ FILE *fp = NULL;
+
+ /*
+ * 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 */
+
+
+ /*
+ Don't uncomment this code, it was used to create the data file
+ initially on windows, but if it is run on all test platforms, the
+ tests will always pass.
+
+ fp = fopen(filename, "w");
+ if (fp == NULL)
+ {
+ Fail("Unable to open file for write.\n");
+ }
+ for (i = 0; i < sizeof(testValues) / sizeof(testValues[0]); i++)
+ {
+ _putw(testValues[i], fp);
+ }
+
+ if (fclose(fp) != 0)
+ {
+ Fail("Error closing file after writing to it with _putw.\n");
+ }
+ */
+
+
+ /*Now read values back from the file and see if they match.*/
+ fp = fopen(filename, "r");
+ if (fp == NULL)
+ {
+ Fail ("Unable to open file for read.\n");
+ }
+ for (i = 0; i < sizeof(testValues) / sizeof(testValues[0]); i++)
+ {
+ input = _getw(fp);
+ if (VAL32(input) != testValues[i])
+ {
+ Fail ("_getw did not get the expected values when reading "
+ "from a file.\n");
+ }
+ }
+
+ if (fclose(fp) != 0)
+ {
+ Fail ("Error closing file after reading from it with _getw\n");
+ }
+ PAL_Terminate();
+ return PASS;
+}
+
diff --git a/src/pal/tests/palsuite/c_runtime/_getw/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_getw/test1/testinfo.dat
new file mode 100644
index 0000000000..4044dadbcc
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_getw/test1/testinfo.dat
@@ -0,0 +1,15 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = _getw
+Name = Positive Test for _getw
+TYPE = DEFAULT
+EXE1 = test1
+Description
+=Several integers are read from a previously written file
+=using _getw. The test passes if the values read match those known to
+=be in the file.
+
diff --git a/src/pal/tests/palsuite/c_runtime/_isnan/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_isnan/CMakeLists.txt
new file mode 100644
index 0000000000..5e1ef7f28b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_isnan/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/_isnan/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_isnan/test1/CMakeLists.txt
new file mode 100644
index 0000000000..e14d0cc64b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_isnan/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_isnan_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_isnan_test1 coreclrpal)
+
+target_link_libraries(paltest_isnan_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_isnan/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_isnan/test1/test1.c
new file mode 100644
index 0000000000..d793c9b371
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_isnan/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 _isnan 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_DOUBLE(x) (*((double*)((void*)&x)))
+#define TO_I64(x) (*((INT64*)((void*)&x)))
+
+/*
+ * NaN: any double with maximum exponent (0x7ff) 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 (_isnan(0.0))
+ {
+ Fail("_isnan() incorrectly identified %f as NaN!\n", 0.0);
+ }
+
+ if (_isnan(1.23456))
+ {
+ Fail("_isnan() incorrectly identified %f as NaN!\n", 1.234567);
+ }
+
+ if (_isnan(42.0))
+ {
+ Fail("_isnan() incorrectly identified %f as NaN!\n", 42.0);
+ }
+
+ UINT64 lneginf = UI64(0xfff0000000000000);
+ UINT64 lposinf = UI64(0x7ff0000000000000);
+
+ double neginf = TO_DOUBLE(lneginf);
+ double posinf = TO_DOUBLE(lposinf);
+
+ /*
+ * Try positive and negative infinity
+ */
+ if (_isnan(neginf))
+ {
+ Fail("_isnan() incorrectly identified negative infinity as NaN!\n");
+ }
+
+ if (_isnan(posinf))
+ {
+ Fail("_isnan() incorrectly identified infinity as NaN!\n");
+ }
+
+ /*
+ * Try setting the least significant bit of the fraction,
+ * positive and negative
+ */
+ UINT64 lsnan = UI64(0xfff0000000000001);
+ double snan = TO_DOUBLE(lsnan);
+
+ if (!_isnan(snan))
+ {
+ Fail("_isnan() failed to identify %I64x as NaN!\n", lsnan);
+ }
+
+ UINT64 lqnan = UI64(0x7ff0000000000001);
+ double qnan = TO_DOUBLE(lqnan);
+
+ if (!_isnan(qnan))
+ {
+ Fail("_isnan() failed to identify %I64x as NaN!\n", lqnan);
+ }
+
+ /*
+ * Try setting the most significant bit of the fraction,
+ * positive and negative
+ */
+ lsnan = UI64(0xfff8000000000000);
+ snan = TO_DOUBLE(lsnan);
+
+ if (!_isnan(snan))
+ {
+ Fail ("_isnan() failed to identify %I64x as NaN!\n", lsnan);
+ }
+
+ lqnan = UI64(0x7ff8000000000000);
+ qnan = TO_DOUBLE(lqnan);
+
+ if (!_isnan(qnan))
+ {
+ Fail ("_isnan() failed to identify %I64x as NaN!\n", lqnan);
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/_isnan/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_isnan/test1/testinfo.dat
new file mode 100644
index 0000000000..d5de17e219
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_isnan/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 = _isnan
+Name = Test #1 for _isnan
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Test _isnan 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/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_itow/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_itow/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/_itow/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_itow/test1/CMakeLists.txt
new file mode 100644
index 0000000000..bd37f31216
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_itow/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_itow_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_itow_test1 coreclrpal)
+
+target_link_libraries(paltest_itow_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_itow/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_itow/test1/test1.c
new file mode 100644
index 0000000000..745ce4acaa
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_itow/test1/test1.c
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more 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/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_itow/test1/testinfo.dat
new file mode 100644
index 0000000000..394c34dff3
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_itow/test1/testinfo.dat
@@ -0,0 +1,18 @@
+# Licensed to the .NET Foundation under one or more 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 = _itow
+Name = Positive Test for _itow
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= 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.
+
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/_makepath/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_makepath/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_makepath/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/_makepath/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_makepath/test1/CMakeLists.txt
new file mode 100644
index 0000000000..9fd81cce1a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_makepath/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_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
new file mode 100644
index 0000000000..94b366a7bb
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_makepath/test1/test1.c
@@ -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: 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
new file mode 100644
index 0000000000..2aed8e549b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_makepath/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 = _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/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_mbsdec/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_mbsdec/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/_mbsdec/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_mbsdec/test1/CMakeLists.txt
new file mode 100644
index 0000000000..064f241f24
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_mbsdec/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_mbsdec_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_mbsdec_test1 coreclrpal)
+
+target_link_libraries(paltest_mbsdec_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_mbsdec/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_mbsdec/test1/test1.c
new file mode 100644
index 0000000000..1cd7513293
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_mbsdec/test1/test1.c
@@ -0,0 +1,77 @@
+// Licensed to the .NET Foundation under one or more 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:
+** Ensure that this function moves the string pointer back one character.
+** First do a basic test to check that the pointer gets moved back the one
+** character, given str1 and str+1 as params. Then try with both
+** params being the same pointer, which should return NULL. Also test
+** when the first pointer is past the second pointer, which should
+** return null. Finally try this function on an array of single bytes,
+** which it assumes are characters and should work in the same fashion.
+**
+**
+**==========================================================================*/
+
+#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.
+ */
+
+int __cdecl main(int argc, char *argv[])
+{
+ unsigned char *str1 = (unsigned char*) "foo";
+ unsigned char str2[] = {0xC0, 0x80, 0xC0, 0x80, 0};
+ unsigned char str3[] = {0};
+ unsigned char *ret = NULL;
+
+ /*
+ * Initialize the PAL and return FAIL if this fails
+ */
+ if (0 != (PAL_Initialize(argc, argv)))
+ {
+ return FAIL;
+ }
+
+ ret = _mbsdec(str1,str1+1);
+ if (ret != str1)
+ {
+ Fail ("ERROR: _mbsdec returned %p. Expected %p\n", ret, str1);
+ }
+
+ ret = _mbsdec(str1,str1);
+ if (ret != NULL)
+ {
+ Fail ("ERROR: _mbsdec returned %p. Expected %p\n", ret, NULL);
+ }
+
+ ret = _mbsdec(str1+100,str1);
+ if (ret != NULL)
+ {
+ Fail ("ERROR: _mbsdec returned %p. Expected %p\n", ret, NULL);
+ }
+
+ ret = _mbsdec(str2,str2+1);
+ if (ret != str2)
+ {
+ Fail ("ERROR: _mbsdec returned %p. Expected %p\n", ret, str2+1);
+ }
+
+ ret = _mbsdec(str3,str3+10);
+ if (ret != str3+9)
+ {
+ Fail ("ERROR: _mbsdec returned %p. Expected %p\n", ret, str3+9);
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
+
diff --git a/src/pal/tests/palsuite/c_runtime/_mbsdec/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_mbsdec/test1/testinfo.dat
new file mode 100644
index 0000000000..ce2aa29aa5
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_mbsdec/test1/testinfo.dat
@@ -0,0 +1,18 @@
+# Licensed to the .NET Foundation under one or more 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 = _mbsdec
+Name = Positive Test for _mbsdec
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Ensure that this function moves the string pointer back one character.
+= First do a basic test to check that the pointer gets moved back the one
+= character, given str1 and str+1 as params. Then try with both
+= params being the same pointer, which should return NULL. Also test
+= when the first pointer is past the second pointer, which should
+= return null. Finally try this function on an array of single bytes,
+= which it assumes are characters and should work in the same fashion.
diff --git a/src/pal/tests/palsuite/c_runtime/_mbsinc/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_mbsinc/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_mbsinc/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/_mbsinc/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_mbsinc/test1/CMakeLists.txt
new file mode 100644
index 0000000000..531ba8e793
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_mbsinc/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_mbsinc_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_mbsinc_test1 coreclrpal)
+
+target_link_libraries(paltest_mbsinc_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_mbsinc/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_mbsinc/test1/test1.c
new file mode 100644
index 0000000000..95a5041af2
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_mbsinc/test1/test1.c
@@ -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:
+** Ensure that this function moves the string pointer ahead one character.
+** First do a basic test to check that the pointer gets moved ahead the one
+** character. Then try with an array of bytes and a NULL array. Each of
+** these should still work by returning a pointer to thePointer+1.
+**
+**
+**==========================================================================*/
+
+#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.
+ */
+
+int __cdecl main(int argc, char *argv[])
+{
+ unsigned char *str1 = (unsigned char*) "foo";
+ unsigned char str2[] = {0xC0, 0x80, 0xC0, 0x80, 0};
+ unsigned char str3[] = {0};
+ unsigned char *ret=NULL;
+
+ /*
+ * Initialize the PAL and return FAIL if this fails
+ */
+ if (0 != (PAL_Initialize(argc, argv)))
+ {
+ return FAIL;
+ }
+
+ ret = _mbsinc(str1);
+ if (ret != str1 + 1)
+ {
+ Fail ("ERROR: _mbsinc returned %p. Expected %p\n", ret, str1);
+ }
+
+ ret = _mbsinc(str2);
+ if (ret != str2 + 1)
+ {
+ Fail ("ERROR: _mbsinc returned %p. Expected %p\n", ret, str1);
+ }
+
+ ret = _mbsinc(str3);
+ if (ret != str3 + 1)
+ {
+ Fail ("ERROR: _mbsinc returned %p. Expected %p\n", ret, str1);
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
+
diff --git a/src/pal/tests/palsuite/c_runtime/_mbsinc/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_mbsinc/test1/testinfo.dat
new file mode 100644
index 0000000000..3f3883fa31
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_mbsinc/test1/testinfo.dat
@@ -0,0 +1,15 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = _mbsinc
+Name = Positive Test for _mbsinc
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Ensure that this function moves the string pointer ahead one character.
+= First do a basic test to check that the pointer gets moved ahead the one
+= character. Then try with an array of bytes and a NULL array. Each of
+= these should still work by returning a pointer to thePointer+1.
diff --git a/src/pal/tests/palsuite/c_runtime/_mbslen/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_mbslen/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_mbslen/CMakeLists.txt
@@ -0,0 +1,4 @@
+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
new file mode 100644
index 0000000000..38aa6fb16e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_mbslen/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_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
new file mode 100644
index 0000000000..fa24c77d8a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_mbslen/test1/test1.c
@@ -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:
+** 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
new file mode 100644
index 0000000000..cf830a7539
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_mbslen/test1/testinfo.dat
@@ -0,0 +1,15 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = 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/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_mbsninc/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_mbsninc/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/_mbsninc/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_mbsninc/test1/CMakeLists.txt
new file mode 100644
index 0000000000..7285ce229e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_mbsninc/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_mbsninc_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_mbsninc_test1 coreclrpal)
+
+target_link_libraries(paltest_mbsninc_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_mbsninc/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_mbsninc/test1/test1.c
new file mode 100644
index 0000000000..59ef50dcc3
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_mbsninc/test1/test1.c
@@ -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: test1.c
+**
+** Purpose:
+** Ensure that this functions increases a string pointer by n characters.
+** Use a for loop, and increase the pointer by a different number of characters
+** on each iteration, ensure that it is indeed pointing to the correct location
+** each time. The second test checks to see if you attempt to increase the
+** pointer past the end of the string, the pointer should just point at the
+** last character.
+**
+**
+**==========================================================================*/
+
+#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.
+ */
+
+int __cdecl main(int argc, char *argv[])
+{
+ unsigned char str[] = {0xC0, 0x80, 0xC0, 0x80, 0};
+ int i=0;
+ unsigned char *ret=NULL;
+
+ /*
+ * Initialize the PAL and return FAIL if this fails
+ */
+ if (0 != (PAL_Initialize(argc, argv)))
+ {
+ return FAIL;
+ }
+
+ for (i=0; i<5; i++)
+ {
+ ret = _mbsninc(str, i);
+ if (ret != str + i)
+ {
+ Fail ("ERROR: _mbsninc returned %p. Expected %p\n", ret, str+i);
+ }
+ }
+
+ /*
+ * trying to advance past the end of the string should just
+ * return the end.
+ */
+ ret = _mbsninc(str, 5);
+ if (ret != str + 4)
+ {
+ Fail ("ERROR: _mbsninc returned %p. Expected %p\n", ret, str+4);
+ }
+
+
+ PAL_Terminate();
+ return PASS;
+}
+
diff --git a/src/pal/tests/palsuite/c_runtime/_mbsninc/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_mbsninc/test1/testinfo.dat
new file mode 100644
index 0000000000..b855222af9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_mbsninc/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 = _mbsninc
+Name = Positive Test for _mbsninc
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Ensure that this functions increases a string pointer by n characters.
+= Use a for loop, and increase the pointer by a different number of characters
+= on each iteration, ensure that it is indeed pointing to the correct location
+= each time. The second test checks to see if you attempt to increase the
+= pointer past the end of the string, the pointer should just point at the
+= last character.
diff --git a/src/pal/tests/palsuite/c_runtime/_open_osfhandle/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_open_osfhandle/CMakeLists.txt
new file mode 100644
index 0000000000..ef14ea5352
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_open_osfhandle/CMakeLists.txt
@@ -0,0 +1,5 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+add_subdirectory(test2)
+
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
new file mode 100644
index 0000000000..e9a3e29192
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_open_osfhandle/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_open_osfhandle_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_open_osfhandle_test1 coreclrpal)
+
+target_link_libraries(paltest_open_osfhandle_test1
+ pthread
+ m
+ coreclrpal
+)
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.c
new file mode 100644
index 0000000000..ee2c8ea418
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_open_osfhandle/test1/test1.c
@@ -0,0 +1,132 @@
+// Licensed to the .NET Foundation under one or more 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 (_open_osfhandle)
+**
+** Purpose: Tests the PAL implementation of the _open_osfhandle function.
+** This API accepts a OS Handle returned from CreatePipe() and
+** a flag of _O_RDONLY and returns a C Run-Time handle. The test
+** will write to the pipe and pass the C Run-Time handle to _fdopen
+** to open the Read Handle to compare what was written with what
+** was wrote. They should be the same.
+**
+** Depends: CreatePipe
+** WriteFile
+** _fdopen
+** fread
+** memcmp
+** fclose
+** strlen
+** CloseHandle
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+const char* cTestString = "one fish, two fish, red fish, blue fish.";
+
+int __cdecl main(int argc, char **argv)
+{
+ HANDLE hReadPipe = NULL;
+ HANDLE hWritePipe = NULL;
+ BOOL bRetVal = FALSE;
+ int iFiledes = 0;
+ DWORD dwBytesWritten;
+ char buffer[45];
+ FILE *fp;
+ size_t len;
+
+ SECURITY_ATTRIBUTES lpPipeAttributes;
+
+ /*Initialize the PAL*/
+ if ((PAL_Initialize(argc, argv)) != 0)
+ {
+ return (FAIL);
+ }
+
+ /*Setup SECURITY_ATTRIBUTES structure for CreatePipe*/
+ lpPipeAttributes.nLength = sizeof(lpPipeAttributes);
+ lpPipeAttributes.lpSecurityDescriptor = NULL;
+ lpPipeAttributes.bInheritHandle = TRUE;
+
+ /*Create a Pipe*/
+ bRetVal = CreatePipe(&hReadPipe, /* read handle*/
+ &hWritePipe, /* write handle */
+ &lpPipeAttributes, /* security attributes*/
+ 0); /* pipe size*/
+ if (bRetVal == FALSE)
+ {
+ Fail("ERROR: unable to create pipe");
+ }
+
+ /*Write to the write pipe handle*/
+ bRetVal = WriteFile(hWritePipe, /* handle to file*/
+ cTestString, /* data buffer*/
+ strlen(cTestString),/* number of bytes to write*/
+ &dwBytesWritten, /* number of bytes written*/
+ NULL); /* overlapped buffer*/
+ if (bRetVal == FALSE)
+ {
+ Fail("ERROR: unable to write to pipe write handle "
+ "hWritePipe=0x%lx", hWritePipe);
+ }
+
+ /*Test to see if the WriteFile wrote the correct amount*/
+ if(dwBytesWritten != strlen(cTestString))
+ {
+ Fail("Error: WriteFile wrote \"%d\", should have written \"%d\\n",
+ dwBytesWritten, strlen(cTestString));
+ }
+
+ /*Get a file descriptor for the read pipe handle.
+ *This is what we are testing.*/
+ iFiledes = _open_osfhandle((long)hReadPipe, _O_RDONLY);
+ if (iFiledes == -1)
+ {
+ Fail("ERROR: _open_osfhandle failed to open "
+ " hReadPipe=0x%lx", hReadPipe);
+ }
+
+ /*Open read pipe handle in read mode.
+ *Verify that we have returned a correct,
+ *C Run-time handle*/
+ fp = _fdopen(iFiledes, "r");
+ if (fp == NULL)
+ {
+ Fail("ERROR: unable to fdopen file descriptor"
+ " iFiledes=%d", iFiledes);
+ }
+
+ /*Read from the read pipe handle*/
+ len = fread(buffer, sizeof(char), strlen(cTestString), fp);
+ if((len == 0) || (len != strlen(cTestString)))
+ {
+ Fail("ERROR: Unable to read from file stream fp=0x%lx\n", fp);
+ }
+
+ /*Compare what was read with what was written.*/
+ if ((memcmp(cTestString, buffer, strlen(cTestString))) != 0)
+ {
+ Fail("ERROR: read \"%s\" expected \"%s\" \n", buffer, cTestString);
+ }
+
+ /*Close write pipe handle*/
+ if (CloseHandle(hWritePipe) == 0)
+ {
+ Fail("ERROR: Unable to close write pipe handle "
+ "hWritePipe=0x%lx", hWritePipe);
+ }
+
+ if ((fclose(fp)) != 0)
+ {
+ Fail("ERROR: Unable to close C-Runtime handle "
+ "iFilesdes=%d", iFiledes);
+ }
+
+ PAL_Terminate();
+ return (PASS);
+}
diff --git a/src/pal/tests/palsuite/c_runtime/_open_osfhandle/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_open_osfhandle/test1/testinfo.dat
new file mode 100644
index 0000000000..16317bb188
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_open_osfhandle/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 = _open_osfhandle
+Name = Test for _open_osfhandle
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Tests the PAL implementation of the _open_osfhandle function.
+= This API accepts a OS Handle returned from CreatePipe() and
+= a flag of _O_RDONLY and returns a C Run-Time handle. The test
+= will write to the pipe and pass the C Run-Time handle to _fdopen
+= to open the Read Handle to compare what was written with what
+= was wrote. They should be the same.
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
new file mode 100644
index 0000000000..1031ec1df9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_open_osfhandle/test2/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test2.c
+)
+
+add_executable(paltest_open_osfhandle_test2
+ ${SOURCES}
+)
+
+add_dependencies(paltest_open_osfhandle_test2 coreclrpal)
+
+target_link_libraries(paltest_open_osfhandle_test2
+ pthread
+ m
+ coreclrpal
+)
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.c
new file mode 100644
index 0000000000..6c756b177a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_open_osfhandle/test2/test2.c
@@ -0,0 +1,86 @@
+// Licensed to the .NET Foundation under one or more 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 (_open_osfhandle)
+**
+** Purpose: Tests the PAL implementation of the _open_osfhandle function.
+** This API accepts a OS Handle returned from CreatePipe() and
+** a flag of _O_RDONLY and returns a C Run-Time handle. The test
+** will pass a NULL handle, and unsupported flags. All cases
+** should fail.
+**
+** Depends: CreatePipe
+** CloseHandle
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char **argv)
+{
+ HANDLE hReadPipe = NULL;
+ HANDLE hWritePipe = NULL;
+ BOOL bRetVal = FALSE;
+ int iFiledes = 0;
+
+ SECURITY_ATTRIBUTES lpPipeAttributes;
+
+ /*Initialize the PAL*/
+ if ((PAL_Initialize(argc, argv)) != 0)
+ {
+ return (FAIL);
+ }
+
+ /*Setup SECURITY_ATTRIBUTES structure for CreatePipe*/
+ lpPipeAttributes.nLength = sizeof(lpPipeAttributes);
+ lpPipeAttributes.lpSecurityDescriptor = NULL;
+ lpPipeAttributes.bInheritHandle = TRUE;
+
+ /*Create a Pipe*/
+ bRetVal = CreatePipe(&hReadPipe, /* read handle*/
+ &hWritePipe, /* write handle */
+ &lpPipeAttributes, /* security attributes*/
+ 0); /* pipe size*/
+ if (bRetVal == FALSE)
+ {
+ Fail("ERROR: unable to create pipe");
+ }
+
+ /*Close write pipe handle*/
+ if (CloseHandle(hWritePipe) == 0)
+ {
+ Fail("ERROR: Unable to close write pipe handle "
+ "hWritePipe=0x%lx", hWritePipe);
+ }
+
+ /*Close read pipe handle*/
+ if (CloseHandle(hReadPipe) == 0)
+ {
+ Fail("ERROR: Unable to close read pipe handle "
+ "hReadPipe=0x%lx", hReadPipe);
+ }
+
+ /*Test with a Closed handle and supported flag _O_RDONLY*/
+ iFiledes = _open_osfhandle((long)hReadPipe, _O_RDONLY);
+ if (iFiledes != -1)
+ {
+ Fail("ERROR: _open_osfhandle successfullly opened "
+ " hReadPipe which was closed, with _O_RDONLY");
+ }
+
+ /*Test with a NULL handle and supported flag _O_RDONLY*/
+ hReadPipe = NULL;
+ iFiledes = _open_osfhandle((long)hReadPipe, _O_RDONLY);
+ if (iFiledes != -1)
+ {
+ Fail("ERROR: _open_osfhandle successfullly opened "
+ " hReadPipe=NULL with _O_RDONLY");
+ }
+
+ PAL_Terminate();
+ return (PASS);
+}
diff --git a/src/pal/tests/palsuite/c_runtime/_open_osfhandle/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_open_osfhandle/test2/testinfo.dat
new file mode 100644
index 0000000000..822e23fedd
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_open_osfhandle/test2/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 = _open_osfhandle
+Name = Fail test for _open_osfhandle
+TYPE = DEFAULT
+EXE1 = test2
+Description
+= Tests the PAL implementation of the _open_osfhandle function.
+= This API accepts a OS Handle returned from CreatePipe() and
+= a flag of _O_RDONLY and returns a C Run-Time handle. The test
+= will pass a NULL handle, and unsupported flags. All cases
+= should fail.
diff --git a/src/pal/tests/palsuite/c_runtime/_putenv/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_putenv/CMakeLists.txt
new file mode 100644
index 0000000000..a3847f8ca9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_putenv/CMakeLists.txt
@@ -0,0 +1,7 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+add_subdirectory(test2)
+add_subdirectory(test3)
+add_subdirectory(test4)
+
diff --git a/src/pal/tests/palsuite/c_runtime/_putenv/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_putenv/test1/CMakeLists.txt
new file mode 100644
index 0000000000..0a75b41113
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_putenv/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_putenv_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_putenv_test1 coreclrpal)
+
+target_link_libraries(paltest_putenv_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_putenv/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_putenv/test1/test1.c
new file mode 100644
index 0000000000..2d096adc78
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_putenv/test1/test1.c
@@ -0,0 +1,99 @@
+// Licensed to the .NET Foundation under one or more 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: Create an environment variable with _putenv and then use getenv
+** to check it. Check that we get the expected errors with invalid input.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+struct TestElement
+{
+ char _putenvString[1024]; /* argument string sent to putenv */
+ char varName[1024]; /* variable component of argument string */
+ char varValue[1024]; /* value component of argument string */
+ BOOL bValidString; /* valid argument string identifier */
+};
+
+struct TestElement TestCases[] =
+{
+ {"PalTestingEnvironmentVariable=A value", "PalTestingEnvironmentVariable",
+ "A value", TRUE},
+ {"AnotherVariable=", "AnotherVariable", "", TRUE},
+ {"YetAnotherVariable", "", "", FALSE},
+ {"=ADifferentVariable", "", "ADifferentVariable", FALSE},
+ {"", "", "", FALSE}
+
+};
+
+int __cdecl main(int argc, char **argv)
+{
+
+ int i;
+ char *variableValue;
+
+ if (0 != (PAL_Initialize(argc, argv)))
+ {
+ return FAIL;
+ }
+
+ for (i = 0; i < (sizeof(TestCases)/sizeof(struct TestElement)) ; i++)
+ {
+ if((_putenv(TestCases[i]._putenvString) == -1) &&
+ ( TestCases[i].bValidString == TRUE))
+ {
+ Fail("ERROR: _putenv failed to set an environment "
+ "variable with a valid format.\n Call was"
+ "_putenv(%s)\n", TestCases[i]._putenvString);
+ }
+ /*
+ * For valid _putenvString values, check to see the variable was set
+ */
+ if (TestCases[i].bValidString == TRUE)
+ {
+ variableValue = getenv(TestCases[i].varName);
+
+ if (variableValue == NULL)
+ {
+ if (*TestCases[i].varValue != '\0')
+ {
+ Fail("ERROR: getenv(%s) call returned NULL.\nThe call "
+ "should have returned \"%s\"\n", TestCases[i].varName
+ , TestCases[i].varValue);
+ }
+ }
+ else if ( strcmp(variableValue, TestCases[i].varValue) != 0)
+ {
+ Fail("ERROR: _putenv(%s)\nshould have set the variable "
+ "%s\n to \"%s\".\nA subsequent call to getenv(%s)\n"
+ "returned \"%s\" instead.\n", TestCases[i]._putenvString
+ , TestCases[i].varName, TestCases[i].varValue
+ , TestCases[i].varName, variableValue);
+ }
+ }
+ else
+ /*
+ * Check to see that putenv fails for malformed _putenvString values
+ */
+ {
+ variableValue = getenv(TestCases[i].varName);
+
+ if (variableValue != NULL)
+ {
+ Fail("ERROR: getenv(%s) call should have returned NULL.\n"
+ "Instead it returned \"%s\".\n", TestCases[i].varName
+ , TestCases[i].varValue);
+ }
+ }
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/_putenv/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_putenv/test1/testinfo.dat
new file mode 100644
index 0000000000..d0978184fc
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_putenv/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 = _putenv
+Name = Positive test for _putenv
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Create an environment variable with _putenv and then use getenv to
+= check it. Check that we get the expected errors with invalid input.
diff --git a/src/pal/tests/palsuite/c_runtime/_putenv/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_putenv/test2/CMakeLists.txt
new file mode 100644
index 0000000000..e0539681cd
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_putenv/test2/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test2.c
+)
+
+add_executable(paltest_putenv_test2
+ ${SOURCES}
+)
+
+add_dependencies(paltest_putenv_test2 coreclrpal)
+
+target_link_libraries(paltest_putenv_test2
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_putenv/test2/test2.c b/src/pal/tests/palsuite/c_runtime/_putenv/test2/test2.c
new file mode 100644
index 0000000000..39be4f68b4
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_putenv/test2/test2.c
@@ -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: test2.c
+**
+** Purpose: Create an environment variable with _putenv and then use getenv
+** to check it. This test resets an environment variable.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+const char *_putenvString0 = "AnUnusualVariable=AnUnusualValue";
+const char *_putenvString1 = "AnUnusualVariable=";
+const char *variable = "AnUnusualVariable";
+const char *value = "AnUnusualValue";
+
+int __cdecl main(int argc, char **argv)
+{
+
+ char *variableValue;
+
+ if (0 != (PAL_Initialize(argc, argv)))
+ {
+ return FAIL;
+ }
+
+ if(_putenv(_putenvString0) == -1)
+ {
+ Fail("ERROR: _putenv failed to set an environment "
+ "variable with a valid format.\n Call was"
+ "_putenv(%s)\n", _putenvString0);
+ }
+
+ variableValue = getenv(variable);
+
+ if (variableValue == NULL)
+ {
+ Fail("ERROR: getenv(%s) call returned NULL\nThe call "
+ "should have returned '%s'\n", variable, value);
+ }
+ else
+ {
+ if ( strcmp(variableValue, value) != 0 )
+ {
+ Fail("ERROR: _putenv(%s)\nshould have set the variable "
+ "'%s'\n to '%s'.\nA subsequent call to getenv(%s)\n"
+ "returned '%s' instead.\n", _putenvString0,
+ variable, value, variable, variableValue);
+ }
+ else
+ {
+ if(_putenv(_putenvString1) == -1)
+ {
+ Fail("ERROR: _putenv failed to set an environment "
+ "variable with a valid format.\n Call was"
+ "_putenv(%s)\n", _putenvString1);
+ }
+
+ variableValue = getenv(variable);
+
+ if (variableValue != NULL)
+ {
+ Fail("ERROR: getenv(%s) call did not return NULL.\nThe call "
+ "returned '%s'.\n", variable, value);
+ }
+ }
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/_putenv/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_putenv/test2/testinfo.dat
new file mode 100644
index 0000000000..8d3a6ced1e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_putenv/test2/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 = _putenv
+Name = Positive test for _putenv
+TYPE = DEFAULT
+EXE1 = test2
+Description
+= Create an environment variable with _putenv and then use getenv to
+= check it. This test resets an environment variable.
diff --git a/src/pal/tests/palsuite/c_runtime/_putenv/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_putenv/test3/CMakeLists.txt
new file mode 100644
index 0000000000..a67241022b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_putenv/test3/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test3.c
+)
+
+add_executable(paltest_putenv_test3
+ ${SOURCES}
+)
+
+add_dependencies(paltest_putenv_test3 coreclrpal)
+
+target_link_libraries(paltest_putenv_test3
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_putenv/test3/test3.c b/src/pal/tests/palsuite/c_runtime/_putenv/test3/test3.c
new file mode 100644
index 0000000000..8aa6777307
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_putenv/test3/test3.c
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more 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: Create environment variables that differ only in Case, and
+** verify that the BSD operating system treats the variables
+** differently.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char **argv)
+{
+#if WIN32
+
+ return PASS;
+
+#else
+
+ const char* FirstVariable = "PalTestingEnvironmentVariable=The value";
+ const char* SecondVariable = "PALTESTINGEnvironmentVariable=Different value";
+ const char* FirstVarName = "PalTestingEnvironmentVariable";
+ const char* FirstVarValue = "The value";
+ char* result;
+
+
+ if (0 != (PAL_Initialize(argc, argv)))
+ {
+ return FAIL;
+ }
+
+ /* Use _putenv to set an environment variable. This ensures that the
+ variable we're testing on is always present.
+ */
+
+ if(_putenv(FirstVariable) != 0)
+ {
+ Fail("ERROR: _putenv failed to set an environment variable that "
+ "getenv will be using for testing.\n");
+ }
+
+
+ /* Call getenv -- ensure it doesn't return NULL and the string it returns
+ is the value we set above. Also make sure that each environment variable,
+ differing only by case, returns it's own value.
+ */
+
+ result = getenv(FirstVarName);
+ if(result == NULL)
+ {
+ Fail("ERROR: The result of getenv on a valid Environment Variable "
+ "was NULL, which indicates the environment varaible was not "
+ "found.\n");
+ }
+
+ if(strcmp(result, FirstVarValue) != 0)
+ {
+ Fail("ERROR: The value obtained by getenv() was not equal to the "
+ "correct value of the environment variable. The correct "
+ "value is '%s' and the function returned '%s'.\n",
+ FirstVarValue,
+ result);
+ }
+
+ /* Set the second environment variable, which only differs in Case */
+ if(_putenv(SecondVariable) != 0)
+ {
+ Fail("ERROR: _putenv failed to set an environment variable that "
+ "getenv will be using for testing.\n");
+ }
+
+ /* Verify that the environment variables
+ */
+
+ result = getenv(FirstVarName);
+ if(result == NULL)
+ {
+ Fail("ERROR: The result of getenv on a valid Environment Variable "
+ "was NULL, which indicates the environment varaible was not "
+ "found.\n");
+ }
+
+ if(strcmp(result, FirstVarValue) != 0)
+ {
+ Fail("ERROR: The value obtained by getenv() was not equal to the "
+ "correct value of the environment variable. The correct "
+ "value is '%s' and the function returned '%s'.\n",
+ FirstVarValue,
+ result);
+ }
+
+ PAL_Terminate();
+ return PASS;
+
+#endif
+}
diff --git a/src/pal/tests/palsuite/c_runtime/_putenv/test3/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_putenv/test3/testinfo.dat
new file mode 100644
index 0000000000..2c6af1b5cf
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_putenv/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 = _putenv
+Name = Positive test for _putenv
+TYPE = DEFAULT
+EXE1 = test3
+Description
+= Create environment variables that only differ by case
+= and check that the BSD operating system treats them
+= as two separate variables.
diff --git a/src/pal/tests/palsuite/c_runtime/_putenv/test4/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_putenv/test4/CMakeLists.txt
new file mode 100644
index 0000000000..518282ccc7
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_putenv/test4/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test4.c
+)
+
+add_executable(paltest_putenv_test4
+ ${SOURCES}
+)
+
+add_dependencies(paltest_putenv_test4 coreclrpal)
+
+target_link_libraries(paltest_putenv_test4
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_putenv/test4/test4.c b/src/pal/tests/palsuite/c_runtime/_putenv/test4/test4.c
new file mode 100644
index 0000000000..48d7ba963c
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_putenv/test4/test4.c
@@ -0,0 +1,75 @@
+// Licensed to the .NET Foundation under one or more 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: Create an environment variable and try to retrieve
+** it using the same name but with different case. This
+** is to show that the Win32 representation of _putenv
+** is case insensitive.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char **argv)
+{
+#if WIN32
+
+ const char* FirstVariable = "PalTestingEnvironmentVariable=The value";
+ const char* ModifiedName = "PALTESTINGEnvironmentVariable";
+ const char* FirstVarValue = "The value";
+ char* result;
+
+
+ if (0 != (PAL_Initialize(argc, argv)))
+ {
+ return FAIL;
+ }
+
+ /* Use _putenv to set an environment variable. This ensures that the
+ variable we're testing on is always present.
+ */
+
+ if(_putenv(FirstVariable) != 0)
+ {
+ Fail("ERROR: _putenv failed to set an environment variable that "
+ "getenv will be using for testing.\n");
+ }
+
+
+ /* Call getenv -- ensure it doesn't return NULL and the string it returns
+ is the value we set above. Also make sure that each environment variable,
+ differing only by case, doesn't affect the return value.
+ */
+
+ result = getenv(ModifiedName);
+ if(result == NULL)
+ {
+ Fail("ERROR: The result of getenv on a valid Environment Variable "
+ "was NULL, which indicates the environment varaible was not "
+ "found.\n");
+ }
+
+ if(strcmp(result, FirstVarValue) != 0)
+ {
+ Fail("ERROR: The value obtained by getenv() was not equal to the "
+ "correct value of the environment variable. The correct "
+ "value is '%s' and the function returned '%s'.\n",
+ FirstVarValue,
+ result);
+ }
+
+
+ PAL_Terminate();
+ return PASS;
+
+#else
+ return PASS;
+
+#endif
+}
diff --git a/src/pal/tests/palsuite/c_runtime/_putenv/test4/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_putenv/test4/testinfo.dat
new file mode 100644
index 0000000000..af1a01c2fc
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_putenv/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 = _putenv
+Name = Positive test for _putenv
+TYPE = DEFAULT
+EXE1 = test4
+Description
+= Create an environment variable and check
+= that trying to retrieve it using a name with different
+= case, returns the correct value.
diff --git a/src/pal/tests/palsuite/c_runtime/_putw/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_putw/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_putw/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/_putw/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_putw/test1/CMakeLists.txt
new file mode 100644
index 0000000000..c3018ad322
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_putw/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_putw_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_putw_test1 coreclrpal)
+
+target_link_libraries(paltest_putw_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_putw/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_putw/test1/test1.c
new file mode 100644
index 0000000000..ecfc9046ac
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_putw/test1/test1.c
@@ -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(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/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_putw/test1/testinfo.dat
new file mode 100644
index 0000000000..3007b82407
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_putw/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 = _putw
+Name = Positive test for _putw
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Several integers are written to a new file using _putw. This file is
+= closed, reopened and read from to verify the writes were successful.
diff --git a/src/pal/tests/palsuite/c_runtime/_rotl/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_rotl/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_rotl/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/_rotl/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_rotl/test1/CMakeLists.txt
new file mode 100644
index 0000000000..bafaa23732
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_rotl/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_rotl_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_rotl_test1 coreclrpal)
+
+target_link_libraries(paltest_rotl_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_rotl/test1/test1.cpp b/src/pal/tests/palsuite/c_runtime/_rotl/test1/test1.cpp
new file mode 100644
index 0000000000..3a31388893
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_rotl/test1/test1.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: test1.c (_rotl)
+**
+** Purpose: Tests the PAL implementation of the _rotl function.
+** The _rotl function rotates the unsigned value. _rotl
+** rotates the value left and "wraps" bits rotated off
+** one end of value to the other end.
+** This test compares the result to a previously determined
+** value.
+**
+**
+**
+**===================================================================*/
+#include <palsuite.h>
+
+int __cdecl main(int argc, char **argv)
+{
+ unsigned results = 0;
+ int i,j;
+
+ unsigned hTestNums[5][8] = {
+ {0x00ff, 0x01fe, 0x03fc, 0x07f8, 0x0ff0, 0x1fe0, 0x3fc0, 0x7f80},
+ {0x0055, 0x00aa, 0x0154, 0x02a8, 0x0550, 0x0aa0, 0x1540, 0x2a80},
+ {0x0099, 0x0132, 0x0264, 0x04c8, 0x0990, 0x1320, 0x2640, 0x4c80},
+ {0x0036, 0x006c, 0x00d8, 0x01b0, 0x0360, 0x06c0, 0x0d80, 0x1b00},
+ {0x008f, 0x011e, 0x023c, 0x0478, 0x08f0, 0x11e0, 0x23c0, 0x4780}};
+
+ if ((PAL_Initialize(argc, argv)) != 0)
+ {
+ return (FAIL);
+ }
+
+ /*Loop through expected test results*/
+ for (j = 0; j <= 4; j++)
+ {
+ for(i = 1; i <= 7; i++)
+ {
+ results = _rotl(hTestNums[j][0], i);
+ if (results != hTestNums[j][i])
+ {
+ Fail("ERROR: \"0x%4.4x\" rotated bits to the left %d times"
+ " gave \"0x%4.4x\", expected \"0x%4.4x\"\n",
+ hTestNums[j][0], i, results, hTestNums[j][i]) ;
+ }
+ }
+ }
+
+ PAL_Terminate();
+ return (PASS);
+}
diff --git a/src/pal/tests/palsuite/c_runtime/_rotl/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_rotl/test1/testinfo.dat
new file mode 100644
index 0000000000..9c87473f8e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_rotl/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 = _rtol
+Name = Positive Test for _rotl
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Tests the PAL implementation of the _rotl function.
+= The _rotl function rotates the unsigned value. _rotl
+= rotates the value left and "wraps" bits rotated off
+= one end of value to the other end.
+= This test compares the result to a previously determined
+= value.
diff --git a/src/pal/tests/palsuite/c_runtime/_rotr/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_rotr/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_rotr/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/_rotr/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_rotr/test1/CMakeLists.txt
new file mode 100644
index 0000000000..c0c76feb36
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_rotr/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_rotr_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_rotr_test1 coreclrpal)
+
+target_link_libraries(paltest_rotr_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_rotr/test1/test1.cpp b/src/pal/tests/palsuite/c_runtime/_rotr/test1/test1.cpp
new file mode 100644
index 0000000000..cf461c0a6e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_rotr/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 (_rotr)
+**
+** Purpose: Tests the PAL implementation of the _rotr function.
+** The _rotr function rotates the unsigned value. _rotr
+** rotates the value right and "wraps" bits rotated off
+** one end of value to the other end.
+** This test compares the result to a previously
+** determined value.
+**
+**
+**===================================================================*/
+#include <palsuite.h>
+
+int __cdecl main(int argc, char **argv)
+{
+ unsigned results = 0;
+ int i,j;
+
+ unsigned hTestNums[5][8] = {
+ {0x00ff, 0x8000007f, 0xc000003f, 0xe000001f,
+ 0xf000000f, 0xf8000007, 0xfc000003, 0xfe000001},
+ {0x0055, 0x8000002a, 0x40000015, 0xa000000a,
+ 0x50000005, 0xa8000002, 0x54000001, 0xaa000000},
+ {0x0099, 0x8000004c, 0x40000026, 0x20000013,
+ 0x90000009, 0xc8000004, 0x64000002, 0x32000001},
+ {0x0036, 0x001b, 0x8000000d, 0xc0000006,
+ 0x60000003, 0xb0000001, 0xd8000000, 0x6c000000},
+ {0x008f, 0x80000047, 0xc0000023, 0xe0000011,
+ 0xf0000008, 0x78000004, 0x3c000002 ,0x1e000001}};
+
+
+ if ((PAL_Initialize(argc, argv)) != 0)
+ {
+ return (FAIL);
+ }
+
+ /*Loop through expected test results*/
+ for (j = 0; j <= 4; j++)
+ {
+ for(i = 1; i <= 7; i++)
+ {
+ results = _rotr(hTestNums[j][0], i);
+ if (results != hTestNums[j][i])
+ {
+ Fail("ERROR: \"0x%4.4x\" rotated bits to the left %d times"
+ " gave \"0x%4.4x\", expected \"0x%4.4x\"\n",
+ hTestNums[j][0], i, results, hTestNums[j][i]) ;
+ }
+ }
+ }
+
+ PAL_Terminate();
+ return (PASS);
+}
diff --git a/src/pal/tests/palsuite/c_runtime/_rotr/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_rotr/test1/testinfo.dat
new file mode 100644
index 0000000000..915f467662
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_rotr/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 = _rtor
+Name = Positive Test for _rotr
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Tests the PAL implementation of the _rotr function.
+= The _rotr function rotates the unsigned value. _rotr
+= rotates the value right and "wraps" bits rotated off
+= one end of value to the other end.
+= This test compares the result to a previously determined
+= value.
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf/CMakeLists.txt
new file mode 100644
index 0000000000..cafb9536b0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/CMakeLists.txt
@@ -0,0 +1,22 @@
+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
new file mode 100644
index 0000000000..84abf62f0b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/_snprintf.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: _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
new file mode 100644
index 0000000000..ab126fc59d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/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_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
new file mode 100644
index 0000000000..eef7406baa
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/test1/test1.c
@@ -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 _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
new file mode 100644
index 0000000000..c15ce1dcba
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/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 = _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
new file mode 100644
index 0000000000..e8e9308849
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/test10/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..9191ccef27
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/test10/test10.c
@@ -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 _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
new file mode 100644
index 0000000000..44ff48e030
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/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 = _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
new file mode 100644
index 0000000000..ccf3dc2572
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/test11/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..9d9302dee0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/test11/test11.c
@@ -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 _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
new file mode 100644
index 0000000000..1a77077950
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/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 = _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
new file mode 100644
index 0000000000..68b442f1d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/test12/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..d782fce788
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/test12/test12.c
@@ -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 _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
new file mode 100644
index 0000000000..6801c7417e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/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 = _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
new file mode 100644
index 0000000000..832b3fefbf
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/test13/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..68ba554d93
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/test13/test13.c
@@ -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 _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
new file mode 100644
index 0000000000..6901589a1b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/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 = _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
new file mode 100644
index 0000000000..c2e3be148d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/test14/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..d874690ba4
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/test14/test14.c
@@ -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 _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
new file mode 100644
index 0000000000..0f32b9b59a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/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 = _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
new file mode 100644
index 0000000000..1bd24d5ccd
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/test15/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..a637a706f5
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/test15/test15.c
@@ -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 _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
new file mode 100644
index 0000000000..8008cff0b5
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/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 = _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
new file mode 100644
index 0000000000..952192e560
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/test16/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..6793019383
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/test16/test16.c
@@ -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 _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
new file mode 100644
index 0000000000..e7a7df8f53
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/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 = _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
new file mode 100644
index 0000000000..ce5cc1623e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/test17/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..9981b44619
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/test17/test17.c
@@ -0,0 +1,53 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*============================================================================
+**
+** Source: 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
new file mode 100644
index 0000000000..4756bd0d78
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/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 = _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
new file mode 100644
index 0000000000..bb9c9c37cc
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/test18/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..d28aec57d0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/test18/test18.c
@@ -0,0 +1,53 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*============================================================================
+**
+** Source: 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
new file mode 100644
index 0000000000..819d28cec9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/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 = _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
new file mode 100644
index 0000000000..f3fbb95013
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/test19/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..26dffd9214
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/test19/test19.c
@@ -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: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
new file mode 100644
index 0000000000..875abf7071
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/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 = _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
new file mode 100644
index 0000000000..8c617df108
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/test2/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..3ccb66c23e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/test2/test2.c
@@ -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 _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
new file mode 100644
index 0000000000..40a1ede3d5
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/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 = _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
new file mode 100644
index 0000000000..13330464a7
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/test3/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..496159c51e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/test3/test3.c
@@ -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 _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
new file mode 100644
index 0000000000..fa53224510
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/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 = _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
new file mode 100644
index 0000000000..5132aa02de
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/test4/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..8c39f222cc
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/test4/test4.c
@@ -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 _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
new file mode 100644
index 0000000000..5d822d160b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/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 = _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
new file mode 100644
index 0000000000..07e441cee0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/test5/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..46ab1dd35e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/test5/test5.c
@@ -0,0 +1,61 @@
+// Licensed to the .NET Foundation under one or more 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
new file mode 100644
index 0000000000..33056defd8
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/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 = _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
new file mode 100644
index 0000000000..9ee5d90544
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/test6/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..32001c2d20
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/test6/test6.c
@@ -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 _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
new file mode 100644
index 0000000000..ba2ff818aa
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/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 = _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
new file mode 100644
index 0000000000..f7651218e0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/test7/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..bfd5c3f4f1
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/test7/test7.c
@@ -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 _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
new file mode 100644
index 0000000000..5c2406c7b2
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/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 = _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
new file mode 100644
index 0000000000..26af119852
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/test8/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..60ff1b05b8
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/test8/test8.c
@@ -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 _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
new file mode 100644
index 0000000000..f6520d8dde
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/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 = _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
new file mode 100644
index 0000000000..484075919e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/test9/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..e836bcaee3
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/test9/test9.c
@@ -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 _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
new file mode 100644
index 0000000000..2a64b26030
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf/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 = _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/_snwprintf/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf/CMakeLists.txt
new file mode 100644
index 0000000000..cafb9536b0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/CMakeLists.txt
@@ -0,0 +1,22 @@
+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
new file mode 100644
index 0000000000..73bf4d6c12
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/_snwprintf.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: _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
new file mode 100644
index 0000000000..b4ab6d5161
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/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_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
new file mode 100644
index 0000000000..5d13aaf05d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/test1/test1.c
@@ -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 _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
new file mode 100644
index 0000000000..079a3b3989
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/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 = _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
new file mode 100644
index 0000000000..27aaca3bb9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/test10/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..e8a6d93ea3
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/test10/test10.c
@@ -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 _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
new file mode 100644
index 0000000000..2c07cc6e45
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/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 = _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
new file mode 100644
index 0000000000..e18ad4a31b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/test11/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..95f7f53210
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/test11/test11.c
@@ -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 _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
new file mode 100644
index 0000000000..f81a7861bf
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/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 = _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
new file mode 100644
index 0000000000..f2ae07c1b0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/test12/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..ab58fa345f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/test12/test12.c
@@ -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 _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
new file mode 100644
index 0000000000..653babae84
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/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 = _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
new file mode 100644
index 0000000000..42847b6bcd
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/test13/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..5a3e22802d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/test13/test13.c
@@ -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 _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
new file mode 100644
index 0000000000..cdeced6654
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/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 = _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
new file mode 100644
index 0000000000..e5cdbfad87
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/test14/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..c34875246d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/test14/test14.c
@@ -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 _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
new file mode 100644
index 0000000000..b47611aa44
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/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 = _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
new file mode 100644
index 0000000000..dc7b4d66e9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/test15/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..f45005b758
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/test15/test15.c
@@ -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 _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
new file mode 100644
index 0000000000..2c81391689
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/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 = _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
new file mode 100644
index 0000000000..f147ad7e67
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/test16/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..88f55bdc10
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/test16/test16.c
@@ -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 _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
new file mode 100644
index 0000000000..8d844e0b18
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/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 = _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
new file mode 100644
index 0000000000..e40d3f4106
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/test17/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..82f2330b48
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/test17/test17.c
@@ -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 _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
new file mode 100644
index 0000000000..6b01fb3d7d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/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 = _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
new file mode 100644
index 0000000000..68a014cb66
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/test18/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..dbb6233061
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/test18/test18.c
@@ -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 _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
new file mode 100644
index 0000000000..480087f560
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/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 = _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
new file mode 100644
index 0000000000..6dc30b4d33
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/test19/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..efb222c6ba
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/test19/test19.c
@@ -0,0 +1,90 @@
+// Licensed to the .NET Foundation under one or more 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
new file mode 100644
index 0000000000..376cbc84d1
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/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 = _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
new file mode 100644
index 0000000000..9e0d950885
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/test2/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..974b7967f2
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/test2/test2.c
@@ -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 _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
new file mode 100644
index 0000000000..9c65c93e5a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/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 = _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
new file mode 100644
index 0000000000..4d5a28b0fe
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/test3/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..bfb75ce323
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/test3/test3.c
@@ -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 _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
new file mode 100644
index 0000000000..b39f4f56b7
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/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 = _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
new file mode 100644
index 0000000000..0102b0acea
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/test4/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..28f7998591
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/test4/test4.c
@@ -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 _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
new file mode 100644
index 0000000000..3f3600160f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/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 = _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
new file mode 100644
index 0000000000..c835c94845
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/test5/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..bbe459751b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/test5/test5.c
@@ -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: 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
new file mode 100644
index 0000000000..2180b81cf5
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/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 = _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
new file mode 100644
index 0000000000..37a415ed86
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/test6/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..3d4ed3f882
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/test6/test6.c
@@ -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 _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
new file mode 100644
index 0000000000..6a170cd549
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/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 = _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
new file mode 100644
index 0000000000..b1a07eeaa4
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/test7/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..7954ff71ca
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/test7/test7.c
@@ -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 _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
new file mode 100644
index 0000000000..5749539e3f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/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 = _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
new file mode 100644
index 0000000000..063ee2b9b6
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/test8/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..91c2820076
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/test8/test8.c
@@ -0,0 +1,53 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*============================================================================
+**
+** Source: 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
new file mode 100644
index 0000000000..6398f60183
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/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 = _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
new file mode 100644
index 0000000000..8d5e41131d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/test9/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..f8f994fdcc
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/test9/test9.c
@@ -0,0 +1,53 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*============================================================================
+**
+** Source: 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
new file mode 100644
index 0000000000..287de4a9e9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf/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 = _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/_splitpath/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_splitpath/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_splitpath/CMakeLists.txt
@@ -0,0 +1,4 @@
+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
new file mode 100644
index 0000000000..361b9084d7
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_splitpath/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_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
new file mode 100644
index 0000000000..e98354c2ee
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_splitpath/test1/test1.c
@@ -0,0 +1,108 @@
+// Licensed to the .NET Foundation under one or more 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
new file mode 100644
index 0000000000..0a93e27456
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_splitpath/test1/testinfo.dat
@@ -0,0 +1,15 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = 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/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_stricmp/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_stricmp/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/_stricmp/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_stricmp/test1/CMakeLists.txt
new file mode 100644
index 0000000000..766660ccfc
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_stricmp/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_stricmp_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_stricmp_test1 coreclrpal)
+
+target_link_libraries(paltest_stricmp_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_stricmp/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_stricmp/test1/test1.c
new file mode 100644
index 0000000000..60e2f9eb8b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_stricmp/test1/test1.c
@@ -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: test1.c
+**
+** Purpose: Do a lower case compare. Check two strings, only different
+** because they have different capitalization, and they should return 0. Try
+** two strings which will return less than 0 (one is smaller than the other).
+** Also try the opposite, to get a return value greater than 0.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+/*
+ * Note: The _stricmp is dependent on the LC_CTYPE category of the locale,
+ * and this is ignored by these tests.
+ */
+int __cdecl main(int argc, char *argv[])
+{
+ char *str1 = "foo";
+ char *str2 = "fOo";
+ char *str3 = "foo_bar";
+ char *str4 = "foobar";
+
+ /*
+ * Initialize the PAL and return FAIL if this fails
+ */
+ if (0 != (PAL_Initialize(argc, argv)))
+ {
+ return FAIL;
+ }
+
+ if (_stricmp(str1, str2) != 0)
+ {
+ Fail ("ERROR: _stricmp returning incorrect value:\n"
+ "_stricmp(\"%s\", \"%s\") != 0\n", str1, str2);
+ }
+
+ if (_stricmp(str2, str3) >= 0)
+ {
+ Fail ("ERROR: _stricmp returning incorrect value:\n"
+ "_stricmp(\"%s\", \"%s\") >= 0\n", str2, str3);
+ }
+
+ if (_stricmp(str3, str4) >= 0)
+ {
+ Fail ("ERROR: _stricmp returning incorrect value:\n"
+ "_stricmp(\"%s\", \"%s\") >= 0\n", str3, str4);
+ }
+
+ if (_stricmp(str4, str1) <= 0)
+ {
+ Fail ("ERROR: _stricmp returning incorrect value:\n"
+ "_stricmp(\"%s\", \"%s\") <= 0\n", str4, str1);
+ }
+
+ if (_stricmp(str3, str2) <= 0)
+ {
+ Fail ("ERROR: _stricmp returning incorrect value:\n"
+ "_stricmp(\"%s\", \"%s\") <= 0\n", str2, str3);
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/_stricmp/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_stricmp/test1/testinfo.dat
new file mode 100644
index 0000000000..89d4e0f57b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_stricmp/test1/testinfo.dat
@@ -0,0 +1,15 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = _stricmp
+Name = Positive Test for _stricmp
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Do a lower case compare. Check two strings, only different because they
+= have different capitalization, and they should return 0. Try two strings
+= which will return less than 0 (one is smaller than the other). Also try
+= the opposite, to get a return value greater than 0.
diff --git a/src/pal/tests/palsuite/c_runtime/_strlwr/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_strlwr/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_strlwr/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/_strlwr/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_strlwr/test1/CMakeLists.txt
new file mode 100644
index 0000000000..3a9394ca60
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_strlwr/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_strlwr_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_strlwr_test1 coreclrpal)
+
+target_link_libraries(paltest_strlwr_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_strlwr/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_strlwr/test1/test1.c
new file mode 100644
index 0000000000..1c4015e3e2
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_strlwr/test1/test1.c
@@ -0,0 +1,42 @@
+// Licensed to the .NET Foundation under one or more 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:
+** Using memcmp, check to see that after changing a string into all lowercase
+** that it is the lowercase string that was expected.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char *argv[])
+{
+ char string[] = "aASdff";
+ char checkstr[] = "aasdff";
+ char *ret=NULL;
+
+ /*
+ * Initialize the PAL and return FAIL if this fails
+ */
+ if (0 != (PAL_Initialize(argc, argv)))
+ {
+ return FAIL;
+ }
+
+ ret = _strlwr(string);
+
+ if (memcmp(ret, checkstr, sizeof(checkstr)) != 0)
+ {
+ Fail ("ERROR: _strlwr returning incorrect value\n"
+ "Expected %s, got %s\n", checkstr, ret);
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/_strlwr/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_strlwr/test1/testinfo.dat
new file mode 100644
index 0000000000..4c2a1ad558
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_strlwr/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 = _strlwr
+Name = Positive Test for _strlwr
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Using memcmp, check to see that after changing a string into all lowercase
+= that it is the lowercase string that was expected.
diff --git a/src/pal/tests/palsuite/c_runtime/_strnicmp/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_strnicmp/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_strnicmp/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/_strnicmp/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_strnicmp/test1/CMakeLists.txt
new file mode 100644
index 0000000000..6a38747592
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_strnicmp/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_strnicmp_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_strnicmp_test1 coreclrpal)
+
+target_link_libraries(paltest_strnicmp_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_strnicmp/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_strnicmp/test1/test1.c
new file mode 100644
index 0000000000..3c915dc621
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_strnicmp/test1/test1.c
@@ -0,0 +1,85 @@
+// Licensed to the .NET Foundation under one or more 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 _strnicmp function
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ char str1[] = "foo";
+ char str2[] = "foox";
+ char str3[] = "fOo";
+ char str4[] = "ABCDE";
+ char str5[] = "ABCD[";
+ char str6[] = "abcde";
+ char str7[] = "abcd^";
+
+ /*
+ * Initialize the PAL and return FAIL if this fails
+ */
+ if (0 != (PAL_Initialize(argc, argv)))
+ {
+ return FAIL;
+ }
+
+ if (_strnicmp(str1, str2, strlen(str2)) >= 0)
+ {
+ Fail ("ERROR: _strnicmp(\"%s\", \"%s\", %d) returned >= 0\n",
+ str1, str2, strlen(str2));
+ }
+
+ if (_strnicmp(str2, str1, strlen(str2)) <= 0)
+ {
+ Fail ("ERROR: _strnicmp(\"%s\", \"%s\", %d) returned <= 0\n",
+ str2, str1, strlen(str2));
+ }
+
+ if (_strnicmp(str1, str2, strlen(str1)) != 0)
+ {
+ Fail ("ERROR: _strnicmp(\"%s\", \"%s\", %d) returned != 0\n",
+ str1, str2, strlen(str1));
+ }
+
+ if (_strnicmp(str1, str3, strlen(str1)) != 0)
+ {
+ Fail ("ERROR: _strnicmp(\"%s\", \"%s\", %d) returned != 0\n",
+ str1, str3, strlen(str3));
+ }
+
+ if (_strnicmp(str3, str1, strlen(str1)) != 0)
+ {
+ Fail ("ERROR: _strnicmp(\"%s\", \"%s\", %d) returned != 0\n",
+ str3, str1, strlen(str1));
+ }
+
+ /* new testing */
+
+ /* str4 should be greater than str5 */
+ if (_strnicmp(str4, str5, strlen(str4)) <= 0)
+ {
+ Fail ("ERROR: _strnicmp(\"%s\", \"%s\", %d) returned >= 0\n",
+ str4, str5, strlen(str4));
+ }
+
+ /* str6 should be greater than str7 */
+ if (_strnicmp(str6, str7, strlen(str6)) <= 0)
+ {
+ Fail ("ERROR: _strnicmp(\"%s\", \"%s\", %d) returned <= 0\n",
+ str6, str7, strlen(str6));
+ }
+
+
+ PAL_Terminate();
+
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/_strnicmp/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_strnicmp/test1/testinfo.dat
new file mode 100644
index 0000000000..86744c04df
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_strnicmp/test1/testinfo.dat
@@ -0,0 +1,18 @@
+# Licensed to the .NET Foundation under one or more 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 = _strnicmp
+Name = Test #1 for _strnicmp
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Take two strings and compare them, giving different lengths.
+= Comparing str1 and str2 with str2 length, should return <0
+= Comparing str2 and str1 with str2 length, should return >0
+= Comparing str1 and str2 with str1 lenght, should return 0
+= Bring in str3, which has a capital, but this function is doing a lower
+= case compare. Just ensure that two strings which differ only by capitals
+= return 0.
diff --git a/src/pal/tests/palsuite/c_runtime/_swab/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_swab/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_swab/CMakeLists.txt
@@ -0,0 +1,4 @@
+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
new file mode 100644
index 0000000000..fc7fbef8b4
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_swab/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_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
new file mode 100644
index 0000000000..203e3b3a06
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_swab/test1/test1.c
@@ -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: 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
new file mode 100644
index 0000000000..c59b017762
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_swab/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 = _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/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnprintf/CMakeLists.txt
new file mode 100644
index 0000000000..cafb9536b0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/CMakeLists.txt
@@ -0,0 +1,22 @@
+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/_vsnprintf/_vsnprintf.h b/src/pal/tests/palsuite/c_runtime/_vsnprintf/_vsnprintf.h
new file mode 100644
index 0000000000..240a72f017
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/_vsnprintf.h
@@ -0,0 +1,124 @@
+// Licensed to the .NET Foundation under one or more 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: _vsnprintf.h
+**
+** Purpose: Contains common testing functions for _vsnprintf
+**
+**
+**==========================================================================*/
+
+#ifndef __STRINGTEST_H__
+#define __STRINGTEST_H__
+
+/* These functions leaks memory like crazy. C'est la vie. */
+int Testvsnprintf(char* buf, size_t count, const char* format, ...)
+{
+ int retVal;
+ va_list arglist;
+
+ va_start(arglist, format);
+ retVal = _vsnprintf(buf, count, format, arglist);
+ va_end(arglist);
+
+ return (retVal);
+}
+
+
+void DoStrTest(char *formatstr, char* param, char *checkstr)
+{
+ char buf[256] = { 0 };
+
+ Testvsnprintf(buf, 256, formatstr, param);
+ if (memcmp(buf, checkstr, strlen(buf) + 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 };
+
+ Testvsnprintf(buf, 256, formatstr, param);
+ if (memcmp(buf, checkstr, strlen(buf) + 1) != 0)
+ {
+ Fail("ERROR: failed to insert wide string \"%s\" into \"%s\"\n"
+ "Expected \"%s\" got \"%s\".\n",
+ convertC(param), formatstr, checkstr, buf);
+ }
+}
+
+
+void DoCharTest(char *formatstr, char param, char *checkstr)
+{
+ char buf[256] = { 0 };
+
+ Testvsnprintf(buf, 256, formatstr, param);
+ if (memcmp(buf, checkstr, strlen(buf) + 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 };
+
+ Testvsnprintf(buf, 256, formatstr, param);
+ if (memcmp(buf, checkstr, strlen(buf) + 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 };
+
+ Testvsnprintf(buf, 256, formatstr, value);
+ if (memcmp(buf, checkstr, strlen(buf) + 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 *checkstr)
+{
+ char buf[256] = { 0 };
+
+ Testvsnprintf(buf, 256, formatstr, value);
+ if (memcmp(buf, checkstr, strlen(buf) + 1) != 0)
+ {
+ Fail("ERROR: failed to insert %s into \"%s\"\n"
+ "Expected \"%s\" got \"%s\".\n",
+ valuestr, formatstr, checkstr, buf);
+ }
+}
+void DoDoubleTest(char *formatstr, double value, char *checkstr1, char
+ *checkstr2)
+{
+ char buf[256] = { 0 };
+
+ Testvsnprintf(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);
+ }
+}
+
+#endif
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test1/CMakeLists.txt
new file mode 100644
index 0000000000..7c346a4638
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/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_vsnprintf_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsnprintf_test1 coreclrpal)
+
+target_link_libraries(paltest_vsnprintf_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test1/test1.c
new file mode 100644
index 0000000000..88aeec27a5
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test1/test1.c
@@ -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: test1.c
+**
+** Purpose: Test #1 for the _vsnprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../_vsnprintf.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);
+ }
+
+ Testvsnprintf(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);
+ }
+
+ Testvsnprintf(buf, 256, "xxxxxxxxxxxxxxxxx");
+
+ ret = Testvsnprintf(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/_vsnprintf/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test1/testinfo.dat
new file mode 100644
index 0000000000..0e97856927
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/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 = _vsnprintf
+Name = Positive Test for _vsnprintf
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Tests the PAL implementation of the _vsnprintf function.
+= This test is modeled after _snprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test10/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test10/CMakeLists.txt
new file mode 100644
index 0000000000..00dccc260d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test10/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test10.c
+)
+
+add_executable(paltest_vsnprintf_test10
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsnprintf_test10 coreclrpal)
+
+target_link_libraries(paltest_vsnprintf_test10
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test10/test10.c b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test10/test10.c
new file mode 100644
index 0000000000..3099957ab7
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test10/test10.c
@@ -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 _vsnprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../_vsnprintf.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/_vsnprintf/test10/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test10/testinfo.dat
new file mode 100644
index 0000000000..1399afae05
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/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 = _vsnprintf
+Name = Positive Test for _vsnprintf
+TYPE = DEFAULT
+EXE1 = test10
+Description
+= Tests the PAL implementation of the _vsnprintf function.
+= Tests _vsnprintf with octal numbers.
+= This test is modeled after _snprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test11/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test11/CMakeLists.txt
new file mode 100644
index 0000000000..fd709f2a31
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test11/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test11.c
+)
+
+add_executable(paltest_vsnprintf_test11
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsnprintf_test11 coreclrpal)
+
+target_link_libraries(paltest_vsnprintf_test11
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test11/test11.c b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test11/test11.c
new file mode 100644
index 0000000000..74b0435c6d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test11/test11.c
@@ -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 _vsnprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../_vsnprintf.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/_vsnprintf/test11/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test11/testinfo.dat
new file mode 100644
index 0000000000..faa7428eff
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/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 = _vsnprintf
+Name = Positive Test for _vsnprintf
+TYPE = DEFAULT
+EXE1 = test11
+Description
+= Tests the PAL implementation of the _vsnprintf function.
+= Tests _vsnprintf with unsigned numbers.
+= This test is modeled after _snprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test12/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test12/CMakeLists.txt
new file mode 100644
index 0000000000..02dac0cb91
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test12/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test12.c
+)
+
+add_executable(paltest_vsnprintf_test12
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsnprintf_test12 coreclrpal)
+
+target_link_libraries(paltest_vsnprintf_test12
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test12/test12.c b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test12/test12.c
new file mode 100644
index 0000000000..3718620971
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test12/test12.c
@@ -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: test12.c
+**
+** Purpose: Test #12 for the _vsnprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../_vsnprintf.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/_vsnprintf/test12/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test12/testinfo.dat
new file mode 100644
index 0000000000..d48a5cc60d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/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 = _vsnprintf
+Name = Positive Test for _vsnprintf
+TYPE = DEFAULT
+EXE1 = test12
+Description
+= Tests the PAL implementation of the _vsnprintf function.
+= Tests _vsnprintf with hex numbers (lowercase).
+= This test is modeled after _snprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test13/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test13/CMakeLists.txt
new file mode 100644
index 0000000000..52562c99f8
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test13/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test13.c
+)
+
+add_executable(paltest_vsnprintf_test13
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsnprintf_test13 coreclrpal)
+
+target_link_libraries(paltest_vsnprintf_test13
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test13/test13.c b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test13/test13.c
new file mode 100644
index 0000000000..1abada4033
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test13/test13.c
@@ -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: test13.c
+**
+** Purpose: Test #13 for the _vsnprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../_vsnprintf.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/_vsnprintf/test13/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test13/testinfo.dat
new file mode 100644
index 0000000000..a3f14c21dc
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/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 = _vsnprintf
+Name = Positive Test for _vsnprintf
+TYPE = DEFAULT
+EXE1 = test13
+Description
+= Tests the PAL implementation of the _vsnprintf function.
+= Tests _vsnprintf with hex numbers (uppercase).
+= This test is modeled after _snprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test14/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test14/CMakeLists.txt
new file mode 100644
index 0000000000..3fc8c814a6
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test14/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test14.c
+)
+
+add_executable(paltest_vsnprintf_test14
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsnprintf_test14 coreclrpal)
+
+target_link_libraries(paltest_vsnprintf_test14
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test14/test14.c b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test14/test14.c
new file mode 100644
index 0000000000..2e98f6ad4e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test14/test14.c
@@ -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: test14.c
+**
+** Purpose: Test #14 for the _vsnprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../_vsnprintf.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/_vsnprintf/test14/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test14/testinfo.dat
new file mode 100644
index 0000000000..f4d921c139
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/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 = _vsnprintf
+Name = Positive Test for _vsnprintf
+TYPE = DEFAULT
+EXE1 = test14
+Description
+= Tests the PAL implementation of the _vsnprintf function.
+= Tests _vsnprintf with exponential format doubles (lowercase).
+= This test is modeled after _snprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test15/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test15/CMakeLists.txt
new file mode 100644
index 0000000000..f6bdc83779
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test15/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test15.c
+)
+
+add_executable(paltest_vsnprintf_test15
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsnprintf_test15 coreclrpal)
+
+target_link_libraries(paltest_vsnprintf_test15
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test15/test15.c b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test15/test15.c
new file mode 100644
index 0000000000..4d32e9c638
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test15/test15.c
@@ -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: test15.c
+**
+** Purpose: Test #15 for the _vsnprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../_vsnprintf.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/_vsnprintf/test15/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test15/testinfo.dat
new file mode 100644
index 0000000000..3a6620ba46
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/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 = _vsnprintf
+Name = Positive Test for _vsnprintf
+TYPE = DEFAULT
+EXE1 = test15
+Description
+= Tests the PAL implementation of the _vsnprintf function.
+= Tests _vsnprintf with exponential format doubles (uppercase).
+= This test is modeled after _snprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test16/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test16/CMakeLists.txt
new file mode 100644
index 0000000000..b7b06d19bb
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test16/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test16.c
+)
+
+add_executable(paltest_vsnprintf_test16
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsnprintf_test16 coreclrpal)
+
+target_link_libraries(paltest_vsnprintf_test16
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test16/test16.c b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test16/test16.c
new file mode 100644
index 0000000000..118ba1453c
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test16/test16.c
@@ -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: test16.c
+**
+** Purpose: Test #16 for the _vsnprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../_vsnprintf.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/_vsnprintf/test16/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test16/testinfo.dat
new file mode 100644
index 0000000000..6363f294af
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/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 = _vsnprintf
+Name = Positive Test for _vsnprintf
+TYPE = DEFAULT
+EXE1 = test16
+Description
+= Tests the PAL implementation of the _vsnprintf function.
+= Tests _vsnprintf with decimal point format doubles.
+= This test is modeled after _snprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test17/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test17/CMakeLists.txt
new file mode 100644
index 0000000000..2c91cccd4a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test17/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test17.c
+)
+
+add_executable(paltest_vsnprintf_test17
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsnprintf_test17 coreclrpal)
+
+target_link_libraries(paltest_vsnprintf_test17
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test17/test17.c b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test17/test17.c
new file mode 100644
index 0000000000..9b5063ddf0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test17/test17.c
@@ -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: test17.c
+**
+** Purpose: Test #17 for the _vsnprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../_vsnprintf.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/_vsnprintf/test17/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test17/testinfo.dat
new file mode 100644
index 0000000000..ecec515de3
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/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 = _vsnprintf
+Name = Positive Test for _vsnprintf
+TYPE = DEFAULT
+EXE1 = test17
+Description
+= Tests the PAL implementation of the _vsnprintf function.
+= Tests _vsnprintf with compact format doubles (lowercase).
+= This test is modeled after _snprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test18/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test18/CMakeLists.txt
new file mode 100644
index 0000000000..1a06ce01ee
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test18/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test18.c
+)
+
+add_executable(paltest_vsnprintf_test18
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsnprintf_test18 coreclrpal)
+
+target_link_libraries(paltest_vsnprintf_test18
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test18/test18.c b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test18/test18.c
new file mode 100644
index 0000000000..5232befc7f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test18/test18.c
@@ -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: test18.c
+**
+** Purpose: Test #18 for the _vsnprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../_vsnprintf.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/_vsnprintf/test18/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test18/testinfo.dat
new file mode 100644
index 0000000000..34fd7ae2ff
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/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 = _vsnprintf
+Name = Positive Test for _vsnprintf
+TYPE = DEFAULT
+EXE1 = test18
+Description
+= Tests the PAL implementation of the _vsnprintf function.
+= Tests _vsnprintf with compact format doubles (uppercase).
+= This test is modeled after _snprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test19/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test19/CMakeLists.txt
new file mode 100644
index 0000000000..6f2e42cc6b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test19/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test19.c
+)
+
+add_executable(paltest_vsnprintf_test19
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsnprintf_test19 coreclrpal)
+
+target_link_libraries(paltest_vsnprintf_test19
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test19/test19.c b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test19/test19.c
new file mode 100644
index 0000000000..075a528aba
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test19/test19.c
@@ -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, "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/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test19/testinfo.dat
new file mode 100644
index 0000000000..05f4b5bd87
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/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 = _vsnprintf
+Name = Positive Test for _vsnprintf
+TYPE = DEFAULT
+EXE1 = test19
+Description
+= Tests the PAL implementation of the _vsnprintf function.
+= Tests _vsnprintf with argument specified precision.
+= This test is modeled after _snprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test2/CMakeLists.txt
new file mode 100644
index 0000000000..a3871d64cf
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test2/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test2.c
+)
+
+add_executable(paltest_vsnprintf_test2
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsnprintf_test2 coreclrpal)
+
+target_link_libraries(paltest_vsnprintf_test2
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test2/test2.c b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test2/test2.c
new file mode 100644
index 0000000000..4bac4d2c83
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test2/test2.c
@@ -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 #2 for the _vsnprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../_vsnprintf.h"
+/*
+ * Notes: memcmp is used, as is strlen.
+ */
+
+int __cdecl main(int argc, char *argv[])
+{
+ WCHAR szwStr[] = {'b','a','r','\0'};
+
+ if (PAL_Initialize(argc, argv) != 0)
+ {
+ return(FAIL);
+ }
+
+ DoStrTest("foo %s", "bar", "foo bar");
+ DoStrTest("foo %hs", "bar", "foo bar");
+ DoWStrTest("foo %ls", szwStr, "foo bar");
+ DoWStrTest("foo %ws", szwStr, "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/_vsnprintf/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test2/testinfo.dat
new file mode 100644
index 0000000000..5ee925e3f6
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/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 = _vsnprintf
+Name = Positive Test for _vsnprintf
+TYPE = DEFAULT
+EXE1 = test2
+Description
+= Tests the PAL implementation of the _vsnprintf function.
+= Tests _vsnprintf with strings.
+= This test is modeled after _snprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test3/CMakeLists.txt
new file mode 100644
index 0000000000..1beae06277
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test3/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test3.c
+)
+
+add_executable(paltest_vsnprintf_test3
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsnprintf_test3 coreclrpal)
+
+target_link_libraries(paltest_vsnprintf_test3
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test3/test3.c b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test3/test3.c
new file mode 100644
index 0000000000..2b30c9ad99
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test3/test3.c
@@ -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: test3.c
+**
+** Purpose: Test #3 for the _vsnprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../_vsnprintf.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/_vsnprintf/test3/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test3/testinfo.dat
new file mode 100644
index 0000000000..626949c7c8
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/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 = _vsnprintf
+Name = Positive Test for _vsnprintf
+TYPE = DEFAULT
+EXE1 = test3
+Description
+= Tests the PAL implementation of the _vsnprintf function.
+= Tests _vsnprintf with wide strings.
+= This test is modeled after _snprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test4/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test4/CMakeLists.txt
new file mode 100644
index 0000000000..daf7757ddb
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test4/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test4.c
+)
+
+add_executable(paltest_vsnprintf_test4
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsnprintf_test4 coreclrpal)
+
+target_link_libraries(paltest_vsnprintf_test4
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test4/test4.c b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test4/test4.c
new file mode 100644
index 0000000000..33fc49deba
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test4/test4.c
@@ -0,0 +1,98 @@
+// Licensed to the .NET Foundation under one or more 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 _vsnprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../_vsnprintf.h"
+
+/*
+ * Notes: memcmp is used, as is strlen.
+ */
+
+static void DoPointerTest(char *formatstr, void* param, char* paramstr,
+ char *checkstr1)
+{
+ char buf[256] = { 0 };
+
+ Testvsnprintf(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);
+ }
+}
+
+static void DoI64DoubleTest(char *formatstr, INT64 value, char *valuestr, char
+*checkstr1)
+{
+ char buf[256] = { 0 };
+
+ Testvsnprintf(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);
+ }
+}
+
+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");
+ DoI64DoubleTest("%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");
+ DoI64DoubleTest("%I64p", lptr, "pointer to 0x1234567887654321",
+ "1234567887654321");
+#endif
+
+
+
+
+ PAL_Terminate();
+ return PASS;
+}
+
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test4/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test4/testinfo.dat
new file mode 100644
index 0000000000..bdfdef85ae
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/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 = _vsnprintf
+Name = Positive Test for _vsnprintf
+TYPE = DEFAULT
+EXE1 = test4
+Description
+= Tests the PAL implementation of the _vsnprintf function.
+= Tests _vsnprintf with pointers.
+= This test is modeled after _snprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test5/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test5/CMakeLists.txt
new file mode 100644
index 0000000000..c255b07b42
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test5/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test5.c
+)
+
+add_executable(paltest_vsnprintf_test5
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsnprintf_test5 coreclrpal)
+
+target_link_libraries(paltest_vsnprintf_test5
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test5/test5.c b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test5/test5.c
new file mode 100644
index 0000000000..534e42e293
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test5/test5.c
@@ -0,0 +1,78 @@
+// Licensed to the .NET Foundation under one or more 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 _vsnprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../_vsnprintf.h"
+
+/*
+ * Notes: memcmp is used, as is strlen.
+ */
+
+static void DoTest(char *formatstr, int param, char *checkstr)
+{
+ char buf[256] = { 0 };
+ int n = -1;
+
+ Testvsnprintf(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(buf) + 1) != 0)
+ {
+ Fail("ERROR: Expected \"%s\" got \"%s\".\n", checkstr, buf);
+ }
+}
+
+static void DoShortTest(char *formatstr, int param, char *checkstr)
+{
+ char buf[256] = { 0 };
+ short int n = -1;
+
+ Testvsnprintf(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(buf) + 1) != 0)
+ {
+ Fail("ERROR: Expected \"%s\" got \"%s\".\n", checkstr, buf);
+ }
+}
+
+int __cdecl main(int argc, char *argv[])
+{
+ if (PAL_Initialize(argc, argv) != 0)
+ {
+ return(FAIL);
+ }
+
+ DoTest("foo %n bar", 4, "foo bar");
+ DoTest("foo %#n bar", 4, "foo bar");
+ DoTest("foo % n bar", 4, "foo bar");
+ DoTest("foo %+n bar", 4, "foo bar");
+ DoTest("foo %-n bar", 4, "foo bar");
+ DoTest("foo %0n bar", 4, "foo bar");
+ DoShortTest("foo %hn bar", 4, "foo bar");
+ DoTest("foo %ln bar", 4, "foo bar");
+ DoTest("foo %Ln bar", 4, "foo bar");
+ DoTest("foo %I64n bar", 4, "foo bar");
+ DoTest("foo %20.3n bar", 4, "foo bar");
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test5/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test5/testinfo.dat
new file mode 100644
index 0000000000..3cd3f7ee86
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test5/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 = _vsnprintf
+Name = Positive Test for _vsnprintf
+TYPE = DEFAULT
+EXE1 = test5
+Description
+= Tests the PAL implementation of the _vsnprintf function.
+= Tests _vsnprintf with the count specifier.
+= This test is modeled after _snprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test6/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test6/CMakeLists.txt
new file mode 100644
index 0000000000..8e041f4af8
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test6/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test6.c
+)
+
+add_executable(paltest_vsnprintf_test6
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsnprintf_test6 coreclrpal)
+
+target_link_libraries(paltest_vsnprintf_test6
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test6/test6.c b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test6/test6.c
new file mode 100644
index 0000000000..103d1181c2
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test6/test6.c
@@ -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: test6.c
+**
+** Purpose: Test #6 for the _vsnprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../_vsnprintf.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/_vsnprintf/test6/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test6/testinfo.dat
new file mode 100644
index 0000000000..e379e0b3b8
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/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 = _vsnprintf
+Name = Positive Test for _vsnprintf
+TYPE = DEFAULT
+EXE1 = test6
+Description
+= Tests the PAL implementation of the _vsnprintf function.
+= Tests _vsnprintf with characters.
+= This test is modeled after _snprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test7/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test7/CMakeLists.txt
new file mode 100644
index 0000000000..01f9620184
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test7/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test7.c
+)
+
+add_executable(paltest_vsnprintf_test7
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsnprintf_test7 coreclrpal)
+
+target_link_libraries(paltest_vsnprintf_test7
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test7/test7.c b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test7/test7.c
new file mode 100644
index 0000000000..c7e45d67fa
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test7/test7.c
@@ -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: test7.c
+**
+** Purpose: Test #7 for the _vsnprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../_vsnprintf.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/_vsnprintf/test7/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test7/testinfo.dat
new file mode 100644
index 0000000000..90749400a5
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/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 = _vsnprintf
+Name = Positive Test for _vsnprintf
+TYPE = DEFAULT
+EXE1 = test7
+Description
+= Tests the PAL implementation of the _vsnprintf function.
+= Tests _vsnprintf with wide characters.
+= This test is modeled after _snprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test8/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test8/CMakeLists.txt
new file mode 100644
index 0000000000..9c525de15a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test8/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test8.c
+)
+
+add_executable(paltest_vsnprintf_test8
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsnprintf_test8 coreclrpal)
+
+target_link_libraries(paltest_vsnprintf_test8
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test8/test8.c b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test8/test8.c
new file mode 100644
index 0000000000..2cefbeac25
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test8/test8.c
@@ -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: test8.c
+**
+** Purpose: Test #8 for the _vsnprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../_vsnprintf.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/_vsnprintf/test8/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test8/testinfo.dat
new file mode 100644
index 0000000000..0afc334a67
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/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 = _vsnprintf
+Name = Positive Test for _vsnprintf
+TYPE = DEFAULT
+EXE1 = test8
+Description
+= Tests the PAL implementation of the _vsnprintf function.
+= Tests _vsnprintf with decimal numbers.
+= This test is modeled after _snprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test9/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test9/CMakeLists.txt
new file mode 100644
index 0000000000..bfe2572a6d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test9/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test9.c
+)
+
+add_executable(paltest_vsnprintf_test9
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsnprintf_test9 coreclrpal)
+
+target_link_libraries(paltest_vsnprintf_test9
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test9/test9.c b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test9/test9.c
new file mode 100644
index 0000000000..d2cd8165c0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test9/test9.c
@@ -0,0 +1,51 @@
+// Licensed to the .NET Foundation under one or more 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 _vsnprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../_vsnprintf.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/_vsnprintf/test9/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test9/testinfo.dat
new file mode 100644
index 0000000000..125724a36b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/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 = _vsnprintf
+Name = Positive Test for _vsnprintf
+TYPE = DEFAULT
+EXE1 = test9
+Description
+= Tests the PAL implementation of the _vsnprintf function.
+= Tests _vsnprintf with integer numbers.
+= This test is modeled after _snprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/CMakeLists.txt
new file mode 100644
index 0000000000..cafb9536b0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/CMakeLists.txt
@@ -0,0 +1,22 @@
+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
new file mode 100644
index 0000000000..a3a932f822
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/_vsnwprintf.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.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
new file mode 100644
index 0000000000..52c442d572
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/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_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
new file mode 100644
index 0000000000..0238e42611
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test1/test1.c
@@ -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 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
new file mode 100644
index 0000000000..d806fb8ed8
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/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
+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
new file mode 100644
index 0000000000..86ea1a3160
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test10/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..6e188e56ff
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test10/test10.c
@@ -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 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
new file mode 100644
index 0000000000..beb5b41be9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/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
+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
new file mode 100644
index 0000000000..c6011dc1de
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test11/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..af54985bdc
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test11/test11.c
@@ -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 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
new file mode 100644
index 0000000000..083b0fa5af
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/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
+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
new file mode 100644
index 0000000000..bd9652c2fb
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test12/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..b593a82b4b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test12/test12.c
@@ -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 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
new file mode 100644
index 0000000000..a4450ed8d0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/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
+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
new file mode 100644
index 0000000000..c608ab84e3
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test13/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..59a9dc496f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test13/test13.c
@@ -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 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
new file mode 100644
index 0000000000..fa54ae8a62
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/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
+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
new file mode 100644
index 0000000000..3bf157a2b3
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test14/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..633f9d68ae
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test14/test14.c
@@ -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 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
new file mode 100644
index 0000000000..0796f5e81c
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/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
+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
new file mode 100644
index 0000000000..eedc7bb9db
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test15/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..0af41fe1dc
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test15/test15.c
@@ -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 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
new file mode 100644
index 0000000000..9de3c83b8a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/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
+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
new file mode 100644
index 0000000000..a469c497e9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test16/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..77571b01b3
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test16/test16.c
@@ -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 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
new file mode 100644
index 0000000000..b7134c785b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/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
+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
new file mode 100644
index 0000000000..f429e94417
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test17/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..3a9d70ad03
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test17/test17.c
@@ -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 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
new file mode 100644
index 0000000000..5d5553151e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/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
+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
new file mode 100644
index 0000000000..25dd6a2c5b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test18/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..03f9870113
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test18/test18.c
@@ -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 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
new file mode 100644
index 0000000000..f56c80980d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/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
+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
new file mode 100644
index 0000000000..9c636b8b0a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test19/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..fea275a242
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test19/test19.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: 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
new file mode 100644
index 0000000000..77178f1471
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/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
+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
new file mode 100644
index 0000000000..817657ea61
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test2/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..20499954db
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test2/test2.c
@@ -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 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
new file mode 100644
index 0000000000..429911bd83
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/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
+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
new file mode 100644
index 0000000000..4af3e36f3b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test3/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..9a37d3fc4b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test3/test3.c
@@ -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 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
new file mode 100644
index 0000000000..d4e2686763
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/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
+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
new file mode 100644
index 0000000000..b7ff9e7bb3
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test4/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..6f39be2a80
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test4/test4.c
@@ -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 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
new file mode 100644
index 0000000000..56f488a66a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/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
+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
new file mode 100644
index 0000000000..9b316b9f90
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test5/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..224db766ff
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test5/test5.c
@@ -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: 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
new file mode 100644
index 0000000000..35d3816a76
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test5/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
+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
new file mode 100644
index 0000000000..d3fad03597
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test6/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..1bd83ea85c
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test6/test6.c
@@ -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 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
new file mode 100644
index 0000000000..6afe96d1cd
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/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
+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
new file mode 100644
index 0000000000..cede861358
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test7/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..e13798b784
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test7/test7.c
@@ -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 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
new file mode 100644
index 0000000000..ece40aa195
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/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
+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
new file mode 100644
index 0000000000..846e7b9219
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test8/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..8f02412eb0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test8/test8.c
@@ -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 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
new file mode 100644
index 0000000000..d7a567a6d6
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/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
+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
new file mode 100644
index 0000000000..e25eded172
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test9/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..7b5b6cd8a6
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test9/test9.c
@@ -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 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
new file mode 100644
index 0000000000..726b060240
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/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
+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/_wcsicmp/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_wcsicmp/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_wcsicmp/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/_wcsicmp/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_wcsicmp/test1/CMakeLists.txt
new file mode 100644
index 0000000000..5f085cc723
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_wcsicmp/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_wcsicmp_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_wcsicmp_test1 coreclrpal)
+
+target_link_libraries(paltest_wcsicmp_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_wcsicmp/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_wcsicmp/test1/test1.c
new file mode 100644
index 0000000000..dd4bb54680
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_wcsicmp/test1/test1.c
@@ -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: test1.c
+**
+** Purpose: Tests that _wcsicmp correctly compares two strings with
+** case insensitivity.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+/*
+ * Note: The _wcsicmp is dependent on the LC_CTYPE category of the locale,
+ * and this is ignored by these tests.
+ */
+int __cdecl main(int argc, char *argv[])
+{
+ WCHAR str1[] = {'f','o','o',0};
+ WCHAR str2[] = {'f','O','o',0};
+ WCHAR str3[] = {'f','o','o','_','b','a','r',0};
+ WCHAR str4[] = {'f','o','o','b','a','r',0};
+
+ /*
+ * Initialize the PAL and return FAIL if this fails
+ */
+ if (0 != (PAL_Initialize(argc, argv)))
+ {
+ return FAIL;
+ }
+
+ if (_wcsicmp(str1, str2) != 0)
+ {
+ Fail ("ERROR: _wcsicmp returning incorrect value:\n"
+ "_wcsicmp(\"%S\", \"%S\") != 0\n", str1, str2);
+ }
+
+ if (_wcsicmp(str2, str3) >= 0)
+ {
+ Fail ("ERROR: _wcsicmp returning incorrect value:\n"
+ "_wcsicmp(\"%S\", \"%S\") >= 0\n", str2, str3);
+ }
+
+ if (_wcsicmp(str3, str4) >= 0)
+ {
+ Fail ("ERROR: _wcsicmp returning incorrect value:\n"
+ "_wcsicmp(\"%S\", \"%S\") >= 0\n", str3, str4);
+ }
+
+ if (_wcsicmp(str4, str1) <= 0)
+ {
+ Fail ("ERROR: _wcsicmp returning incorrect value:\n"
+ "_wcsicmp(\"%S\", \"%S\") <= 0\n", str4, str1);
+ }
+
+ if (_wcsicmp(str3, str2) <= 0)
+ {
+ Fail ("ERROR: _wcsicmp returning incorrect value:\n"
+ "_wcsicmp(\"%S\", \"%S\") <= 0\n", str2, str3);
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/_wcsicmp/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_wcsicmp/test1/testinfo.dat
new file mode 100644
index 0000000000..9351a156e0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_wcsicmp/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 = _wcsicmp
+Name = Test #1 for _wcsicmp
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Tests that _wcsicmp correctly compares two strings with case insensitivity.
diff --git a/src/pal/tests/palsuite/c_runtime/_wcslwr/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_wcslwr/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_wcslwr/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/_wcslwr/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_wcslwr/test1/CMakeLists.txt
new file mode 100644
index 0000000000..a78098f86a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_wcslwr/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_wcslwr_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_wcslwr_test1 coreclrpal)
+
+target_link_libraries(paltest_wcslwr_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_wcslwr/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_wcslwr/test1/test1.c
new file mode 100644
index 0000000000..3a758de39b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_wcslwr/test1/test1.c
@@ -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: test1.c
+**
+** Purpose: Using memcmp to check the result, convert a wide character string
+** with capitals, to all lowercase using this function. Test #1 for the
+** wcslwr function
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+/* uses memcmp,wcslen */
+
+int __cdecl main(int argc, char *argv[])
+{
+ WCHAR *test_str = NULL;
+ WCHAR *expect_str = NULL;
+ WCHAR *result_str = NULL;
+
+ /*
+ * Initialize the PAL and return FAIL if this fails
+ */
+ if (0 != (PAL_Initialize(argc, argv)))
+ {
+ return FAIL;
+ }
+
+ test_str = convert("aSdF 1#");
+ expect_str = convert("asdf 1#");
+
+ result_str = _wcslwr(test_str);
+ if (memcmp(result_str, expect_str, wcslen(expect_str)*2 + 2) != 0)
+ {
+ Fail ("ERROR: Expected to get \"%s\", got \"%s\".\n",
+ convertC(expect_str), convertC(result_str));
+ }
+
+ free(result_str);
+ free(expect_str);
+
+ PAL_Terminate();
+ return PASS;
+}
+
diff --git a/src/pal/tests/palsuite/c_runtime/_wcslwr/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_wcslwr/test1/testinfo.dat
new file mode 100644
index 0000000000..5d691d84d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_wcslwr/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 = _wcslwr
+Name = Positive Test for _wcslwr
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Using memcmp to check the result, convert a wide character string
+= with capitals, to all lowercase using this function.
+
diff --git a/src/pal/tests/palsuite/c_runtime/_wcsnicmp/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_wcsnicmp/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_wcsnicmp/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/_wcsnicmp/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_wcsnicmp/test1/CMakeLists.txt
new file mode 100644
index 0000000000..afd3560b10
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_wcsnicmp/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_wcsnicmp_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_wcsnicmp_test1 coreclrpal)
+
+target_link_libraries(paltest_wcsnicmp_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_wcsnicmp/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_wcsnicmp/test1/test1.c
new file mode 100644
index 0000000000..0271bcc60d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_wcsnicmp/test1/test1.c
@@ -0,0 +1,95 @@
+// Licensed to the .NET Foundation under one or more 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: Take two wide strings and compare them, giving different lengths.
+** Comparing str1 and str2 with str2 length, should return <0
+** Comparing str2 and str1 with str2 length, should return >0
+** Comparing str1 and str2 with str1 lenght, should return 0
+** Bring in str3, which has a capital, but this function is doing a lower
+** case compare. Just ensure that two strings which differ only by capitals
+** return 0.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+/*
+ * Notes: uses wcslen
+ */
+
+int __cdecl main(int argc, char *argv[])
+{
+ WCHAR str1[] = {'f','o','o',0};
+ WCHAR str2[] = {'f','o','o','x',0};
+ WCHAR str3[] = {'f','O','o',0};
+ WCHAR str4[] = {'A','B','C','D','E',0};
+ WCHAR str5[] = {'A','B','C','D',']',0};
+ WCHAR str6[] = {'a','b','c','d','e',0};
+ WCHAR str7[] = {'a','b','c','d',']',0};
+ char cstr1[] = "foo";
+ char cstr2[] = "foox";
+ char cstr3[] = "fOo";
+ char cstr4[] = "ABCDE";
+ char cstr5[] = "ABCD]";
+ char cstr6[] = "abcde";
+ char cstr7[] = "abcd]";
+
+
+ /*
+ * Initialize the PAL and return FAIL if this fails
+ */
+ if (0 != (PAL_Initialize(argc, argv)))
+ {
+ return FAIL;
+ }
+
+ if (_wcsnicmp(str1, str2, wcslen(str2)) >= 0)
+ {
+ Fail ("ERROR: wcsnicmp(\"%s\", \"%s\", %d) returned >= 0\n", cstr1,
+ cstr2, wcslen(str2));
+ }
+
+ if (_wcsnicmp(str2, str1, wcslen(str2)) <= 0)
+ {
+ Fail ("ERROR: wcsnicmp(\"%s\", \"%s\", %d) returned <= 0\n", cstr2,
+ cstr1, wcslen(str2));
+ }
+
+ if (_wcsnicmp(str1, str2, wcslen(str1)) != 0)
+ {
+ Fail ("ERROR: wcsnicmp(\"%s\", \"%s\", %d) returned != 0\n", cstr1,
+ cstr2, wcslen(str1));
+ }
+
+ if (_wcsnicmp(str1, str3, wcslen(str1)) != 0)
+ {
+ Fail ("ERROR: wcsnicmp(\"%s\", \"%s\", %d) returned != 0\n", cstr1,
+ cstr3, wcslen(str1));
+ }
+
+ /* new testing */
+
+ /* str4 should be greater than str5 */
+ if (_wcsnicmp(str4, str5, wcslen(str4)) <= 0)
+ {
+ Fail ("ERROR: _wcsnicmp(\"%s\", \"%s\", %d) returned >= 0\n",
+ cstr4, cstr5, wcslen(str4));
+ }
+
+ /* str6 should be greater than str7 */
+ if (_wcsnicmp(str6, str7, wcslen(str6)) <= 0)
+ {
+ Fail ("ERROR: _wcsnicmp(\"%s\", \"%s\", %d) returned <= 0\n",
+ cstr6, cstr7, wcslen(str6));
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
+
diff --git a/src/pal/tests/palsuite/c_runtime/_wcsnicmp/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_wcsnicmp/test1/testinfo.dat
new file mode 100644
index 0000000000..df49cc1a9a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_wcsnicmp/test1/testinfo.dat
@@ -0,0 +1,18 @@
+# Licensed to the .NET Foundation under one or more 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 = _wcsnicmp
+Name = Positive Test for _wcsnicmp
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Take two wide strings and compare them, giving different lengths.
+= Comparing str1 and str2 with str2 length, should return <0
+= Comparing str2 and str1 with str2 length, should return >0
+= Comparing str1 and str2 with str1 lenght, should return 0
+= Bring in str3, which has a capital, but this function is doing a lower
+= case compare. Just ensure that two strings which differ only by capitals
+= return 0.
diff --git a/src/pal/tests/palsuite/c_runtime/_wfopen/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_wfopen/CMakeLists.txt
new file mode 100644
index 0000000000..19ee487a6a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_wfopen/CMakeLists.txt
@@ -0,0 +1,10 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+add_subdirectory(test2)
+add_subdirectory(test3)
+add_subdirectory(test4)
+add_subdirectory(test5)
+add_subdirectory(test6)
+add_subdirectory(test7)
+
diff --git a/src/pal/tests/palsuite/c_runtime/_wfopen/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_wfopen/test1/CMakeLists.txt
new file mode 100644
index 0000000000..96df58ee54
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_wfopen/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_wfopen_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_wfopen_test1 coreclrpal)
+
+target_link_libraries(paltest_wfopen_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_wfopen/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_wfopen/test1/test1.c
new file mode 100644
index 0000000000..81d2502cd5
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_wfopen/test1/test1.c
@@ -0,0 +1,79 @@
+// Licensed to the .NET Foundation under one or more 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 _wfopen function.
+** This test simply attempts to open a number of files with
+** different modes. It checks to ensure a valid file
+** pointer is returned. It doesn't do any checking to
+** ensure the mode is really what it claims.
+**
+
+**
+**===================================================================*/
+
+
+#define UNICODE
+#include <palsuite.h>
+
+struct testCase
+{
+ int CorrectResult;
+ WCHAR mode[20];
+};
+
+int __cdecl main(int argc, char **argv)
+{
+
+ FILE *fp;
+ WCHAR name[128];
+ WCHAR base[] = {'t','e','s','t','f','i','l','e','s','\0'};
+ char * PrintResult;
+ int i;
+
+ struct testCase testCases[] =
+ {
+ {0, {'r','\0' }}, {1, {'w','\0'}}, {1, {'a','\0'}},
+ {0, {'r','+','\0'}}, {1, {'w','+','\0'}}, {1, {'a','+','\0'}},
+ {1, {'w','t','\0'}}, {1, {'w','b','\0'}}, {1, {'w','S','\0'}},
+ {1, {'w','c','\0'}}, {1, {'w','n','\0'}}, {1, {'w', 'R','\0'}},
+ {1, {'w','T','\0'}}, {0, {'t','w','\0'}}, {0, {'.','\0'}}
+ };
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+
+ for(i = 0; i < sizeof(testCases) / sizeof(struct testCase); i++)
+ {
+ wcscpy(name,base);
+ wcscat(name,testCases[i].mode);
+
+ fp = _wfopen(name,testCases[i].mode);
+
+ if ((fp == 0 && testCases[i].CorrectResult != 0) ||
+ (testCases[i].CorrectResult == 0 && fp != 0) )
+ {
+ PrintResult = convertC(testCases[i].mode);
+ Fail("ERROR: fopen returned incorrectly "
+ "opening a file in %s mode. Perhaps it opened a "
+ "read only file which didn't exist and returned a correct "
+ "pointer?",PrintResult);
+ free(PrintResult);
+ }
+
+ memset(name, '\0', 128);
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/_wfopen/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_wfopen/test1/testinfo.dat
new file mode 100644
index 0000000000..6514137c2f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_wfopen/test1/testinfo.dat
@@ -0,0 +1,15 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = _wfopen
+Name = Positive Test for _wfopen
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= This test simply attempts to open a number of files with different
+= modes. It checks to ensure a valid file pointer is returned. It
+= doesn't do any checking to ensure the mode is really what it claims.
+
diff --git a/src/pal/tests/palsuite/c_runtime/_wfopen/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_wfopen/test2/CMakeLists.txt
new file mode 100644
index 0000000000..47203d86d5
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_wfopen/test2/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test2.c
+)
+
+add_executable(paltest_wfopen_test2
+ ${SOURCES}
+)
+
+add_dependencies(paltest_wfopen_test2 coreclrpal)
+
+target_link_libraries(paltest_wfopen_test2
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_wfopen/test2/test2.c b/src/pal/tests/palsuite/c_runtime/_wfopen/test2/test2.c
new file mode 100644
index 0000000000..921ffef19d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_wfopen/test2/test2.c
@@ -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: test2.c
+**
+** Purpose: Tests the PAL implementation of the _wfopen function.
+** Test to ensure that you can write to a 'w' mode file.
+** And that you can't read from a 'w' mode file.
+**
+** Depends:
+** fprintf
+** fseek
+** fgets
+**
+
+**
+**===================================================================*/
+
+#define UNICODE
+#include <palsuite.h>
+
+int __cdecl main(int argc, char **argv)
+{
+
+ FILE *fp;
+ char buffer[128];
+ WCHAR filename[] = {'t','e','s','t','f','i','l','e','\0'};
+ WCHAR write[] = {'w','\0'};
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ if( (fp = _wfopen( filename, write )) == NULL )
+ {
+ Fail( "ERROR: The file failed to open with 'w' mode.\n" );
+ }
+
+ /* Test that you can write */
+ if(fprintf(fp,"%s","some text") <= 0)
+ {
+ Fail("ERROR: Attempted to WRITE to a file opened with 'w' mode "
+ "but fprintf failed. Either fopen or fprintf have problems.");
+ }
+
+ if(fseek(fp, 0, SEEK_SET))
+ {
+ Fail("ERROR: fseek failed, and this test depends on it.");
+ }
+
+ /* Test that you can't read */
+ if(fgets(buffer,10,fp) != NULL)
+ {
+ Fail("ERROR: Tried to READ from a file with only 'w' mode set. "
+ "This should fail, but fgets didn't return NULL. "
+ "Either fgets or fopen is broken.");
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/_wfopen/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_wfopen/test2/testinfo.dat
new file mode 100644
index 0000000000..3ed2e3bbed
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_wfopen/test2/testinfo.dat
@@ -0,0 +1,15 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = _wfopen
+Name = Positive Test for _wfopen
+TYPE = DEFAULT
+EXE1 = test2
+Description
+= Test to ensure that you can write to a 'w' mode file. And that you can't
+= read from a 'w' mode file.
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/_wfopen/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_wfopen/test3/CMakeLists.txt
new file mode 100644
index 0000000000..deec8bbfe6
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_wfopen/test3/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test3.c
+)
+
+add_executable(paltest_wfopen_test3
+ ${SOURCES}
+)
+
+add_dependencies(paltest_wfopen_test3 coreclrpal)
+
+target_link_libraries(paltest_wfopen_test3
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_wfopen/test3/test3.c b/src/pal/tests/palsuite/c_runtime/_wfopen/test3/test3.c
new file mode 100644
index 0000000000..3b67818bc5
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_wfopen/test3/test3.c
@@ -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: test3.c
+**
+** Purpose: Tests the PAL implementation of the _wfopen function.
+** Test to ensure that you can write to a 'w+' mode file.
+** And that you can read from a 'w+' mode file.
+**
+** Depends:
+** fprintf
+** fseek
+** fgets
+**
+
+**
+**===================================================================*/
+
+#define UNICODE
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char **argv)
+{
+
+ FILE *fp;
+ char buffer[128];
+ WCHAR filename[] = {'t','e','s','t','f','i','l','e','\0'};
+ WCHAR writeplus[] = {'w','+','\0'};
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ /* Open a file with 'w+' mode */
+ if( (fp = _wfopen( filename, writeplus )) == NULL )
+ {
+ Fail( "ERROR: The file failed to open with 'w+' mode.\n" );
+ }
+
+ /* Write some text to the file */
+ if(fprintf(fp,"%s","some text") <= 0)
+ {
+ Fail("ERROR: Attempted to WRITE to a file opened with 'w+' mode "
+ "but fprintf failed. Either fopen or fprintf have problems.");
+ }
+
+ if(fseek(fp, 0, SEEK_SET))
+ {
+ Fail("ERROR: fseek failed, and this test depends on it.");
+ }
+
+ /* Attempt to read from the 'w+' only file, should pass */
+ if(fgets(buffer,10,fp) == NULL)
+ {
+ Fail("ERROR: Tried to READ from a file with 'w+' mode set. "
+ "This should succeed, but fgets returned NULL. Either fgets "
+ "or fopen is broken.");
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/_wfopen/test3/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_wfopen/test3/testinfo.dat
new file mode 100644
index 0000000000..3dd23e7946
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_wfopen/test3/testinfo.dat
@@ -0,0 +1,15 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = _wfopen
+Name = Positive Test for _wfopen
+TYPE = DEFAULT
+EXE1 = test3
+Description
+= Test to ensure that you can write to a 'w+' mode file. And that you can
+= read from a 'w+' mode file.
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/_wfopen/test4/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_wfopen/test4/CMakeLists.txt
new file mode 100644
index 0000000000..e93cdd58de
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_wfopen/test4/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test4.c
+)
+
+add_executable(paltest_wfopen_test4
+ ${SOURCES}
+)
+
+add_dependencies(paltest_wfopen_test4 coreclrpal)
+
+target_link_libraries(paltest_wfopen_test4
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_wfopen/test4/test4.c b/src/pal/tests/palsuite/c_runtime/_wfopen/test4/test4.c
new file mode 100644
index 0000000000..0948fa11cc
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_wfopen/test4/test4.c
@@ -0,0 +1,87 @@
+// Licensed to the .NET Foundation under one or more 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 the PAL implementation of the _wfopen function.
+** Test to ensure that you can't write to a 'r' mode file.
+** And that you can read from a 'r' mode file.
+**
+** Depends:
+** fprintf
+** fclose
+** fgets
+**
+
+**
+**===================================================================*/
+
+#define UNICODE
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char **argv)
+{
+
+ FILE *fp;
+ char buffer[128];
+ WCHAR filename[] = {'t','e','s','t','f','i','l','e','\0'};
+ WCHAR write[] = {'w','\0'};
+ WCHAR read[] = {'r','\0'};
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ /* Open a file with 'w' mode */
+ if( (fp = _wfopen( filename, write )) == NULL )
+ {
+ Fail( "ERROR: The file failed to open with 'w' mode.\n" );
+ }
+
+ /* Write some text to the file */
+ if(fprintf(fp,"%s","some text") <= 0)
+ {
+ Fail("ERROR: Attempted to WRITE to a file opened with 'w' mode "
+ "but fprintf failed. Either fopen or fprintf have problems.");
+ }
+
+ if(fclose(fp))
+ {
+ Fail("ERROR: Attempted to close a file, but fclose failed. "
+ "This test depends upon it.");
+ }
+
+ /* Open a file with 'r' mode */
+ if( (fp = _wfopen( filename, read )) == NULL )
+ {
+ Fail( "ERROR: The file failed to open with 'r' mode.\n" );
+ }
+
+ /* Attempt to read from the 'r' only file, should pass */
+ if(fgets(buffer,10,fp) == NULL)
+ {
+ Fail("ERROR: Tried to READ from a file with 'r' mode set. "
+ "This should succeed, but fgets returned NULL. Either fgets "
+ "or fopen is broken.");
+ }
+
+ /* Write some text to the file */
+ if(fprintf(fp,"%s","some text") > 0)
+ {
+ Fail("ERROR: Attempted to WRITE to a file opened with 'r' mode "
+ "but fprintf succeeded It should have failed. "
+ "Either fopen or fprintf have problems.");
+ }
+
+
+ PAL_Terminate();
+ return PASS;
+}
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/_wfopen/test4/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_wfopen/test4/testinfo.dat
new file mode 100644
index 0000000000..de41d77317
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_wfopen/test4/testinfo.dat
@@ -0,0 +1,15 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = _wfopen
+Name = Positive Test for _wfopen
+TYPE = DEFAULT
+EXE1 = test4
+Description
+= Test to ensure that you can't write to a 'r' mode file. And that you can
+= read from a 'r' mode file.
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/_wfopen/test5/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_wfopen/test5/CMakeLists.txt
new file mode 100644
index 0000000000..1530416795
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_wfopen/test5/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test5.c
+)
+
+add_executable(paltest_wfopen_test5
+ ${SOURCES}
+)
+
+add_dependencies(paltest_wfopen_test5 coreclrpal)
+
+target_link_libraries(paltest_wfopen_test5
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_wfopen/test5/test5.c b/src/pal/tests/palsuite/c_runtime/_wfopen/test5/test5.c
new file mode 100644
index 0000000000..21e5ec84ed
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_wfopen/test5/test5.c
@@ -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: test5.c
+**
+** Purpose: Tests the PAL implementation of the _wfopen function.
+** Test to ensure that you can write to a 'r+' mode file.
+** And that you can read from a 'r+' mode file.
+**
+** Depends:
+** fprintf
+** fclose
+** fgets
+** fseek
+**
+
+**
+**===================================================================*/
+#define UNICODE
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char **argv)
+{
+
+ FILE *fp;
+ char buffer[128];
+ WCHAR filename[] = {'t','e','s','t','f','i','l','e','\0'};
+ WCHAR write[] = {'w','\0'};
+ WCHAR readplus[] = {'r','+','\0'};
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ /* Open a file with 'w' mode */
+ if( (fp = _wfopen( filename,write )) == NULL )
+ {
+ Fail( "ERROR: The file failed to open with 'w' mode.\n" );
+ }
+
+ if(fclose(fp))
+ {
+ Fail("ERROR: Attempted to close a file, but fclose failed. "
+ "This test depends upon it.");
+ }
+
+ if( (fp = _wfopen( filename, readplus )) == NULL )
+ {
+ Fail( "ERROR: The file failed to open with 'r+' mode.\n" );
+ }
+
+ /* Write some text to the file */
+ if(fprintf(fp,"%s","some text") <= 0)
+ {
+ Fail("ERROR: Attempted to WRITE to a file opened with 'r+' mode "
+ "but fprintf failed. Either fopen or fprintf have problems.");
+ }
+
+ if(fseek(fp, 0, SEEK_SET))
+ {
+ Fail("ERROR: fseek failed, and this test depends on it.");
+ }
+
+ /* Attempt to read from the 'r+' only file, should pass */
+ if(fgets(buffer,10,fp) == NULL)
+ {
+ Fail("ERROR: Tried to READ from a file with 'r+' mode set. "
+ "This should succeed, but fgets returned NULL. Either fgets "
+ "or fopen is broken.");
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/_wfopen/test5/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_wfopen/test5/testinfo.dat
new file mode 100644
index 0000000000..6be33cb2be
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_wfopen/test5/testinfo.dat
@@ -0,0 +1,15 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = _wfopen
+Name = Positive Test for _wfopen
+TYPE = DEFAULT
+EXE1 = test5
+Description
+= Test to ensure that you can write to a 'r+' mode file. And that you can
+= read from a 'r+' mode file.
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/_wfopen/test6/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_wfopen/test6/CMakeLists.txt
new file mode 100644
index 0000000000..c401c6f40f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_wfopen/test6/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test6.c
+)
+
+add_executable(paltest_wfopen_test6
+ ${SOURCES}
+)
+
+add_dependencies(paltest_wfopen_test6 coreclrpal)
+
+target_link_libraries(paltest_wfopen_test6
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_wfopen/test6/test6.c b/src/pal/tests/palsuite/c_runtime/_wfopen/test6/test6.c
new file mode 100644
index 0000000000..17d36a0c50
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_wfopen/test6/test6.c
@@ -0,0 +1,152 @@
+// Licensed to the .NET Foundation under one or more 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 the PAL implementation of the _wfopen function.
+** Test to ensure that you can write to an 'a' mode file.
+** And that you can't read from a 'a' mode file.
+**
+** Depends:
+** fprintf
+** fgets
+** fseek
+**
+
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char **argv)
+{
+ FILE *fp;
+ char buffer[128];
+ WCHAR filename[] = {'t','e','s','t','f','i','l','e','\0'};
+ WCHAR filename2[] = {'t','e','s','t','f','i','l','e','2','\0'};
+ WCHAR append[] = {'a','\0'};
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ /* Open a file with 'a' mode */
+ if( (fp = _wfopen( filename, append )) == NULL )
+ {
+ Fail( "ERROR: file failed to open with 'a' mode.\n" );
+ }
+
+ /* Write some text to the file */
+ if(fprintf(fp,"%s","some text") <= 0)
+ {
+ Fail("ERROR: Attempted to WRITE to a file opened with 'a' mode "
+ "but fprintf failed. Either fopen or fprintf have problems.");
+ }
+
+ if(fseek(fp, 0, SEEK_SET))
+ {
+ Fail("ERROR: fseek failed, and this test depends on it.");
+ }
+
+ /* Attempt to read from the 'a' only file, should fail */
+ if(fgets(buffer,10,fp) != NULL)
+ {
+ Fail("ERROR: Tried to READ from a file with 'a' mode set. "
+ "This should fail, but fgets returned success. Either fgets "
+ "or fopen is broken.");
+ }
+
+ // Delete the file now that we're done with it.
+ if (fclose(fp) != 0)
+ {
+ Fail("ERROR: fclose failed to close \"testfile\".\n");
+ }
+
+ if (!DeleteFileA("testfile"))
+ {
+ Fail("ERROR: Failed to delete \"testfile\".\n"
+ " Error is %d\n",
+ GetLastError());
+ }
+
+ /* Attempt to write to a file after using 'a' and fseek */
+ fp = _wfopen(filename2, append);
+ if(fp == NULL)
+ {
+ Fail("ERROR: _wfopen failed to be created with 'a' mode.\n");
+ }
+
+ /* write text to the file initially */
+ if(fprintf(fp,"%s","abcd") <= 0)
+ {
+ Fail("ERROR: Attempted to WRITE to a file opened with 'a' mode "
+ "but fprintf failed. Either fopen or fprintf have problems.\n");
+ }
+
+ /* set the pointer to the front of the file */
+ if(fseek(fp, 0, SEEK_SET))
+ {
+ Fail("ERROR: fseek failed, and this test depends on it.\n");
+ }
+
+ /* using 'a' should still write to the end of the file, not the front */
+ if(fputs("efgh", fp) < 0)
+ {
+ Fail("ERROR: Attempt to WRITE with fputs to the beginning of a file "
+ "opened with 'a' mode succeeded.\n");
+ }
+
+ /* set the pointer to the front of the file */
+ if(fseek(fp, 0, SEEK_SET))
+ {
+ Fail("ERROR: fseek failed, and this test depends on it.\n");
+ }
+
+ /* a file with 'a' mode can only write, so close the file before reading */
+ if(fclose(fp))
+ {
+ Fail("ERROR: fclose failed when it should have succeeded.\n");
+ }
+
+ /* open the file again to read */
+ fp = fopen("testfile2","r");
+ if(fp == NULL)
+ {
+ Fail("ERROR: fopen failed to open the file using 'r' mode");
+ }
+
+ /* Attempt to read from the 'a' only file, should succeed */
+ if(fgets(buffer,10,fp) == NULL)
+ {
+ Fail("ERROR: Tried to READ from a file with 'a' mode set. "
+ "This should pass, but fgets returned failure. Either fgets "
+ "or fopen is broken.\n");
+ }
+
+ /* Compare what was read and what should have been in the file */
+ if(memcmp(buffer,"abcdefgh",8))
+ {
+ Fail("ERROR: The string read should have equaled 'abcdefgh' "
+ "but instead it is %s\n", buffer);
+ }
+
+ // Delete the file now that we're done with it.
+ if (fclose(fp) != 0)
+ {
+ Fail("ERROR: fclose failed to close \"testfile\".\n");
+ }
+
+ if (!DeleteFileA("testfile2"))
+ {
+ Fail("ERROR: Failed to delete \"testfile2\".\n");
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/_wfopen/test6/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_wfopen/test6/testinfo.dat
new file mode 100644
index 0000000000..832f102416
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_wfopen/test6/testinfo.dat
@@ -0,0 +1,15 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = _wfopen
+Name = Positive Test for _wfopen
+TYPE = DEFAULT
+EXE1 = test6
+Description
+= Test to ensure that you can write to a 'a' mode file. And that you can't
+= read from a 'a' mode file.
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/_wfopen/test7/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_wfopen/test7/CMakeLists.txt
new file mode 100644
index 0000000000..47f4804b43
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_wfopen/test7/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test7.c
+)
+
+add_executable(paltest_wfopen_test7
+ ${SOURCES}
+)
+
+add_dependencies(paltest_wfopen_test7 coreclrpal)
+
+target_link_libraries(paltest_wfopen_test7
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_wfopen/test7/test7.c b/src/pal/tests/palsuite/c_runtime/_wfopen/test7/test7.c
new file mode 100644
index 0000000000..0a889adc8a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_wfopen/test7/test7.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: test7.c
+**
+** Purpose: Tests the PAL implementation of the _wfopen function.
+** Test to ensure that you can write to an 'a+' mode file.
+** And that you can read from a 'a+' mode file.
+**
+** Depends:
+** fprintf
+** fgets
+** fseek
+**
+
+**
+**===================================================================*/
+#define UNICODE
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char **argv)
+{
+
+ FILE *fp;
+ char buffer[128];
+ WCHAR filename[] = {'t','e','s','t','f','i','l','e','\0'};
+ WCHAR filename2[] = {'t','e','s','t','f','i','l','e','2','\0'};
+ WCHAR appendplus[] = {'a','+','\0'};
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ /* Open a file with 'a+' mode */
+ if( (fp = _wfopen( filename, appendplus )) == NULL )
+ {
+ Fail( "ERROR: The file failed to open with 'a+' mode.\n" );
+ }
+
+ /* Write some text to the file */
+ if(fprintf(fp,"%s","some text") <= 0)
+ {
+ Fail("ERROR: Attempted to WRITE to a file opened with 'a+' mode "
+ "but fprintf failed. Either fopen or fprintf have problems.");
+ }
+
+ if(fseek(fp, 0, SEEK_SET))
+ {
+ Fail("ERROR: fseek failed, and this test depends on it.");
+ }
+
+ /* Attempt to read from the 'a+' only file, should succeed */
+ if(fgets(buffer,10,fp) == NULL)
+ {
+ Fail("ERROR: Tried to READ from a file with 'a+' mode set. "
+ "This should pass, but fgets returned failure. Either fgets "
+ "or fopen is broken.");
+ }
+
+
+ /* Attempt to write to a file after using 'a+' and fseek */
+ fp = _wfopen(filename2, appendplus);
+ if(fp == NULL)
+ {
+ Fail("ERROR: _wfopen failed to be created with 'a+' mode.\n");
+ }
+
+ /* write text to the file initially */
+ if(fprintf(fp,"%s","abcd") <= 0)
+ {
+ Fail("ERROR: Attempted to WRITE to a file opened with 'a+' mode "
+ "but fprintf failed. Either fopen or fprintf have problems.\n");
+ }
+
+ /* set the pointer to the front of the file */
+ if(fseek(fp, 0, SEEK_SET))
+ {
+ Fail("ERROR: fseek failed, and this test depends on it.\n");
+ }
+
+ /* using 'a+' should still write to the end of the file, not the front */
+ if(fputs("efgh",fp) < 0)
+ {
+ Fail("ERROR: Attempted to WRITE to a file opened with 'a+' mode "
+ "but fputs failed.\n");
+ }
+
+ /* set the pointer to the front of the file */
+ if(fseek(fp, 0, SEEK_SET))
+ {
+ Fail("ERROR: fseek failed, and this test depends on it.\n");
+ }
+
+ /* Attempt to read from the 'a+' only file, should succeed */
+ if(fgets(buffer,10,fp) == NULL)
+ {
+ Fail("ERROR: Tried to READ from a file with 'a+' mode set. "
+ "This should pass, but fgets returned failure. Either fgets "
+ "or fopen is broken.\n");
+ }
+
+ /* Compare what was read and what should have been in the file */
+ if(memcmp(buffer,"abcdefgh",8))
+ {
+ Fail("ERROR: The string read should have equaled 'abcdefgh' "
+ "but instead it is %s\n", buffer);
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/_wfopen/test7/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_wfopen/test7/testinfo.dat
new file mode 100644
index 0000000000..0c50efb759
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_wfopen/test7/testinfo.dat
@@ -0,0 +1,15 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = _wfopen
+Name = Positive Test for _wfopen
+TYPE = DEFAULT
+EXE1 = test7
+Description
+= Test to ensure that you can write to a 'a+' mode file. And that you can
+= read from a 'a+' mode file.
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/_wmakepath/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_wmakepath/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_wmakepath/CMakeLists.txt
@@ -0,0 +1,4 @@
+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
new file mode 100644
index 0000000000..343cb41f51
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_wmakepath/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_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
new file mode 100644
index 0000000000..eb79dc6286
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_wmakepath/test1/test1.c
@@ -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: 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
new file mode 100644
index 0000000000..6720d342ce
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_wmakepath/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 = _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
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_wsplitpath/CMakeLists.txt
@@ -0,0 +1,4 @@
+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
new file mode 100644
index 0000000000..ee9a7a8e96
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_wsplitpath/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_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
new file mode 100644
index 0000000000..305768e53a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_wsplitpath/test1/test1.c
@@ -0,0 +1,151 @@
+// Licensed to the .NET Foundation under one or more 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
new file mode 100644
index 0000000000..30be680bb4
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_wsplitpath/test1/testinfo.dat
@@ -0,0 +1,15 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = 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/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_wtoi/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_wtoi/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/_wtoi/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_wtoi/test1/CMakeLists.txt
new file mode 100644
index 0000000000..9e6610fc0f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_wtoi/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_wtoi_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_wtoi_test1 coreclrpal)
+
+target_link_libraries(paltest_wtoi_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_wtoi/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_wtoi/test1/test1.c
new file mode 100644
index 0000000000..0b14dedd60
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_wtoi/test1/test1.c
@@ -0,0 +1,79 @@
+// Licensed to the .NET Foundation under one or more 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 _wtoi function.
+** Check to ensure that the different ints are handled properly.
+** Exponents and decimals should be treated as invalid characters,
+** causing the conversion to quit. Whitespace before the int is valid.
+** Check would-be octal/hex digits to ensure they're treated no
+** differently than other strings.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+
+struct testCase
+{
+ int IntValue;
+ char avalue[20];
+};
+
+int __cdecl main(int argc, char **argv)
+{
+
+ int result=0;
+ int i=0;
+ WCHAR* temp;
+
+ struct testCase testCases[] =
+ {
+ {1234, "1234"},
+ {-1234, "-1234"},
+ {1234, "+1234"},
+ {1234, "1234.44"},
+ {1234, "1234e-5"},
+ {1234, "1234e+5"},
+ {1234, "1234E5"},
+ {1234, "\t1234"},
+ {0, "0x21"},
+ {17, "017"},
+ {1234, "1234.657e-8"},
+ {1234567, " 1234567e-8 foo"},
+ {0, "foo 32 bar"}
+ };
+
+ if (0 != (PAL_Initialize(argc, argv)))
+ {
+ return FAIL;
+ }
+
+ /* Loop through each case. Convert the wide string to an int
+ and then compare to ensure that it is the correct value.
+ */
+
+ for(i = 0; i < sizeof(testCases) / sizeof(struct testCase); i++)
+ {
+ /* Convert to a wide string, then call _wtoi to convert to an int */
+ temp = convert(testCases[i].avalue);
+ result = _wtoi(temp);
+ free(temp);
+ if (testCases[i].IntValue != result)
+ {
+ Fail("ERROR: _wtoi misinterpreted \"%s\" as %i instead of %i.\n",
+ testCases[i].avalue,
+ result,
+ testCases[i].IntValue);
+ }
+
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/_wtoi/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_wtoi/test1/testinfo.dat
new file mode 100644
index 0000000000..4a1f21d4b9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_wtoi/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 = _wtoi
+Name = Test _wtoi on valid and invalid ints in a variety of formats
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Tests the PAL implementation of the _wtoi function.
+= Check to ensure that the different ints are handled properly.
+= Exponents and decimals should be treated as invalid characters,
+= causing the conversion to quit. Whitespace before the int is valid.
+= Check would-be octal/hex digits to ensure they're treated no
+= differently than other strings.
diff --git a/src/pal/tests/palsuite/c_runtime/abs/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/abs/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/abs/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/abs/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/abs/test1/CMakeLists.txt
new file mode 100644
index 0000000000..c8a8595d01
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/abs/test1/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ abs.c
+)
+
+add_executable(paltest_abs_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_abs_test1 coreclrpal)
+
+target_link_libraries(paltest_abs_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/abs/test1/abs.c b/src/pal/tests/palsuite/c_runtime/abs/test1/abs.c
new file mode 100644
index 0000000000..233a5dcb30
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/abs/test1/abs.c
@@ -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: abs.c (test 1)
+**
+** Purpose: Tests the PAL implementation of the abs function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+struct TESTS
+{
+ int nTest;
+ int nResult;
+};
+
+int __cdecl main(int argc, char *argv[])
+{
+ int i = 0;
+ int nRc = 0;
+ struct TESTS testCase[] =
+ {
+ {0, 0},
+ {1, 1},
+ {-1, 1}
+ };
+
+
+ if (0 != PAL_Initialize(argc,argv))
+ {
+ return FAIL;
+ }
+
+ for (i = 0; i < (sizeof(testCase)/sizeof(struct TESTS)); i++)
+ {
+ nRc = abs(testCase[i].nTest);
+ if (nRc != testCase[i].nResult)
+ {
+ Fail("abs: ERROR -> abs(%d) returned %d "
+ "when it was expected to return %d \n",
+ testCase[i].nTest,
+ nRc,
+ testCase[i].nResult);
+ }
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/abs/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/abs/test1/testinfo.dat
new file mode 100644
index 0000000000..98e2af21d4
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/abs/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 = abs
+Name = test for abs (test 1)
+Type = DEFAULT
+EXE1 = abs
+Description
+= Test abs by passing a list of values and ensuring the
+= proper absolute value is returned.
diff --git a/src/pal/tests/palsuite/c_runtime/acos/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/acos/CMakeLists.txt
new file mode 100644
index 0000000000..5e1ef7f28b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/acos/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/acos/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/acos/test1/CMakeLists.txt
new file mode 100644
index 0000000000..978ab427e8
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/acos/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_acos_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_acos_test1 coreclrpal)
+
+target_link_libraries(paltest_acos_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/acos/test1/test1.c b/src/pal/tests/palsuite/c_runtime/acos/test1/test1.c
new file mode 100644
index 0000000000..c6ed0692c7
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/acos/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 acos return the correct values
+**
+** Dependencies: PAL_Initialize
+** PAL_Terminate
+** Fail
+** fabs
+**
+**===========================================================================*/
+
+#include <palsuite.h>
+
+// binary64 (double) has a machine epsilon of 2^-52 (approx. 2.22e-16). However, this
+// is slightly too accurate when writing tests meant to run against libm implementations
+// for various platforms. 2^-50 (approx. 8.88e-16) 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 (15-17 digits).
+
+// For example, a test with an expect result in the format of 0.xxxxxxxxxxxxxxxxx will use
+// PAL_EPSILON for the variance, while an expected result in the format of 0.0xxxxxxxxxxxxxxxxx
+// will use PAL_EPSILON / 10 and and expected result in the format of x.xxxxxxxxxxxxxxxx will
+// use PAL_EPSILON * 10.
+#define PAL_EPSILON 8.8817841970012523e-16
+
+#define PAL_NAN sqrt(-1.0)
+#define PAL_POSINF -log(0.0)
+#define PAL_NEGINF log(0.0)
+
+/**
+ * Helper test structure
+ */
+struct test
+{
+ double value; /* value to test the function with */
+ double expected; /* expected result */
+ double variance; /* maximum delta between the expected and actual result */
+};
+
+/**
+ * validate
+ *
+ * test validation function
+ */
+void __cdecl validate(double value, double expected, double variance)
+{
+ double result = acos(value);
+
+ /*
+ * The test is valid when the difference between result
+ * and expected is less than or equal to variance
+ */
+ double delta = fabs(result - expected);
+
+ if (delta > variance)
+ {
+ Fail("acos(%g) returned %20.17g when it should have returned %20.17g",
+ value, result, expected);
+ }
+}
+
+/**
+ * validate
+ *
+ * test validation function for values returning NaN
+ */
+void __cdecl validate_isnan(double value)
+{
+ double result = acos(value);
+
+ if (!_isnan(result))
+ {
+ Fail("acos(%g) returned %20.17g when it should have returned %20.17g",
+ value, result, PAL_NAN);
+ }
+}
+
+/**
+ * main
+ *
+ * executable entry point
+ */
+int __cdecl main(int argc, char **argv)
+{
+ struct test tests[] =
+ {
+ /* value expected variance */
+ { -1, 3.1415926535897932, PAL_EPSILON * 10 }, // expected: pi
+ { -0.91173391478696510, 2.7182818284590452, PAL_EPSILON * 10 }, // expected: e
+ { -0.66820151019031295, 2.3025850929940457, PAL_EPSILON * 10 }, // expected: ln(10)
+ { 0, 1.5707963267948966, PAL_EPSILON * 10 }, // expected: pi / 2
+ { 0.12775121753523991, 1.4426950408889634, PAL_EPSILON * 10 }, // expected: log2(e)
+ { 0.15594369476537447, 1.4142135623730950, PAL_EPSILON * 10 }, // expected: sqrt(2)
+ { 0.42812514788535792, 1.1283791670955126, PAL_EPSILON * 10 }, // expected: 2 / sqrt(pi)
+ { 0.54030230586813972, 1, PAL_EPSILON * 10 },
+ { 0.70710678118654752, 0.78539816339744831, PAL_EPSILON }, // expected: pi / 4, value: 1 / sqrt(2)
+ { 0.76024459707563015, 0.70710678118654752, PAL_EPSILON }, // expected: 1 / sqrt(2)
+ { 0.76923890136397213, 0.69314718055994531, PAL_EPSILON }, // expected: ln(2)
+ { 0.80410982822879171, 0.63661977236758134, PAL_EPSILON }, // expected: 2 / pi
+ { 0.90716712923909839, 0.43429448190325183, PAL_EPSILON }, // expected: log10(e)
+ { 0.94976571538163866, 0.31830988618379067, 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/acos/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/acos/test1/testinfo.dat
new file mode 100644
index 0000000000..4b43982fca
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/acos/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 = acos
+Name = Positive Test for acos
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Passes a series of values to the acos() 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/asin/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/asin/CMakeLists.txt
new file mode 100644
index 0000000000..5e1ef7f28b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/asin/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/asin/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/asin/test1/CMakeLists.txt
new file mode 100644
index 0000000000..a3aec3f60f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/asin/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_asin_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_asin_test1 coreclrpal)
+
+target_link_libraries(paltest_asin_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/asin/test1/test1.c b/src/pal/tests/palsuite/c_runtime/asin/test1/test1.c
new file mode 100644
index 0000000000..0a63356ed0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/asin/test1/test1.c
@@ -0,0 +1,146 @@
+// Licensed to the .NET Foundation under one or more 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 asin return the correct values
+**
+** Dependencies: PAL_Initialize
+** PAL_Terminate
+** Fail
+** fabs
+**
+**===========================================================================*/
+
+#include <palsuite.h>
+
+// binary64 (double) has a machine epsilon of 2^-52 (approx. 2.22e-16). However, this
+// is slightly too accurate when writing tests meant to run against libm implementations
+// for various platforms. 2^-50 (approx. 8.88e-16) 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 (15-17 digits).
+
+// For example, a test with an expect result in the format of 0.xxxxxxxxxxxxxxxxx will use
+// PAL_EPSILON for the variance, while an expected result in the format of 0.0xxxxxxxxxxxxxxxxx
+// will use PAL_EPSILON / 10 and and expected result in the format of x.xxxxxxxxxxxxxxxx will
+// use PAL_EPSILON * 10.
+#define PAL_EPSILON 8.8817841970012523e-16
+
+#define PAL_NAN sqrt(-1.0)
+#define PAL_POSINF -log(0.0)
+#define PAL_NEGINF log(0.0)
+
+/**
+ * Helper test structure
+ */
+struct test
+{
+ double value; /* value to test the function with */
+ double expected; /* expected result */
+ double variance; /* maximum delta between the expected and actual result */
+};
+
+/**
+ * validate
+ *
+ * test validation function
+ */
+void __cdecl validate(double value, double expected, double variance)
+{
+ double result = asin(value);
+
+ /*
+ * The test is valid when the difference between result
+ * and expected is less than or equal to variance
+ */
+ double delta = fabs(result - expected);
+
+ if (delta > variance)
+ {
+ Fail("asin(%g) returned %20.17g when it should have returned %20.17g",
+ value, result, expected);
+ }
+}
+
+/**
+ * validate
+ *
+ * test validation function for values returning NaN
+ */
+void __cdecl validate_isnan(double value)
+{
+ double result = asin(value);
+
+ if (!_isnan(result))
+ {
+ Fail("asin(%g) returned %20.17g when it should have returned %20.17g",
+ value, result, PAL_NAN);
+ }
+}
+
+/**
+ * validate
+ *
+ * test validation function for values returning +INF
+ */
+void __cdecl validate_isinf_positive(double value)
+{
+ double result = asin(value);
+
+ if (result != PAL_POSINF)
+ {
+ Fail("asin(%g) returned %20.17g when it should have returned %20.17g",
+ 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.31296179620778659, 0.31830988618379067, PAL_EPSILON }, // expected: 1 / pi
+ { 0.41078129050290870, 0.42331082513074800, PAL_EPSILON }, // expected: pi - e
+ { 0.42077048331375735, 0.43429448190325183, PAL_EPSILON }, // expected: log10(e)
+ { 0.59448076852482208, 0.63661977236758134, PAL_EPSILON }, // expected: 2 / pi
+ { 0.63896127631363480, 0.69314718055994531, PAL_EPSILON }, // expected: ln(2)
+ { 0.64963693908006244, 0.70710678118654752, PAL_EPSILON }, // expected: 1 / sqrt(2)
+ { 0.70710678118654752, 0.78539816339744831, PAL_EPSILON }, // expected: pi / 4, value: 1 / sqrt(2)
+ { 0.74398033695749319, 0.83900756059574755, PAL_EPSILON }, // expected: pi - ln(10)
+ { 0.84147098480789651, 1, PAL_EPSILON * 10 },
+ { 0.90371945743584630, 1.1283791670955126, PAL_EPSILON * 10 }, // expected: 2 / sqrt(pi)
+ { 0.98776594599273553, 1.4142135623730950, PAL_EPSILON * 10 }, // expected: sqrt(2)
+ { 0.99180624439366372, 1.4426950408889634, PAL_EPSILON * 10 }, // expected: log2(e)
+ { 1, 1.5707963267948966, 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/asin/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/asin/test1/testinfo.dat
new file mode 100644
index 0000000000..fba9f95a21
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/asin/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 = asin
+Name = Positive Test for asin
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Passes a series of values to the asin() 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/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/atan/CMakeLists.txt
new file mode 100644
index 0000000000..5e1ef7f28b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/atan/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/atan/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/atan/test1/CMakeLists.txt
new file mode 100644
index 0000000000..b0b84e7c07
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/atan/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_atan_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_atan_test1 coreclrpal)
+
+target_link_libraries(paltest_atan_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/atan/test1/test1.c b/src/pal/tests/palsuite/c_runtime/atan/test1/test1.c
new file mode 100644
index 0000000000..6840d46172
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/atan/test1/test1.c
@@ -0,0 +1,128 @@
+// Licensed to the .NET Foundation under one or more 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 atan return the correct values
+**
+** Dependencies: PAL_Initialize
+** PAL_Terminate
+** Fail
+** fabs
+**
+**===========================================================================*/
+
+#include <palsuite.h>
+
+// binary64 (double) has a machine epsilon of 2^-52 (approx. 2.22e-16). However, this
+// is slightly too accurate when writing tests meant to run against libm implementations
+// for various platforms. 2^-50 (approx. 8.88e-16) 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 (15-17 digits).
+
+// For example, a test with an expect result in the format of 0.xxxxxxxxxxxxxxxxx will use
+// PAL_EPSILON for the variance, while an expected result in the format of 0.0xxxxxxxxxxxxxxxxx
+// will use PAL_EPSILON / 10 and and expected result in the format of x.xxxxxxxxxxxxxxxx will
+// use PAL_EPSILON * 10.
+#define PAL_EPSILON 8.8817841970012523e-16
+
+#define PAL_NAN sqrt(-1.0)
+#define PAL_POSINF -log(0.0)
+#define PAL_NEGINF log(0.0)
+
+/**
+ * Helper test structure
+ */
+struct test
+{
+ double value; /* value to test the function with */
+ double expected; /* expected result */
+ double variance; /* maximum delta between the expected and actual result */
+};
+
+/**
+ * validate
+ *
+ * test validation function
+ */
+void __cdecl validate(double value, double expected, double variance)
+{
+ double result = atan(value);
+
+ /*
+ * The test is valid when the difference between result
+ * and expected is less than or equal to variance
+ */
+ double delta = fabs(result - expected);
+
+ if (delta > variance)
+ {
+ Fail("atan(%g) returned %20.17g when it should have returned %20.17g",
+ value, result, expected);
+ }
+}
+
+/**
+ * validate
+ *
+ * test validation function for values returning NaN
+ */
+void __cdecl validate_isnan(double value)
+{
+ double result = atan(value);
+
+ if (!_isnan(result))
+ {
+ Fail("atan(%g) returned %20.17g when it should have returned %20.17g",
+ 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.32951473309607836, 0.31830988618379067, PAL_EPSILON }, // expected: 1 / pi
+ { 0.45054953406980750, 0.42331082513074800, PAL_EPSILON }, // expected: pi - e
+ { 0.46382906716062964, 0.43429448190325183, PAL_EPSILON }, // expected: log10(e)
+ { 0.73930295048660405, 0.63661977236758134, PAL_EPSILON }, // expected: 2 / pi
+ { 0.83064087786078395, 0.69314718055994531, PAL_EPSILON }, // expected: ln(2)
+ { 0.85451043200960189, 0.70710678118654752, PAL_EPSILON }, // expected: 1 / sqrt(2)
+ { 1, 0.78539816339744831, PAL_EPSILON }, // expected: pi / 4
+ { 1.1134071468135374, 0.83900756059574755, PAL_EPSILON }, // expected: pi - ln(10)
+ { 1.5574077246549022, 1, PAL_EPSILON * 10 },
+ { 2.1108768356626451, 1.1283791670955126, PAL_EPSILON * 10 }, // expected: 2 / sqrt(pi)
+ { 6.3341191670421916, 1.4142135623730950, PAL_EPSILON * 10 }, // expected: sqrt(2)
+ { 7.7635756709721848, 1.4426950408889634, PAL_EPSILON * 10 }, // expected: log2(e)
+ { PAL_POSINF, 1.5707963267948966, 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/atan/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/atan/test1/testinfo.dat
new file mode 100644
index 0000000000..8a181b8a94
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/atan/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 = atan
+Name = Positive Test for atan
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Passes a series of values to the atan() function,
+= checking each for the expected result.
diff --git a/src/pal/tests/palsuite/c_runtime/atan2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/atan2/CMakeLists.txt
new file mode 100644
index 0000000000..5e1ef7f28b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/atan2/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/atan2/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/atan2/test1/CMakeLists.txt
new file mode 100644
index 0000000000..8bd69da2fa
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/atan2/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_atan2_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_atan2_test1 coreclrpal)
+
+target_link_libraries(paltest_atan2_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/atan2/test1/test1.c b/src/pal/tests/palsuite/c_runtime/atan2/test1/test1.c
new file mode 100644
index 0000000000..15aa8f53b9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/atan2/test1/test1.c
@@ -0,0 +1,148 @@
+// Licensed to the .NET Foundation under one or more 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 atan2 returns correct values for a subset of values.
+** Tests with positive and negative values of x and y to ensure
+** atan2 is returning results from the correct quadrant.
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+// binary64 (double) has a machine epsilon of 2^-52 (approx. 2.22e-16). However, this
+// is slightly too accurate when writing tests meant to run against libm implementations
+// for various platforms. 2^-50 (approx. 8.88e-16) 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 (15-17 digits).
+
+// For example, a test with an expect result in the format of 0.xxxxxxxxxxxxxxxxx will use
+// PAL_EPSILON for the variance, while an expected result in the format of 0.0xxxxxxxxxxxxxxxxx
+// will use PAL_EPSILON / 10 and and expected result in the format of x.xxxxxxxxxxxxxxxx will
+// use PAL_EPSILON * 10.
+#define PAL_EPSILON 8.8817841970012523e-16
+
+#define PAL_NAN sqrt(-1.0)
+#define PAL_POSINF -log(0.0)
+#define PAL_NEGINF log(0.0)
+
+struct test
+{
+ double y; /* second component of the value to test the function with */
+ double x; /* first component of the value to test the function with */
+ double expected; /* expected result */
+ double variance; /* maximum delta between the expected and actual result */
+};
+
+/**
+ * validate
+ *
+ * test validation function
+ */
+void __cdecl validate(double y, double x, double expected, double variance)
+{
+ double result = atan2(y, x);
+
+ /*
+ * The test is valid when the difference between result
+ * and expected is less than or equal to variance
+ */
+ double delta = fabs(result - expected);
+
+ if (delta > variance)
+ {
+ Fail("atan2(%g, %g) returned %20.17g when it should have returned %20.17g",
+ y, x, result, expected);
+ }
+}
+
+/**
+ * validate
+ *
+ * test validation function for values returning NaN
+ */
+void __cdecl validate_isnan(double y, double x)
+{
+ double result = atan2(y, x);
+
+ if (!_isnan(result))
+ {
+ Fail("atan2(%g, %g) returned %20.17g when it should have returned %20.17g",
+ 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.31296179620778659, 0.94976571538163866, 0.31830988618379067, PAL_EPSILON }, // expected: 1 / pi
+ { 0.42077048331375735, 0.90716712923909839, 0.43429448190325183, PAL_EPSILON }, // expected: log10(e)
+ { 0.59448076852482208, 0.80410982822879171, 0.63661977236758134, PAL_EPSILON }, // expected: 2 / pi
+ { 0.63896127631363480, 0.76923890136397213, 0.69314718055994531, PAL_EPSILON }, // expected: ln(2)
+ { 0.64963693908006244, 0.76024459707563015, 0.70710678118654752, PAL_EPSILON }, // expected: 1 / sqrt(2)
+ { 0.70710678118654752, 0.70710678118654752, 0.78539816339744831, PAL_EPSILON }, // expected: pi / 4, value: 1 / sqrt(2)
+ { 1, 1, 0.78539816339744831, PAL_EPSILON }, // expected: pi / 4
+ { PAL_POSINF, PAL_POSINF, 0.78539816339744831, PAL_EPSILON }, // expected: pi / 4
+ { 0.84147098480789651, 0.54030230586813972, 1, PAL_EPSILON * 10 },
+ { 0.90371945743584630, 0.42812514788535792, 1.1283791670955126, PAL_EPSILON * 10 }, // expected: 2 / sqrt(pi)
+ { 0.98776594599273553, 0.15594369476537447, 1.4142135623730950, PAL_EPSILON * 10 }, // expected: sqrt(2)
+ { 0.99180624439366372, 0.12775121753523991, 1.4426950408889634, PAL_EPSILON * 10 }, // expected: log2(e)
+ { 1, 0, 1.5707963267948966, PAL_EPSILON * 10 }, // expected: pi / 2
+ { PAL_POSINF, 0, 1.5707963267948966, PAL_EPSILON * 10 }, // expected: pi / 2
+ { PAL_POSINF, 1, 1.5707963267948966, PAL_EPSILON * 10 }, // expected: pi / 2
+ { 0.74398033695749319, -0.66820151019031295, 2.3025850929940457, PAL_EPSILON * 10 }, // expected: ln(10)
+ { 0.41078129050290870, -0.91173391478696510, 2.7182818284590452, PAL_EPSILON * 10 }, // expected: e
+ { 0, -1, 3.1415926535897932, 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 double pi = 3.1415926535897932;
+
+ 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.0);
+ validate_isnan(PAL_NAN, 0);
+ validate_isnan(PAL_NAN, 1);
+
+ validate_isnan(-1, PAL_NAN);
+ validate_isnan(-0.0, 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/atan2/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/atan2/test1/testinfo.dat
new file mode 100644
index 0000000000..78fb09118e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/atan2/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 = atan2
+Name = Test #1 for atan2
+Type = DEFAULT
+EXE1 = test1
+Description
+=Tests that atan2 returns correct values for a subset of values.
+=Tests with positive and negative values of x and y to ensure
+=atan2 is returning results from the correct quadrant.
diff --git a/src/pal/tests/palsuite/c_runtime/atof/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/atof/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/atof/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/atof/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/atof/test1/CMakeLists.txt
new file mode 100644
index 0000000000..1f34b7ebf5
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/atof/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_atof_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_atof_test1 coreclrpal)
+
+target_link_libraries(paltest_atof_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/atof/test1/test1.c b/src/pal/tests/palsuite/c_runtime/atof/test1/test1.c
new file mode 100644
index 0000000000..a973133f9e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/atof/test1/test1.c
@@ -0,0 +1,75 @@
+// Licensed to the .NET Foundation under one or more 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 to atof() a series of strings containing floats,
+** checking that each one is correctly extracted.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+#include <float.h>
+
+struct testCase
+{
+ float fvalue;
+ char avalue[20];
+};
+
+int __cdecl main(int argc, char **argv)
+{
+ int i = 0;
+ double f = 0;
+ struct testCase testCases[] =
+ {
+ {1234, "1234"},
+ {-1234, "-1234"},
+ {1234e-5, "1234e-5"},
+ {1234e+5, "1234e+5"},
+ {1234e5, "1234E5"},
+ {1234.567e-8, "1234.567e-8"},
+ {1234.567e-8, " 1234.567e-8 foo"},
+ {0,"a12"}
+ };
+
+ /*
+ * 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++)
+ {
+ /*Convert the string to a float.*/
+ f = atof(testCases[i].avalue);
+ double result = f - testCases[i].fvalue;
+
+ if (fabs(result) > FLT_EPSILON)
+ {
+ Fail ("atof misinterpreted \"%s\" as %g instead of %g. result %g fabs %g\n",
+ testCases[i].avalue, f, testCases[i].fvalue, result, fabs(result));
+ }
+ }
+ PAL_Terminate();
+ return PASS;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/atof/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/atof/test1/testinfo.dat
new file mode 100644
index 0000000000..7f37affb9c
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/atof/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 = atof
+Name = Positive Test for atof
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Passes to atof() a series of strings containing floats, checking that
+= each one is correctly extracted.
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/atoi/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/atoi/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/atoi/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/atoi/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/atoi/test1/CMakeLists.txt
new file mode 100644
index 0000000000..3549aca737
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/atoi/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_atoi_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_atoi_test1 coreclrpal)
+
+target_link_libraries(paltest_atoi_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/atoi/test1/test1.c b/src/pal/tests/palsuite/c_runtime/atoi/test1/test1.c
new file mode 100644
index 0000000000..2554d4c353
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/atoi/test1/test1.c
@@ -0,0 +1,86 @@
+// Licensed to the .NET Foundation under one or more 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 atoi function.
+** Check to ensure that the different ints (normal,
+** negative, decimal,exponent), all work as expected with
+** this function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+
+struct testCase
+{
+ int IntValue;
+ char avalue[20];
+};
+
+int __cdecl main(int argc, char **argv)
+{
+
+ int result=0;
+ int i=0;
+
+ struct testCase testCases[] =
+ {
+ {1234, "1234"},
+ {-1234, "-1234"},
+ {1234, "1234.44"},
+ {1234, "1234e-5"},
+ {1234, "1234e+5"},
+ {1234, "1234E5"},
+ {1234, "1234.657e-8"},
+ {1234567, " 1234567e-8 foo"},
+ {0, "aaa 32 test"}
+ };
+
+ /*
+ * Initialize the PAL and return FAIL if this fails
+ */
+ if (0 != (PAL_Initialize(argc, argv)))
+ {
+ return FAIL;
+ }
+
+ /* Loop through each case. Convert the string to an int
+ and then compare to ensure that it is the correct value.
+ */
+
+ for(i = 0; i < sizeof(testCases) / sizeof(struct testCase); i++)
+ {
+ /*Convert the string to an int.*/
+ result = atoi(testCases[i].avalue);
+
+ if (testCases[i].IntValue != result)
+ {
+ Fail("ERROR: atoi misinterpreted \"%s\" as %i instead of %i.\n"
+ , testCases[i].avalue, result, testCases[i].IntValue);
+ }
+
+ }
+
+
+ PAL_Terminate();
+ return PASS;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/atoi/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/atoi/test1/testinfo.dat
new file mode 100644
index 0000000000..36a1a4499f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/atoi/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 = atoi
+Name = Positive Test for atoi
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Tests the PAL implementation of the atoi function.
+= Check to ensure that the different ints (normal, negative, decimal,
+= exponent), all work as expected with this function.
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/atol/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/atol/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/atol/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/atol/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/atol/test1/CMakeLists.txt
new file mode 100644
index 0000000000..4fea187ad8
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/atol/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_atol_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_atol_test1 coreclrpal)
+
+target_link_libraries(paltest_atol_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/atol/test1/test1.c b/src/pal/tests/palsuite/c_runtime/atol/test1/test1.c
new file mode 100644
index 0000000000..5ad85d873f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/atol/test1/test1.c
@@ -0,0 +1,88 @@
+// Licensed to the .NET Foundation under one or more 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 atol function.
+** Check to ensure that the different ints (normal,
+** negative, decimal,exponent), all work as expected with
+** this function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+struct testCase
+{
+ LONG LongValue;
+ char avalue[20];
+};
+
+int __cdecl main(int argc, char **argv)
+{
+
+ LONG result=0;
+ int i=0;
+
+ struct testCase testCases[] =
+ {
+ {1234, "1234"},
+ {-1234, "-1234"},
+ {1234, "1234.44"},
+ {1234, "1234e-5"},
+ {1234, "1234e+5"},
+ {1234, "1234E5"},
+ {1234, "1234.657e-8"},
+ {1234, "1234d-5"},
+ {1234, "1234d+5"},
+ {1234, "1234D5"},
+ {1234567, " 1234567e-8 foo"},
+ {0, "aaa 32 test"}
+ };
+
+ /*
+ * Initialize the PAL and return FAIL if this fails
+ */
+ if (0 != (PAL_Initialize(argc, argv)))
+ {
+ return FAIL;
+ }
+
+ /* Loop through each case. Convert the string to a LONG
+ and then compare to ensure that it is the correct value.
+ */
+
+ for(i = 0; i < sizeof(testCases) / sizeof(struct testCase); i++)
+ {
+ /*Convert the string to a LONG.*/
+ result = atol(testCases[i].avalue);
+
+ if (testCases[i].LongValue != result)
+ {
+ Fail("ERROR: atol misinterpreted \"%s\" as %d instead of %d.\n"
+ , testCases[i].avalue, result, testCases[i].LongValue);
+ }
+
+ }
+
+
+ PAL_Terminate();
+ return PASS;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/atol/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/atol/test1/testinfo.dat
new file mode 100644
index 0000000000..962a1676a1
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/atol/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 = atol
+Name = Positive Test for atol
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Tests the PAL implementation of the atol function.
+= Check to ensure that the different ints (normal, negative, decimal,
+= exponent), all work as expected with this function.
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/bsearch/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/bsearch/CMakeLists.txt
new file mode 100644
index 0000000000..ef14ea5352
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/bsearch/CMakeLists.txt
@@ -0,0 +1,5 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+add_subdirectory(test2)
+
diff --git a/src/pal/tests/palsuite/c_runtime/bsearch/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/bsearch/test1/CMakeLists.txt
new file mode 100644
index 0000000000..d2018f3325
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/bsearch/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_bsearch_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_bsearch_test1 coreclrpal)
+
+target_link_libraries(paltest_bsearch_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/bsearch/test1/test1.c b/src/pal/tests/palsuite/c_runtime/bsearch/test1/test1.c
new file mode 100644
index 0000000000..c4b91738eb
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/bsearch/test1/test1.c
@@ -0,0 +1,48 @@
+// Licensed to the .NET Foundation under one or more 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 bsearch to find a character in a sorted buffer, and
+** verifies that the correct position is returned.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+int __cdecl charcmp(const void *pa, const void *pb)
+{
+ return memcmp(pa, pb, 1);
+}
+
+int __cdecl main(int argc, char **argv)
+{
+
+ const char array[] = "abcdefghij";
+ char * found=NULL;
+
+ /*
+ * Initialize the PAL and return FAIL if this fails
+ */
+ if (0 != (PAL_Initialize(argc, argv)))
+ {
+ return FAIL;
+ }
+
+ found = (char *)bsearch(&"d", array, sizeof(array) - 1, (sizeof(char))
+ , charcmp);
+ if (found != array + 3)
+ {
+ Fail ("bsearch was unable to find a specified character in a "
+ "sorted list.\n");
+ }
+ PAL_Terminate();
+ return PASS;
+}
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/bsearch/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/bsearch/test1/testinfo.dat
new file mode 100644
index 0000000000..3eb7369ac2
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/bsearch/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 = bsearch
+Name = Positive Test for bsearch
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Calls bsearch to find a character in a sorted buffer, and
+= verifies that the correct position is returned.
+
diff --git a/src/pal/tests/palsuite/c_runtime/bsearch/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/bsearch/test2/CMakeLists.txt
new file mode 100644
index 0000000000..dc65560196
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/bsearch/test2/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test2.c
+)
+
+add_executable(paltest_bsearch_test2
+ ${SOURCES}
+)
+
+add_dependencies(paltest_bsearch_test2 coreclrpal)
+
+target_link_libraries(paltest_bsearch_test2
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/bsearch/test2/test2.c b/src/pal/tests/palsuite/c_runtime/bsearch/test2/test2.c
new file mode 100644
index 0000000000..6de1b3fada
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/bsearch/test2/test2.c
@@ -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: test1.c
+**
+** Purpose: Calls bsearch to find a character in a sorted buffer,
+** that does not exist.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+int __cdecl charcmp(const void *pa, const void *pb)
+{
+ return *(const char *)pa - *(const char *)pb;
+}
+
+int __cdecl main(int argc, char **argv)
+{
+
+ const char array[] = "abcefghij";
+ const char missing[] = "0dz";
+ char * found=NULL;
+ const char * candidate = missing;
+
+ /*
+ * Initialize the PAL and return FAIL if this fails
+ */
+ if (0 != (PAL_Initialize(argc, argv)))
+ {
+ return FAIL;
+ }
+
+ while (*candidate) {
+ found = (char *)bsearch(candidate, array, sizeof(array) - 1,
+ (sizeof(char)), charcmp);
+ if (found != NULL)
+ {
+ Fail ("ERROR: bsearch was able to find a specified character '%c' "
+ "in a sorted list '%s' as '%c' "
+ "even though the character is not in the list.\n",
+ *candidate, array, *found);
+ }
+
+ candidate++;
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/bsearch/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/bsearch/test2/testinfo.dat
new file mode 100644
index 0000000000..faa9dc1be6
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/bsearch/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 = bsearch
+Name = Negative Test for bsearch
+TYPE = DEFAULT
+EXE1 = test2
+Description
+= Calls bsearch to find a character in a sorted buffer,
+= that does not exist.
+
diff --git a/src/pal/tests/palsuite/c_runtime/ceil/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/ceil/CMakeLists.txt
new file mode 100644
index 0000000000..5e1ef7f28b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/ceil/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/ceil/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/ceil/test1/CMakeLists.txt
new file mode 100644
index 0000000000..c73ad1dbbe
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/ceil/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_ceil_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_ceil_test1 coreclrpal)
+
+target_link_libraries(paltest_ceil_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/ceil/test1/test1.c b/src/pal/tests/palsuite/c_runtime/ceil/test1/test1.c
new file mode 100644
index 0000000000..e6e36e6e33
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/ceil/test1/test1.c
@@ -0,0 +1,132 @@
+// Licensed to the .NET Foundation under one or more 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 ceil with simple positive and negative values. Also tests
+** extreme cases like extremely small values and positive and
+** negative infinity. Makes sure that calling ceil on NaN returns
+** NaN
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+// binary64 (double) has a machine epsilon of 2^-52 (approx. 2.22e-16). However, this
+// is slightly too accurate when writing tests meant to run against libm implementations
+// for various platforms. 2^-50 (approx. 8.88e-16) 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 (15-17 digits).
+
+// For example, a test with an expect result in the format of 0.xxxxxxxxxxxxxxxxx will use
+// PAL_EPSILON for the variance, while an expected result in the format of 0.0xxxxxxxxxxxxxxxxx
+// will use PAL_EPSILON / 10 and and expected result in the format of x.xxxxxxxxxxxxxxxx will
+// use PAL_EPSILON * 10.
+#define PAL_EPSILON 8.8817841970012523e-16
+
+#define PAL_NAN sqrt(-1.0)
+#define PAL_POSINF -log(0.0)
+#define PAL_NEGINF log(0.0)
+
+/**
+ * Helper test structure
+ */
+struct test
+{
+ double value; /* value to test the function with */
+ double expected; /* expected result */
+ double variance; /* maximum delta between the expected and actual result */
+};
+
+/**
+ * validate
+ *
+ * test validation function
+ */
+void __cdecl validate(double value, double expected, double variance)
+{
+ double result = ceil(value);
+
+ /*
+ * The test is valid when the difference between result
+ * and expected is less than or equal to variance
+ */
+ double delta = fabs(result - expected);
+
+ if (delta > variance)
+ {
+ Fail("ceil(%g) returned %20.17g when it should have returned %20.17g",
+ value, result, expected);
+ }
+}
+
+/**
+ * validate
+ *
+ * test validation function for values returning NaN
+ */
+void __cdecl validate_isnan(double value)
+{
+ double result = ceil(value);
+
+ if (!_isnan(result))
+ {
+ Fail("ceil(%g) returned %20.17g when it should have returned %20.17g",
+ value, result, PAL_NAN);
+ }
+}
+
+/**
+ * main
+ *
+ * executable entry point
+ */
+int __cdecl main(int argc, char *argv[])
+{
+ struct test tests[] =
+ {
+ /* value expected variance */
+ { 0.31830988618379067, 1, PAL_EPSILON * 10 }, // value: 1 / pi
+ { 0.43429448190325183, 1, PAL_EPSILON * 10 }, // value: log10(e)
+ { 0.63661977236758134, 1, PAL_EPSILON * 10 }, // value: 2 / pi
+ { 0.69314718055994531, 1, PAL_EPSILON * 10 }, // value: ln(2)
+ { 0.70710678118654752, 1, PAL_EPSILON * 10 }, // value: 1 / sqrt(2)
+ { 0.78539816339744831, 1, PAL_EPSILON * 10 }, // value: pi / 4
+ { 1.1283791670955126, 2, PAL_EPSILON * 10 }, // value: 2 / sqrt(pi)
+ { 1.4142135623730950, 2, PAL_EPSILON * 10 }, // value: sqrt(2)
+ { 1.4426950408889634, 2, PAL_EPSILON * 10 }, // value: log2(e)
+ { 1.5707963267948966, 2, PAL_EPSILON * 10 }, // value: pi / 2
+ { 2.3025850929940457, 3, PAL_EPSILON * 10 }, // value: ln(10)
+ { 2.7182818284590452, 3, PAL_EPSILON * 10 }, // value: e
+ { 3.1415926535897932, 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.0, 0, PAL_EPSILON);
+
+ validate( 1, 1, PAL_EPSILON * 10);
+ validate(-1.0, -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/ceil/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/ceil/test1/testinfo.dat
new file mode 100644
index 0000000000..84e80a9cb7
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/ceil/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 = ceil
+Name = Test #1 for ceil
+TYPE = DEFAULT
+EXE1 = test1
+Description
+=Tests ceil with simple positive and negative values. Also tests
+=extreme cases like extremely small values and positive and negative
+=infinity. Makes sure that calling ceil on NaN returns NaN
diff --git a/src/pal/tests/palsuite/c_runtime/cos/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/cos/CMakeLists.txt
new file mode 100644
index 0000000000..5e1ef7f28b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/cos/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/cos/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/cos/test1/CMakeLists.txt
new file mode 100644
index 0000000000..1dda9a2563
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/cos/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_cos_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_cos_test1 coreclrpal)
+
+target_link_libraries(paltest_cos_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/cos/test1/test1.c b/src/pal/tests/palsuite/c_runtime/cos/test1/test1.c
new file mode 100644
index 0000000000..8c1c7300e6
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/cos/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: Test to ensure that cos return the correct values
+**
+** Dependencies: PAL_Initialize
+** PAL_Terminate
+** Fail
+** fabs
+**
+**===========================================================================*/
+
+#include <palsuite.h>
+
+// binary64 (double) has a machine epsilon of 2^-52 (approx. 2.22e-16). However, this
+// is slightly too accurate when writing tests meant to run against libm implementations
+// for various platforms. 2^-50 (approx. 8.88e-16) 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 (15-17 digits).
+
+// For example, a test with an expect result in the format of 0.xxxxxxxxxxxxxxxxx will use
+// PAL_EPSILON for the variance, while an expected result in the format of 0.0xxxxxxxxxxxxxxxxx
+// will use PAL_EPSILON / 10 and and expected result in the format of x.xxxxxxxxxxxxxxxx will
+// use PAL_EPSILON * 10.
+#define PAL_EPSILON 8.8817841970012523e-16
+
+#define PAL_NAN sqrt(-1.0)
+#define PAL_POSINF -log(0.0)
+#define PAL_NEGINF log(0.0)
+
+/**
+ * Helper test structure
+ */
+struct test
+{
+ double value; /* value to test the function with */
+ double expected; /* expected result */
+ double variance; /* maximum delta between the expected and actual result */
+};
+
+/**
+ * validate
+ *
+ * test validation function
+ */
+void __cdecl validate(double value, double expected, double variance)
+{
+ double result = cos(value);
+
+ /*
+ * The test is valid when the difference between result
+ * and expected is less than or equal to variance
+ */
+ double delta = fabs(result - expected);
+
+ if (delta > variance)
+ {
+ Fail("cos(%g) returned %20.17g when it should have returned %20.17g",
+ value, result, expected);
+ }
+}
+
+/**
+ * validate
+ *
+ * test validation function for values returning NaN
+ */
+void __cdecl validate_isnan(double value)
+{
+ double result = cos(value);
+
+ if (!_isnan(result))
+ {
+ Fail("cos(%g) returned %20.17g when it should have returned %20.17g",
+ 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.31830988618379067, 0.94976571538163866, PAL_EPSILON }, // value: 1 / pi
+ { 0.43429448190325183, 0.90716712923909839, PAL_EPSILON }, // value: log10(e)
+ { 0.63661977236758134, 0.80410982822879171, PAL_EPSILON }, // value: 2 / pi
+ { 0.69314718055994531, 0.76923890136397213, PAL_EPSILON }, // value: ln(2)
+ { 0.70710678118654752, 0.76024459707563015, PAL_EPSILON }, // value: 1 / sqrt(2)
+ { 0.78539816339744831, 0.70710678118654752, PAL_EPSILON }, // value: pi / 4, expected: 1 / sqrt(2)
+ { 1, 0.54030230586813972, PAL_EPSILON },
+ { 1.1283791670955126, 0.42812514788535792, PAL_EPSILON }, // value: 2 / sqrt(pi)
+ { 1.4142135623730950, 0.15594369476537447, PAL_EPSILON }, // value: sqrt(2)
+ { 1.4426950408889634, 0.12775121753523991, PAL_EPSILON }, // value: log2(e)
+ { 1.5707963267948966, 0, PAL_EPSILON }, // value: pi / 2
+ { 2.3025850929940457, -0.66820151019031295, PAL_EPSILON }, // value: ln(10)
+ { 2.7182818284590452, -0.91173391478696510, PAL_EPSILON }, // value: e
+ { 3.1415926535897932, -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/cos/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/cos/test1/testinfo.dat
new file mode 100644
index 0000000000..9e57b7f8ab
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/cos/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 = cos
+Name = Positive Test for cos
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Passes to cos() a series of angle value, checking that
+= each one return the correct value.
diff --git a/src/pal/tests/palsuite/c_runtime/cosh/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/cosh/CMakeLists.txt
new file mode 100644
index 0000000000..5e1ef7f28b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/cosh/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/cosh/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/cosh/test1/CMakeLists.txt
new file mode 100644
index 0000000000..bea7b7a3b7
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/cosh/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_cosh_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_cosh_test1 coreclrpal)
+
+target_link_libraries(paltest_cosh_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/cosh/test1/test1.c b/src/pal/tests/palsuite/c_runtime/cosh/test1/test1.c
new file mode 100644
index 0000000000..40c2fca85d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/cosh/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 cosh return the correct values
+**
+** Dependencies: PAL_Initialize
+** PAL_Terminate
+** Fail
+** fabs
+**
+**===========================================================================*/
+
+#include <palsuite.h>
+
+// binary64 (double) has a machine epsilon of 2^-52 (approx. 2.22e-16). However, this
+// is slightly too accurate when writing tests meant to run against libm implementations
+// for various platforms. 2^-50 (approx. 8.88e-16) 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 (15-17 digits).
+
+// For example, a test with an expect result in the format of 0.xxxxxxxxxxxxxxxxx will use
+// PAL_EPSILON for the variance, while an expected result in the format of 0.0xxxxxxxxxxxxxxxxx
+// will use PAL_EPSILON / 10 and and expected result in the format of x.xxxxxxxxxxxxxxxx will
+// use PAL_EPSILON * 10.
+#define PAL_EPSILON 8.8817841970012523e-16
+
+#define PAL_NAN sqrt(-1.0)
+#define PAL_POSINF -log(0.0)
+#define PAL_NEGINF log(0.0)
+
+/**
+ * Helper test structure
+ */
+struct test
+{
+ double value; /* value to test the function with */
+ double expected; /* expected result */
+ double variance; /* maximum delta between the expected and actual result */
+};
+
+/**
+ * validate
+ *
+ * test validation function
+ */
+void __cdecl validate(double value, double expected, double variance)
+{
+ double result = cosh(value);
+
+ /*
+ * The test is valid when the difference between result
+ * and expected is less than or equal to variance
+ */
+ double delta = fabs(result - expected);
+
+ if (delta > variance)
+ {
+ Fail("cosh(%g) returned %20.17g when it should have returned %20.17g",
+ value, result, expected);
+ }
+}
+
+/**
+ * validate
+ *
+ * test validation function for values returning PAL_NAN
+ */
+void __cdecl validate_isnan(double value)
+{
+ double result = cosh(value);
+
+ if (!_isnan(result))
+ {
+ Fail("cosh(%g) returned %20.17g when it should have returned %20.17g",
+ 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.31830988618379067, 1.0510897883672876, PAL_EPSILON * 10 }, // value: 1 / pi
+ { 0.43429448190325183, 1.0957974645564909, PAL_EPSILON * 10 }, // value: log10(e)
+ { 0.63661977236758134, 1.2095794864199787, PAL_EPSILON * 10 }, // value: 2 / pi
+ { 0.69314718055994531, 1.25, PAL_EPSILON * 10 }, // value: ln(2)
+ { 0.70710678118654752, 1.2605918365213561, PAL_EPSILON * 10 }, // value: 1 / sqrt(2)
+ { 0.78539816339744831, 1.3246090892520058, PAL_EPSILON * 10 }, // value: pi / 4
+ { 1, 1.5430806348152438, PAL_EPSILON * 10 },
+ { 1.1283791670955126, 1.7071001431069344, PAL_EPSILON * 10 }, // value: 2 / sqrt(pi)
+ { 1.4142135623730950, 2.1781835566085709, PAL_EPSILON * 10 }, // value: sqrt(2)
+ { 1.4426950408889634, 2.2341880974508023, PAL_EPSILON * 10 }, // value: log2(e)
+ { 1.5707963267948966, 2.5091784786580568, PAL_EPSILON * 10 }, // value: pi / 2
+ { 2.3025850929940457, 5.05, PAL_EPSILON * 10 }, // value: ln(10)
+ { 2.7182818284590452, 7.6101251386622884, PAL_EPSILON * 10 }, // value: e
+ { 3.1415926535897932, 11.591953275521521, 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/cosh/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/cosh/test1/testinfo.dat
new file mode 100644
index 0000000000..131512289f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/cosh/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 = cosh
+Name = Positive Test for cosh
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Passes to cosh() a series of angle value, checking that
+= each one return to correct value.
diff --git a/src/pal/tests/palsuite/c_runtime/ctime/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/ctime/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/ctime/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/ctime/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/ctime/test1/CMakeLists.txt
new file mode 100644
index 0000000000..aa64a71d1e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/ctime/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_ctime_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_ctime_test1 coreclrpal)
+
+target_link_libraries(paltest_ctime_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/ctime/test1/test1.c b/src/pal/tests/palsuite/c_runtime/ctime/test1/test1.c
new file mode 100644
index 0000000000..5d5e22ce89
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/ctime/test1/test1.c
@@ -0,0 +1,154 @@
+// Licensed to the .NET Foundation under one or more 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 ctime return a valid
+** string when it received a valid number of second.
+** Test to ensure that ctime return null when it
+** receives a invalid number of second.
+**
+** Dependencies: PAL_Initialize
+** PAL_Terminate
+** Fail
+** IsBadReadPtr
+** strcmp
+**
+
+**
+**===========================================================================*/
+
+#include <palsuite.h>
+
+/*
+ * Date strings generated under win2000/WinXP, times & Strings are GMT
+ */
+const time_t VAL_SUN_JAN_17_2038 = 2147383647;
+const char *STR_SUN_JAN_17_2038 = "Sun Jan 17 23:27:27 2038\n";
+
+/* Note, there are two acceptable strings for this date. */
+/* The day can have a leading 0 under Windows. */
+const time_t VAL_FRI_JAN_02_1970 = 100000;
+const char *STR_FRI_JAN_02_1970 = "Fri Jan 02 03:46:40 1970\n";
+const char *STR_FRI_JAN__2_1970 = "Fri Jan 2 03:46:40 1970\n";
+
+const int STR_TIME_SIZE = 26; /* returned date size in byte*/
+
+
+
+int __cdecl main(int argc, char **argv)
+{
+ time_t LTime;
+ char *DateResult;
+ TIME_ZONE_INFORMATION tzInformation;
+
+ /*
+ * Initialize the PAL and return FAILURE if this fails
+ */
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ // Get the current timezone information
+ GetTimeZoneInformation(&tzInformation);
+
+ /*
+ * Test #1
+ */
+
+ /* set the valid date in time_t format, adjusted for current time zone*/
+ LTime = VAL_SUN_JAN_17_2038 + (tzInformation.Bias * 60);
+
+ /* convert it to string using ctime*/
+ DateResult = ctime( &LTime );
+
+ /* if it's null, ctime failed*/
+ if (DateResult == NULL)
+ {
+ Fail ("ERROR: (Test #1) ctime returned NULL. Expected string\n");
+ }
+
+ /* test if the entire string can ba access normaly */
+ if(IsBadReadPtr(DateResult, STR_TIME_SIZE)==0)
+ {
+ /* compare result with win2000 result */
+ if(strcmp( DateResult, STR_SUN_JAN_17_2038)!=0)
+ {
+ Fail("ERROR: (Test #1) ctime returned an unexpected string "
+ "%s, expexted string is %s\n"
+ ,DateResult, STR_SUN_JAN_17_2038);
+ }
+ }
+ else
+ {
+ Fail ("ERROR: (Test #1) ctime returned a bad pointer.\n");
+ }
+
+
+ /*
+ * Test #2
+ */
+
+ /* Set the valid date in time_t format, adjusted for current time zone */
+ LTime = VAL_FRI_JAN_02_1970 + (tzInformation.Bias * 60);
+
+ /* convert it to string using ctime */
+ DateResult = ctime( &LTime );
+
+ /* if it's null, ctime failed*/
+ if (DateResult == NULL)
+ {
+ Fail ("ERROR: (Test #2) ctime returned NULL. Expected string\n");
+ }
+
+ /* test if the entire string can ba access normaly */
+ if(IsBadReadPtr(DateResult, STR_TIME_SIZE)==0)
+ {
+ /* compare result with win2000 result */
+ if (strcmp(DateResult, STR_FRI_JAN_02_1970) != 0
+ && strcmp(DateResult, STR_FRI_JAN__2_1970) != 0)
+ {
+ Fail("ERROR: (Test #2) ctime returned an unexpected string "
+ "%s, expected string is %s\n"
+ ,DateResult, STR_FRI_JAN_02_1970);
+ }
+ }
+ else
+ {
+ Fail ("ERROR: (Test #2) ctime returned a bad pointer.\n");
+ }
+
+
+
+ /*
+ * Test #3
+ */
+
+ /* specify an invalid time */
+ LTime = -1;
+
+ /* try to convert it */
+ DateResult = ctime( &LTime );
+
+ /* Check the result for errors, should fail in this case */
+ if (DateResult != NULL)
+ {
+ Fail ("ERROR: (Test #3) ctime returned something different from NULL.:"
+ "Expected NULL\n");
+ }
+
+
+ PAL_Terminate();
+ return PASS;
+}
+
+
+
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/ctime/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/ctime/test1/testinfo.dat
new file mode 100644
index 0000000000..c5aa3df65e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/ctime/test1/testinfo.dat
@@ -0,0 +1,15 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = ctime
+Name = Positive Test for ctime
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Call ctime with a valid number of second in it's t_time parameter
+= and expect a non-null char* as a return value.
+= Call ctime with a invalid number of second (-1) and expect
+= a null char* as a return value.
diff --git a/src/pal/tests/palsuite/c_runtime/errno/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/errno/CMakeLists.txt
new file mode 100644
index 0000000000..ef14ea5352
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/errno/CMakeLists.txt
@@ -0,0 +1,5 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+add_subdirectory(test2)
+
diff --git a/src/pal/tests/palsuite/c_runtime/errno/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/errno/test1/CMakeLists.txt
new file mode 100644
index 0000000000..89b25a4fac
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/errno/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_errno_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_errno_test1 coreclrpal)
+
+target_link_libraries(paltest_errno_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/errno/test1/test1.c b/src/pal/tests/palsuite/c_runtime/errno/test1/test1.c
new file mode 100644
index 0000000000..3ae25fb02a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/errno/test1/test1.c
@@ -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: test1.c
+**
+** Purpose: Test that errno begins as 0, and sets to ERANGE when that
+** error is forced with wcstoul.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char *argv[])
+{
+ WCHAR overstr[] = {'4','2','9','4','9','6','7','2','9','6',0};
+ WCHAR *end;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ /*
+ From rotor.doc: The only value that must be supported is
+ ERANGE, in the event that wcstoul() fails due to overflow.
+ */
+
+ wcstoul(overstr, &end, 10);
+
+ if (errno != ERANGE)
+ {
+ Fail("ERROR: wcstoul did not set errno to ERANGE. Instead "
+ "the value of errno is %d\n", errno);
+ }
+
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/errno/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/errno/test1/testinfo.dat
new file mode 100644
index 0000000000..3291dbc60a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/errno/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 = errno
+Name = Positive Test for errno
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Test that errno begins as 0, and sets to ERANGE when that
+= error is forced with wcstoul.
diff --git a/src/pal/tests/palsuite/c_runtime/errno/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/errno/test2/CMakeLists.txt
new file mode 100644
index 0000000000..edd4cf7975
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/errno/test2/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test2.c
+)
+
+add_executable(paltest_errno_test2
+ ${SOURCES}
+)
+
+add_dependencies(paltest_errno_test2 coreclrpal)
+
+target_link_libraries(paltest_errno_test2
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/errno/test2/test2.c b/src/pal/tests/palsuite/c_runtime/errno/test2/test2.c
new file mode 100644
index 0000000000..f418d2f199
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/errno/test2/test2.c
@@ -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: test2.c
+**
+** Purpose: Test that errno is 'per-thread' as noted in the documentation.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+/*
+ This thread function just checks that errno is initially 0 and then sets
+ it to a new value before returning.
+*/
+DWORD PALAPI ThreadFunc( LPVOID lpParam )
+{
+
+ if(errno != 0)
+ {
+ *((DWORD*)lpParam) = 1;
+ }
+
+ errno = 20;
+
+ return 0;
+}
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ DWORD dwThreadId, dwThrdParam = 0;
+ HANDLE hThread;
+
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ /* Set errno to a value within this thread */
+
+ errno = 50;
+
+ hThread = CreateThread(NULL, 0, ThreadFunc, &dwThrdParam, 0, &dwThreadId);
+
+ if (hThread == NULL)
+ {
+ Fail("ERROR: CreateThread failed to create a thread. "
+ "GetLastError() returned %d.\n",GetLastError());
+ }
+
+ WaitForSingleObject(hThread, INFINITE);
+
+ /* This checks the result of calling the thread */
+ if(dwThrdParam)
+ {
+ Fail("ERROR: errno was not set to 0 in the new thread. Each "
+ "thread should have its own value for errno.\n");
+ }
+
+ /* Check to make sure errno is still set to 50 */
+ if(errno != 50)
+ {
+ Fail("ERROR: errno should be 50 in the main thread, even though "
+ "it was set to 20 in another thread. Currently it is %d.\n",
+ errno);
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/errno/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/errno/test2/testinfo.dat
new file mode 100644
index 0000000000..90c232866f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/errno/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 = errno
+Name = Positive Test for errno
+TYPE = DEFAULT
+EXE1 = test2
+Description
+= Test that errno is 'per-thread' as noted in the documentation.
diff --git a/src/pal/tests/palsuite/c_runtime/exit/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/exit/CMakeLists.txt
new file mode 100644
index 0000000000..ef14ea5352
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/exit/CMakeLists.txt
@@ -0,0 +1,5 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+add_subdirectory(test2)
+
diff --git a/src/pal/tests/palsuite/c_runtime/exit/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/exit/test1/CMakeLists.txt
new file mode 100644
index 0000000000..eb9ca4e780
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/exit/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_exit_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_exit_test1 coreclrpal)
+
+target_link_libraries(paltest_exit_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/exit/test1/test1.c b/src/pal/tests/palsuite/c_runtime/exit/test1/test1.c
new file mode 100644
index 0000000000..87c9d22b8a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/exit/test1/test1.c
@@ -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: test1.c
+**
+** Purpose: Calls exit, and verifies that it actually stops program execution.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char **argv)
+{
+ /*
+ * Initialize the PAL and return FAIL if this fails
+ */
+ if (0 != (PAL_Initialize(argc, argv)))
+ {
+ return FAIL;
+ }
+
+ /*should return 0*/
+ exit(0);
+
+ Fail ("Exit didn't actually stop execution.\n");
+
+ return FAIL;
+}
+
+
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/exit/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/exit/test1/testinfo.dat
new file mode 100644
index 0000000000..3d9583bf96
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/exit/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 = exit
+Name = Positive Test for exit
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Calls exit, and verifies that it actually stops program execution.
diff --git a/src/pal/tests/palsuite/c_runtime/exit/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/exit/test2/CMakeLists.txt
new file mode 100644
index 0000000000..47d3a44c85
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/exit/test2/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test2.c
+)
+
+add_executable(paltest_exit_test2
+ ${SOURCES}
+)
+
+add_dependencies(paltest_exit_test2 coreclrpal)
+
+target_link_libraries(paltest_exit_test2
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/exit/test2/test2.c b/src/pal/tests/palsuite/c_runtime/exit/test2/test2.c
new file mode 100644
index 0000000000..16fbdfed2f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/exit/test2/test2.c
@@ -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: test2.c
+**
+** Purpose: Calls exit on fail, and verifies that it actually
+** stops program execution and return 1.
+
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char **argv)
+{
+ /*
+ * Initialize the PAL and return FAIL if this fails
+ */
+ if (0 != (PAL_Initialize(argc, argv)))
+ {
+ return FAIL;
+ }
+
+ /*should return 1*/
+ exit(1);
+
+}
+
+
+
+
+
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/exit/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/exit/test2/testinfo.dat
new file mode 100644
index 0000000000..6887f27c36
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/exit/test2/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 = exit
+Name = Positive Test for exit
+TYPE = DEFAULT
+EXE1 = test2
+Description
+= Calls exit on fail, and verifies that it actually stops program execution,
+= and return 1.
diff --git a/src/pal/tests/palsuite/c_runtime/exp/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/exp/CMakeLists.txt
new file mode 100644
index 0000000000..5e1ef7f28b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/exp/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/exp/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/exp/test1/CMakeLists.txt
new file mode 100644
index 0000000000..9cdd4ec5ed
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/exp/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_exp_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_exp_test1 coreclrpal)
+
+target_link_libraries(paltest_exp_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/exp/test1/test1.c b/src/pal/tests/palsuite/c_runtime/exp/test1/test1.c
new file mode 100644
index 0000000000..20e071aa68
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/exp/test1/test1.c
@@ -0,0 +1,138 @@
+// Licensed to the .NET Foundation under one or more 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 exp with a normal set of values.
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+// binary64 (double) has a machine epsilon of 2^-52 (approx. 2.22e-16). However, this
+// is slightly too accurate when writing tests meant to run against libm implementations
+// for various platforms. 2^-50 (approx. 8.88e-16) 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 (15-17 digits).
+
+// For example, a test with an expect result in the format of 0.xxxxxxxxxxxxxxxxx will use
+// PAL_EPSILON for the variance, while an expected result in the format of 0.0xxxxxxxxxxxxxxxxx
+// will use PAL_EPSILON / 10 and and expected result in the format of x.xxxxxxxxxxxxxxxx will
+// use PAL_EPSILON * 10.
+#define PAL_EPSILON 8.8817841970012523e-16
+
+#define PAL_NAN sqrt(-1.0)
+#define PAL_POSINF -log(0.0)
+#define PAL_NEGINF log(0.0)
+
+/**
+ * Helper test structure
+ */
+struct test
+{
+ double value; /* value to test the function with */
+ double expected; /* expected result */
+ double variance; /* maximum delta between the expected and actual result */
+};
+
+/**
+ * validate
+ *
+ * test validation function
+ */
+void __cdecl validate(double value, double expected, double variance)
+{
+ double result = exp(value);
+
+ /*
+ * The test is valid when the difference between result
+ * and expected is less than or equal to variance
+ */
+ double delta = fabs(result - expected);
+
+ if (delta > variance)
+ {
+ Fail("exp(%g) returned %20.17g when it should have returned %20.17g",
+ value, result, expected);
+ }
+}
+
+/**
+ * validate
+ *
+ * test validation function for values returning NaN
+ */
+void __cdecl validate_isnan(double value)
+{
+ double result = exp(value);
+
+ if (!_isnan(result))
+ {
+ Fail("exp(%g) returned %20.17g when it should have returned %20.17g",
+ 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.1415926535897932, 0.043213918263772250, PAL_EPSILON / 10 }, // value: -(pi)
+ { -2.7182818284590452, 0.065988035845312537, PAL_EPSILON / 10 }, // value: -(e)
+ { -2.3025850929940457, 0.1, PAL_EPSILON }, // value: -(ln(10))
+ { -1.5707963267948966, 0.20787957635076191, PAL_EPSILON }, // value: -(pi / 2)
+ { -1.4426950408889634, 0.23629008834452270, PAL_EPSILON }, // value: -(log2(e))
+ { -1.4142135623730950, 0.24311673443421421, PAL_EPSILON }, // value: -(sqrt(2))
+ { -1.1283791670955126, 0.32355726390307110, PAL_EPSILON }, // value: -(2 / sqrt(pi))
+ { -1, 0.36787944117144232, PAL_EPSILON }, // value: -(1)
+ { -0.78539816339744831, 0.45593812776599624, PAL_EPSILON }, // value: -(pi / 4)
+ { -0.70710678118654752, 0.49306869139523979, PAL_EPSILON }, // value: -(1 / sqrt(2))
+ { -0.69314718055994531, 0.5, PAL_EPSILON }, // value: -(ln(2))
+ { -0.63661977236758134, 0.52907780826773535, PAL_EPSILON }, // value: -(2 / pi)
+ { -0.43429448190325183, 0.64772148514180065, PAL_EPSILON }, // value: -(log10(e))
+ { -0.31830988618379067, 0.72737734929521647, PAL_EPSILON }, // value: -(1 / pi)
+ { 0, 1, PAL_EPSILON * 10 },
+ { 0.31830988618379067, 1.3748022274393586, PAL_EPSILON * 10 }, // value: 1 / pi
+ { 0.43429448190325183, 1.5438734439711811, PAL_EPSILON * 10 }, // value: log10(e)
+ { 0.63661977236758134, 1.8900811645722220, PAL_EPSILON * 10 }, // value: 2 / pi
+ { 0.69314718055994531, 2, PAL_EPSILON * 10 }, // value: ln(2)
+ { 0.70710678118654752, 2.0281149816474725, PAL_EPSILON * 10 }, // value: 1 / sqrt(2)
+ { 0.78539816339744831, 2.1932800507380155, PAL_EPSILON * 10 }, // value: pi / 4
+ { 1, 2.7182818284590452, PAL_EPSILON * 10 }, // expected: e
+ { 1.1283791670955126, 3.0906430223107976, PAL_EPSILON * 10 }, // value: 2 / sqrt(pi)
+ { 1.4142135623730950, 4.1132503787829275, PAL_EPSILON * 10 }, // value: sqrt(2)
+ { 1.4426950408889634, 4.2320861065570819, PAL_EPSILON * 10 }, // value: log2(e)
+ { 1.5707963267948966, 4.8104773809653517, PAL_EPSILON * 10 }, // value: pi / 2
+ { 2.3025850929940457, 10, PAL_EPSILON * 100 }, // value: ln(10)
+ { 2.7182818284590452, 15.154262241479264, PAL_EPSILON * 100 }, // value: e
+ { 3.1415926535897932, 23.140692632779269, 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/exp/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/exp/test1/testinfo.dat
new file mode 100644
index 0000000000..65fc192cd9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/exp/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 = exp
+Name = Test #1 for exp
+Type = DEFAULT
+EXE1 = test1
+Description
+=Tests exp with a normal set of values.
diff --git a/src/pal/tests/palsuite/c_runtime/fabs/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fabs/CMakeLists.txt
new file mode 100644
index 0000000000..5e1ef7f28b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fabs/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/fabs/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fabs/test1/CMakeLists.txt
new file mode 100644
index 0000000000..ab27230ac2
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fabs/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_fabs_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fabs_test1 coreclrpal)
+
+target_link_libraries(paltest_fabs_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fabs/test1/test1.c b/src/pal/tests/palsuite/c_runtime/fabs/test1/test1.c
new file mode 100644
index 0000000000..0a74d5c1c5
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fabs/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 fabs return the correct values
+**
+** Dependencies: PAL_Initialize
+** PAL_Terminate
+** Fail
+**
+**===========================================================================*/
+
+#include <palsuite.h>
+
+// binary64 (double) has a machine epsilon of 2^-52 (approx. 2.22e-16). However, this
+// is slightly too accurate when writing tests meant to run against libm implementations
+// for various platforms. 2^-50 (approx. 8.88e-16) 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 (15-17 digits).
+
+// For example, a test with an expect result in the format of 0.xxxxxxxxxxxxxxxxx will use
+// PAL_EPSILON for the variance, while an expected result in the format of 0.0xxxxxxxxxxxxxxxxx
+// will use PAL_EPSILON / 10 and and expected result in the format of x.xxxxxxxxxxxxxxxx will
+// use PAL_EPSILON * 10.
+#define PAL_EPSILON 8.8817841970012523e-16
+
+#define PAL_NAN sqrt(-1.0)
+#define PAL_POSINF -log(0.0)
+#define PAL_NEGINF log(0.0)
+
+/**
+ * Helper test structure
+ */
+struct test
+{
+ double value; /* value to test the function with */
+ double expected; /* expected result */
+ double variance; /* maximum delta between the expected and actual result */
+};
+
+/**
+ * validate
+ *
+ * test validation function
+ */
+void __cdecl validate(double value, double expected, double variance)
+{
+ double result = fabs(value);
+
+ /*
+ * The test is valid when the difference between result
+ * and expected is less than or equal to variance
+ */
+ double delta = fabs(result - expected);
+
+ if (delta > variance)
+ {
+ Fail("fabs(%g) returned %20.17g when it should have returned %20.17g",
+ value, result, expected);
+ }
+}
+
+/**
+ * validate
+ *
+ * test validation function for values returning NaN
+ */
+void __cdecl validate_isnan(double value)
+{
+ double result = fabs(value);
+
+ if (!_isnan(result))
+ {
+ Fail("fabs(%g) returned %20.17g when it should have returned %20.17g",
+ value, result, PAL_NAN);
+ }
+}
+
+/**
+ * main
+ *
+ * executable entry point
+ */
+INT __cdecl main(INT argc, CHAR **argv)
+{
+ struct test tests[] =
+ {
+ /* value expected variance */
+ { PAL_NEGINF, PAL_POSINF, 0 },
+ { -3.1415926535897932, 3.1415926535897932, PAL_EPSILON * 10 }, // value: -(pi) expected: pi
+ { -2.7182818284590452, 2.7182818284590452, PAL_EPSILON * 10 }, // value: -(e) expected: e
+ { -2.3025850929940457, 2.3025850929940457, PAL_EPSILON * 10 }, // value: -(ln(10)) expected: ln(10)
+ { -1.5707963267948966, 1.5707963267948966, PAL_EPSILON * 10 }, // value: -(pi / 2) expected: pi / 2
+ { -1.4426950408889634, 1.4426950408889634, PAL_EPSILON * 10 }, // value: -(log2(e)) expected: log2(e)
+ { -1.4142135623730950, 1.4142135623730950, PAL_EPSILON * 10 }, // value: -(sqrt(2)) expected: sqrt(2)
+ { -1.1283791670955126, 1.1283791670955126, PAL_EPSILON * 10 }, // value: -(2 / sqrt(pi)) expected: 2 / sqrt(pi)
+ { -1, 1, PAL_EPSILON * 10 },
+ { -0.78539816339744831, 0.78539816339744831, PAL_EPSILON }, // value: -(pi / 4) expected: pi / 4
+ { -0.70710678118654752, 0.70710678118654752, PAL_EPSILON }, // value: -(1 / sqrt(2)) expected: 1 / sqrt(2)
+ { -0.69314718055994531, 0.69314718055994531, PAL_EPSILON }, // value: -(ln(2)) expected: ln(2)
+ { -0.63661977236758134, 0.63661977236758134, PAL_EPSILON }, // value: -(2 / pi) expected: 2 / pi
+ { -0.43429448190325183, 0.43429448190325183, PAL_EPSILON }, // value: -(log10(e)) expected: log10(e)
+ { -0.31830988618379067, 0.31830988618379067, PAL_EPSILON }, // value: -(1 / pi) expected: 1 / pi
+ { -0.0, 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(-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/fabs/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fabs/test1/testinfo.dat
new file mode 100644
index 0000000000..d5b2321edd
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fabs/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 = fabs
+Name = Positive Test for fabs
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Passes to fabs() a series of values, checking that
+= each one return to correct value.
diff --git a/src/pal/tests/palsuite/c_runtime/fabsf/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fabsf/CMakeLists.txt
new file mode 100644
index 0000000000..5e1ef7f28b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fabsf/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/fabsf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fabsf/test1/CMakeLists.txt
new file mode 100644
index 0000000000..06512ebd7c
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fabsf/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_fabsf_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fabsf_test1 coreclrpal)
+
+target_link_libraries(paltest_fabsf_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fabsf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/fabsf/test1/test1.c
new file mode 100644
index 0000000000..0b020729b8
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fabsf/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 fabsf return the correct values
+**
+** Dependencies: PAL_Initialize
+** PAL_Terminate
+** Fail
+**
+**===========================================================================*/
+
+#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 sqrt(-1.0)
+#define PAL_POSINF -log(0.0)
+#define PAL_NEGINF log(0.0)
+
+/**
+ * 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 = fabsf(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("fabsf(%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 = fabsf(value);
+
+ if (!_isnan(result))
+ {
+ Fail("fabsf(%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, PAL_POSINF, 0 },
+ { -3.14159265f, 3.14159265f, PAL_EPSILON * 10 }, // value: -(pi) expected: pi
+ { -2.71828183f, 2.71828183f, PAL_EPSILON * 10 }, // value: -(e) expected: e
+ { -2.30258509f, 2.30258509f, PAL_EPSILON * 10 }, // value: -(ln(10)) expected: ln(10)
+ { -1.57079633f, 1.57079633f, PAL_EPSILON * 10 }, // value: -(pi / 2) expected: pi / 2
+ { -1.44269504f, 1.44269504f, PAL_EPSILON * 10 }, // value: -(log2(e)) expected: log2(e)
+ { -1.41421356f, 1.41421356f, PAL_EPSILON * 10 }, // value: -(sqrt(2)) expected: sqrt(2)
+ { -1.12837917f, 1.12837917f, PAL_EPSILON * 10 }, // value: -(2 / sqrt(pi)) expected: 2 / sqrt(pi)
+ { -1, 1, PAL_EPSILON * 10 },
+ { -0.785398163f, 0.785398163f, PAL_EPSILON }, // value: -(pi / 4) expected: pi / 4
+ { -0.707106781f, 0.707106781f, PAL_EPSILON }, // value: -(1 / sqrt(2)) expected: 1 / sqrt(2)
+ { -0.693147181f, 0.693147181f, PAL_EPSILON }, // value: -(ln(2)) expected: ln(2)
+ { -0.636619772f, 0.636619772f, PAL_EPSILON }, // value: -(2 / pi) expected: 2 / pi
+ { -0.434294482f, 0.434294482f, PAL_EPSILON }, // value: -(log10(e)) expected: log10(e)
+ { -0.318309886f, 0.318309886f, PAL_EPSILON }, // value: -(1 / pi) expected: 1 / pi
+ { -0.0f, 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(-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/fabsf/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fabsf/test1/testinfo.dat
new file mode 100644
index 0000000000..a927f1e3df
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fabsf/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 = fabsf
+Name = Positive Test for fabsf
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Passes to fabsf() a series of values, checking that
+= each one return to correct value.
diff --git a/src/pal/tests/palsuite/c_runtime/fclose/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fclose/CMakeLists.txt
new file mode 100644
index 0000000000..ef14ea5352
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fclose/CMakeLists.txt
@@ -0,0 +1,5 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+add_subdirectory(test2)
+
diff --git a/src/pal/tests/palsuite/c_runtime/fclose/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fclose/test1/CMakeLists.txt
new file mode 100644
index 0000000000..55ed7c674e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fclose/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_fclose_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fclose_test1 coreclrpal)
+
+target_link_libraries(paltest_fclose_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fclose/test1/test1.c b/src/pal/tests/palsuite/c_runtime/fclose/test1/test1.c
new file mode 100644
index 0000000000..0a8463823d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fclose/test1/test1.c
@@ -0,0 +1,79 @@
+// Licensed to the .NET Foundation under one or more 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 (fclose)
+**
+** Purpose: Tests the PAL implementation of the fclose function.
+** This test will use fdopen to create a file stream,
+** that will be used to test fclose. fclose will also
+** be passed a closed file handle to make sure it handle
+** it accordingly.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char **argv)
+{
+ HANDLE hReadPipe = NULL;
+ HANDLE hWritePipe = NULL;
+ BOOL bRetVal = FALSE;
+ int iFiledes = 0;
+ FILE *fp;
+
+ SECURITY_ATTRIBUTES lpPipeAttributes;
+
+ /*Initialize the PAL*/
+ if ((PAL_Initialize(argc, argv)) != 0)
+ {
+ return (FAIL);
+ }
+
+ /*Setup SECURITY_ATTRIBUTES structure for CreatePipe*/
+ lpPipeAttributes.nLength = sizeof(lpPipeAttributes);
+ lpPipeAttributes.lpSecurityDescriptor = NULL;
+ lpPipeAttributes.bInheritHandle = TRUE;
+
+ /*Create a Pipe*/
+ bRetVal = CreatePipe(&hReadPipe, // read handle
+ &hWritePipe, // write handle
+ &lpPipeAttributes,// security attributes
+ 0); // pipe size
+
+ if (bRetVal == FALSE)
+ {
+ Fail("ERROR: Unable to create pipe; returned error code %ld"
+ , GetLastError());
+ }
+
+ /*Get a file descriptor for the read pipe handle*/
+ iFiledes = _open_osfhandle((long)hReadPipe,_O_RDONLY);
+
+ if (iFiledes == -1)
+ {
+ Fail("ERROR: _open_osfhandle failed to open "
+ " hReadPipe=0x%lx", hReadPipe);
+ }
+
+ /*Open read pipe handle in read mode*/
+ fp = _fdopen(iFiledes, "r");
+
+ if (fp == NULL)
+ {
+ Fail("ERROR: unable to fdopen file descriptor"
+ " iFiledes=%d", iFiledes);
+ }
+
+ /*Attempt to close the file stream*/
+ if (fclose(fp) != 0)
+ {
+ Fail("ERROR: Unable to fclose file stream fp=0x%lx\n",fp);
+ }
+
+ PAL_Terminate();
+ return (PASS);
+}
diff --git a/src/pal/tests/palsuite/c_runtime/fclose/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fclose/test1/testinfo.dat
new file mode 100644
index 0000000000..0904c4fa9d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fclose/test1/testinfo.dat
@@ -0,0 +1,18 @@
+# Licensed to the .NET Foundation under one or more 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 = fclose
+Name = Test for fclose
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Tests the PAL implementation of the fclose function.
+= This test will use fdopen to create a file stream,
+= that will be used to test fclose. fclose will also
+= be passed a closed file handle to make sure it handle
+= it accordingly.
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/fclose/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fclose/test2/CMakeLists.txt
new file mode 100644
index 0000000000..178dc7d19a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fclose/test2/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test2.c
+)
+
+add_executable(paltest_fclose_test2
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fclose_test2 coreclrpal)
+
+target_link_libraries(paltest_fclose_test2
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fclose/test2/test2.c b/src/pal/tests/palsuite/c_runtime/fclose/test2/test2.c
new file mode 100644
index 0000000000..f4da535535
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fclose/test2/test2.c
@@ -0,0 +1,77 @@
+// Licensed to the .NET Foundation under one or more 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 (fclose)
+**
+** Purpose: Tests the PAL implementation of the fclose function.
+** fclose will be passed a closed file handle to make
+** sure it handles it accordingly.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char **argv)
+{
+ HANDLE hReadPipe = NULL;
+ HANDLE hWritePipe = NULL;
+ BOOL bRetVal = FALSE;
+ int iFiledes = 0;
+ FILE *fp;
+
+ SECURITY_ATTRIBUTES lpPipeAttributes;
+
+ /*Initialize the PAL*/
+ if ((PAL_Initialize(argc, argv)) != 0)
+ {
+ return (FAIL);
+ }
+
+ /*Setup SECURITY_ATTRIBUTES structure for CreatePipe*/
+ lpPipeAttributes.nLength = sizeof(lpPipeAttributes);
+ lpPipeAttributes.lpSecurityDescriptor = NULL;
+ lpPipeAttributes.bInheritHandle = TRUE;
+
+ /*Create a Pipe*/
+ bRetVal = CreatePipe(&hReadPipe, /* read handle */
+ &hWritePipe, /* write handle */
+ &lpPipeAttributes,/* security attributes */
+ 0); /* pipe size */
+
+ if (bRetVal == FALSE)
+ {
+ Fail("ERROR: Unable to create pipe; returned error code %ld"
+ , GetLastError());
+ }
+
+ /*Get a file descriptor for the read pipe handle*/
+ iFiledes = _open_osfhandle((long)hReadPipe,_O_RDONLY);
+
+ if (iFiledes == -1)
+ {
+ Fail("ERROR: _open_osfhandle failed to open "
+ " hReadPipe=0x%lx", hReadPipe);
+ }
+
+ /*Open read pipe handle in read mode*/
+ fp = _fdopen(iFiledes, "r");
+
+ if (fp == NULL)
+ {
+ Fail("ERROR: unable to fdopen file descriptor"
+ " iFiledes=%d", iFiledes);
+ }
+
+ /*Attempt to close the file stream*/
+ if (fclose(fp) != 0)
+ {
+ Fail("ERROR: Unable to fclose file stream fp=0x%lx\n", fp);
+ }
+
+ PAL_Terminate();
+ return (PASS);
+}
diff --git a/src/pal/tests/palsuite/c_runtime/fclose/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fclose/test2/testinfo.dat
new file mode 100644
index 0000000000..192b8d2f6b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fclose/test2/testinfo.dat
@@ -0,0 +1,15 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = fclose
+Name = Test for fclose
+TYPE = DEFAULT
+EXE1 = test2
+LANG = cpp
+Description
+= Tests the PAL implementation of the fclose function.
+= fclose will be passed a closed file handle to
+= make sure it handles it accordingly.
diff --git a/src/pal/tests/palsuite/c_runtime/feof/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/feof/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/feof/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/feof/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/feof/test1/CMakeLists.txt
new file mode 100644
index 0000000000..ee1389deb0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/feof/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_feof_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_feof_test1 coreclrpal)
+
+target_link_libraries(paltest_feof_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/feof/test1/test1.c b/src/pal/tests/palsuite/c_runtime/feof/test1/test1.c
new file mode 100644
index 0000000000..ba018aa91d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/feof/test1/test1.c
@@ -0,0 +1,88 @@
+// Licensed to the .NET Foundation under one or more 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 feof function.
+** Open a file, and read some characters. Check that
+** feof states that it hasn't gone by the EOF. Then
+** read enough characters to go beyond the EOF, and check
+** that feof states this is so.
+**
+** Depends:
+** fopen
+** fread
+**
+**
+**
+**===================================================================*/
+
+/* The file 'testfile' should exist with 15 characters in it. If not,
+ something has been lost ...
+*/
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char **argv)
+{
+ const char filename[] = "testfile";
+ char buffer[128];
+ FILE * fp = NULL;
+ int result;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ /* Open a file in READ mode */
+
+ if((fp = fopen(filename, "r")) == NULL)
+ {
+ Fail("Unable to open a file for reading. Is the file "
+ "in the directory? It should be.");
+ }
+
+ /* Read 10 characters from the file. The file has 15
+ characters in it.
+ */
+
+ if((result = fread(buffer,1,10,fp)) == 0)
+ {
+ Fail("ERROR: Zero characters read from the file. It should have "
+ "read 10 character in it.");
+ }
+
+ if(feof(fp))
+ {
+ Fail("ERROR: feof returned a value greater than 0. No read "
+ "operation has gone beyond the EOF yet, and feof should "
+ "return 0 still.");
+ }
+
+ /* Read 10 characters from the file. The file has 15
+ characters in it. The file pointer should have no passed
+ the end of file.
+ */
+
+ if((result = fread(buffer,1,10,fp)) == 0)
+ {
+ Fail("ERROR: Zero characters read from the file. It should have "
+ "read 5 character in it.");
+ }
+
+ if(feof(fp) == 0)
+ {
+ Fail("ERROR: feof returned 0. The file pointer has gone beyond "
+ "the EOF and this function should return positive now.");
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/feof/test1/testfile b/src/pal/tests/palsuite/c_runtime/feof/test1/testfile
new file mode 100644
index 0000000000..273c1a9ffd
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/feof/test1/testfile
@@ -0,0 +1 @@
+This is a test. \ No newline at end of file
diff --git a/src/pal/tests/palsuite/c_runtime/feof/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/feof/test1/testinfo.dat
new file mode 100644
index 0000000000..e14044ee17
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/feof/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 = feof
+Name = Positive Test for feof
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Tests the PAL implementation of the feof function.
+= Open a file, and read some characters. Check that feof states that
+= it hasn't gone by the EOF. Then read enough characters to go beyond
+= the EOF, and check that feof states this is so.
+
diff --git a/src/pal/tests/palsuite/c_runtime/ferror/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/ferror/CMakeLists.txt
new file mode 100644
index 0000000000..ef14ea5352
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/ferror/CMakeLists.txt
@@ -0,0 +1,5 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+add_subdirectory(test2)
+
diff --git a/src/pal/tests/palsuite/c_runtime/ferror/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/ferror/test1/CMakeLists.txt
new file mode 100644
index 0000000000..2ab12b5db3
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/ferror/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_ferror_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_ferror_test1 coreclrpal)
+
+target_link_libraries(paltest_ferror_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/ferror/test1/test1.c b/src/pal/tests/palsuite/c_runtime/ferror/test1/test1.c
new file mode 100644
index 0000000000..516f2531ed
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/ferror/test1/test1.c
@@ -0,0 +1,74 @@
+// Licensed to the .NET Foundation under one or more 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 ferror function.
+**
+** Depends:
+** fopen
+** fread
+** fclose
+**
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char **argv)
+{
+ const char filename[] = "testfile";
+ char buffer[128];
+ FILE * fp = NULL;
+ int result;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ /* Open a file in READ mode */
+
+ if((fp = fopen(filename, "r")) == NULL)
+ {
+ Fail("Unable to open a file for reading. Is the file "
+ "in the directory? It should be.");
+ }
+
+ /* Read 10 characters from the file. The file has 15
+ characters in it.
+ */
+
+ if((result = fread(buffer,1,10,fp)) == 0)
+ {
+ Fail("ERROR: Zero characters read from the file. It should have "
+ "read 10 character in from a 15 character file.");
+ }
+
+ if(ferror(fp) != 0)
+ {
+ Fail("ERROR: ferror returned a value not equal to 0. The read "
+ "operation shouldn't have caused an error, and ferror should "
+ "return 0 still.");
+ }
+
+ /*
+ Close the open file and end the test.
+ */
+
+ if(fclose(fp) != 0)
+ {
+ Fail("ERROR: fclose failed when trying to close a file pointer. "
+ "This test depends on fclose working properly.");
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/ferror/test1/testfile b/src/pal/tests/palsuite/c_runtime/ferror/test1/testfile
new file mode 100644
index 0000000000..273c1a9ffd
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/ferror/test1/testfile
@@ -0,0 +1 @@
+This is a test. \ No newline at end of file
diff --git a/src/pal/tests/palsuite/c_runtime/ferror/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/ferror/test1/testinfo.dat
new file mode 100644
index 0000000000..32e55a3b0d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/ferror/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 = ferror
+Name = Positive Test for ferror
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Tests the PAL implementation of the ferror function.
+= Open a file, and read some characters. Check that ferror states that
+= no error has occurred. Then close the file pointer. Attempt to read
+= some more. Check ferror now, and it should indicate that an error has
+= occurred.
diff --git a/src/pal/tests/palsuite/c_runtime/ferror/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/ferror/test2/CMakeLists.txt
new file mode 100644
index 0000000000..077dde0bc6
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/ferror/test2/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test2.c
+)
+
+add_executable(paltest_ferror_test2
+ ${SOURCES}
+)
+
+add_dependencies(paltest_ferror_test2 coreclrpal)
+
+target_link_libraries(paltest_ferror_test2
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/ferror/test2/test2.c b/src/pal/tests/palsuite/c_runtime/ferror/test2/test2.c
new file mode 100644
index 0000000000..fdf9e032c8
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/ferror/test2/test2.c
@@ -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: test2.c
+**
+** Purpose: Open a read-only file and attempt to write some data to it.
+** Check to ensure that an ferror occurs.
+**
+** Depends:
+** fopen
+** fwrite
+** fclose
+**
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char **argv)
+{
+ const char filename[] = "testfile";
+ FILE * fp = NULL;
+ int result;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ /* Open a file in READONLY mode */
+
+ if((fp = fopen(filename, "r")) == NULL)
+ {
+ Fail("Unable to open a file for reading.");
+ }
+
+ /* Attempt to write 14 characters to the file. */
+
+ if((result = fwrite("This is a test",1,14,fp)) != 0)
+ {
+ Fail("ERROR: %d characters written. 0 characters should "
+ "have been written, since this file is read-only.", result);
+ }
+
+ if(ferror(fp) == 0)
+ {
+ Fail("ERROR: ferror should have generated an error when "
+ "write was called on a read-only file. But, it "
+ "retured 0, indicating no error.\n");
+ }
+
+ /* Close the file. */
+
+ if(fclose(fp) != 0)
+ {
+ Fail("ERROR: fclose failed when trying to close a file pointer. "
+ "This test depends on fclose working properly.");
+ }
+
+
+ PAL_Terminate();
+ return PASS;
+}
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/ferror/test2/testfile b/src/pal/tests/palsuite/c_runtime/ferror/test2/testfile
new file mode 100644
index 0000000000..0135842a03
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/ferror/test2/testfile
@@ -0,0 +1 @@
+This is a test file. This needs to be kept in CVS. \ No newline at end of file
diff --git a/src/pal/tests/palsuite/c_runtime/ferror/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/ferror/test2/testinfo.dat
new file mode 100644
index 0000000000..d724a4c4e7
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/ferror/test2/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 = ferror
+Name = Positive Test for ferror, call write on a readonly file.
+TYPE = DEFAULT
+EXE1 = test2
+Description
+= Open a read-only file and attempt to write some data to it.
+= Check to ensure that an ferror occurs.
diff --git a/src/pal/tests/palsuite/c_runtime/fflush/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fflush/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fflush/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/fflush/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fflush/test1/CMakeLists.txt
new file mode 100644
index 0000000000..743f1d2111
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fflush/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_fflush_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fflush_test1 coreclrpal)
+
+target_link_libraries(paltest_fflush_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fflush/test1/test1.c b/src/pal/tests/palsuite/c_runtime/fflush/test1/test1.c
new file mode 100644
index 0000000000..7baf9ba5b9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fflush/test1/test1.c
@@ -0,0 +1,80 @@
+// Licensed to the .NET Foundation under one or more 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 to see that fflush is working properly. Flushes a couple
+** buffers and checks the return value. Can't figure out a way to test
+** and ensure it is really dropping the buffers, since the system
+** does this automatically most of the time ...
+**
+**
+**==========================================================================*/
+
+/* This function is really tough to test. Right now it just tests
+ a bunch of return values. No solid way to ensure that it is really
+ flushing a buffer or not -- might have to be a manual test someday.
+*/
+
+#include <palsuite.h>
+
+
+int __cdecl main(int argc, char **argv)
+{
+
+ int TheReturn;
+ FILE* TheFile;
+ FILE* AnotherFile = NULL;
+
+ PAL_Initialize(argc,argv);
+
+ TheFile = fopen("theFile","w+");
+
+ if(TheFile == NULL)
+ {
+ Fail("ERROR: fopen failed. Test depends on this function.");
+ }
+
+ TheReturn = fwrite("foo",3,3,TheFile);
+
+ if(TheReturn != 3)
+ {
+ Fail("ERROR: fwrite failed. Test depends on this function.");
+ }
+
+ /* Test to see that FlushFileBuffers returns a success value */
+ TheReturn = fflush(TheFile);
+
+ if(TheReturn != 0)
+ {
+ Fail("ERROR: The fflush function returned non-zero, which "
+ "indicates failure, when trying to flush a buffer.");
+ }
+
+ /* Test to see that FlushFileBuffers returns a success value */
+ TheReturn = fflush(NULL);
+
+ if(TheReturn != 0)
+ {
+ Fail("ERROR: The fflush function returned non-zero, which "
+ "indicates failure, when trying to flush all buffers.");
+ }
+
+ /* Test to see that FlushFileBuffers returns a success value */
+ TheReturn = fflush(AnotherFile);
+
+ if(TheReturn != 0)
+ {
+ Fail("ERROR: The fflush function returned non-zero, which "
+ "indicates failure, when trying to flush a stream not "
+ "associated with a file.");
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/fflush/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fflush/test1/testinfo.dat
new file mode 100644
index 0000000000..1cff5a94a1
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fflush/test1/testinfo.dat
@@ -0,0 +1,15 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = fflush
+Name = Positive Test for fflush
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Tests to see that fflush is working properly. Flushes a couple
+= buffers and checks the return value. Can't figure out a way to test
+= and ensure it is really dropping the buffers, since the system
+= does this automatically most of the time ...
diff --git a/src/pal/tests/palsuite/c_runtime/fgets/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fgets/CMakeLists.txt
new file mode 100644
index 0000000000..1962ade358
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fgets/CMakeLists.txt
@@ -0,0 +1,6 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+add_subdirectory(test2)
+add_subdirectory(test3)
+
diff --git a/src/pal/tests/palsuite/c_runtime/fgets/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fgets/test1/CMakeLists.txt
new file mode 100644
index 0000000000..672d910c85
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fgets/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_fgets_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fgets_test1 coreclrpal)
+
+target_link_libraries(paltest_fgets_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fgets/test1/test1.c b/src/pal/tests/palsuite/c_runtime/fgets/test1/test1.c
new file mode 100644
index 0000000000..5e0e62dece
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fgets/test1/test1.c
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more 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 simple file and calls fgets() to get a string shorter
+** than the first line of the file. Verifies that the correct
+** string is returned.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char **argv)
+{
+ const char outBuf1[] = "This is a test.\n";
+ const char outBuf2[] = "This is too.";
+ char inBuf[sizeof(outBuf1) + sizeof(outBuf2)];
+ const char filename[] = "testfile.tmp";
+ const int offset = 5; /* value chosen arbitrarily */
+ int actualLen;
+ int expectedLen;
+ FILE * fp;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ /*write the file that we will use to test */
+ fp = fopen(filename, "w");
+ if (fp == NULL)
+ {
+ Fail("Unable to open file for write.\n");
+ }
+
+ fwrite(outBuf1, sizeof(outBuf1[0]), sizeof(outBuf1), fp);
+ fwrite(outBuf2, sizeof(outBuf2[0]), sizeof(outBuf2), fp);
+
+ if (fclose(fp) != 0)
+ {
+ Fail("Error closing a file opened for write.\n");
+ }
+
+
+ /*now read back the entire first string*/
+ fp = fopen(filename, "r");
+ if (fp == NULL)
+ {
+ Fail("Unable to open file for read.\n");
+ }
+
+ /*note: +1 because strlen() returns the length of a string _not_
+ including the NULL, while fgets() returns a string of specified
+ maximum length _including_ the NULL.*/
+ if (fgets(inBuf, strlen(outBuf1) - offset + 1, fp) != inBuf)
+ {
+ Fail("Error reading from file using fgets.\n");
+ }
+
+
+ expectedLen = strlen(outBuf1) - offset;
+ actualLen = strlen(inBuf);
+
+ if (actualLen < expectedLen)
+ {
+ Fail("fgets() was asked to read a one-line string and given the "
+ "length of the string as a parameter. The string it has "
+ "read is too short.\n");
+ }
+ if (actualLen > expectedLen)
+ {
+ Fail("fgets() was asked to read a one-line string and given the "
+ "length of the string as a parameter. The string it has "
+ "read is too long.\n");
+ }
+ if (memcmp(inBuf, outBuf1, actualLen) != 0)
+ {
+ /*We didn't read back exactly outBuf1*/
+ Fail("fgets() was asked to read a one-line string, and given the "
+ "length of the string as an parameter. It has returned a "
+ "string of the correct length, but the contents are not "
+ "correct.\n");
+ }
+
+ if (fclose(fp) != 0)
+ {
+ Fail("Error closing file after using fgets().\n");
+ }
+
+
+ PAL_Terminate();
+ return PASS;
+
+}
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/fgets/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fgets/test1/testinfo.dat
new file mode 100644
index 0000000000..70ea6690ca
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fgets/test1/testinfo.dat
@@ -0,0 +1,15 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = fgets
+Name = Positive Test for fgets
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Writes a simple file and calls fgets() to get a string shorter than
+= the first line of the file. Verifies that the correct string is
+= returned.
+
diff --git a/src/pal/tests/palsuite/c_runtime/fgets/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fgets/test2/CMakeLists.txt
new file mode 100644
index 0000000000..d39401536b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fgets/test2/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test2.c
+)
+
+add_executable(paltest_fgets_test2
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fgets_test2 coreclrpal)
+
+target_link_libraries(paltest_fgets_test2
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fgets/test2/test2.c b/src/pal/tests/palsuite/c_runtime/fgets/test2/test2.c
new file mode 100644
index 0000000000..fa37cdbc13
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fgets/test2/test2.c
@@ -0,0 +1,97 @@
+// Licensed to the .NET Foundation under one or more 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: Calls fgets to read a full line from a file. A maximum length
+** parameter greater than the length of the line is passed.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char **argv)
+{
+ const char outBuf1[] = "This is a test.\n";
+ const char outBuf2[] = "This is too.";
+
+ char inBuf[sizeof(outBuf1) + sizeof(outBuf2)];
+ const char filename[] = "testfile.tmp";
+ const int offset = 5; /*value chosen arbitrarily*/
+ int expectedLen;
+ int actualLen;
+
+ FILE * fp;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ /*write the file that we will use to test */
+ fp = fopen(filename, "w");
+ if (fp == NULL)
+ {
+ Fail("Unable to open file for write.\n");
+ }
+
+ fwrite(outBuf1, sizeof(outBuf1[0]), sizeof(outBuf1), fp);
+ fwrite(outBuf2, sizeof(outBuf2[0]), sizeof(outBuf2), fp);
+
+ if (fclose(fp) != 0)
+ {
+ Fail("error closing stream opened for write.\n");
+ }
+
+ /*Read until the first linebreak*/
+ fp = fopen(filename, "r");
+ if (fp == NULL)
+ {
+ Fail("Unable to open file for read.\n");
+ }
+
+
+ if (fgets(inBuf, sizeof(outBuf1) + offset , fp) != inBuf)
+ {
+ Fail("Error reading from file using fgets.\n");
+ }
+
+ /*note: -1 because strlen returns the length of a string _not_
+ including the NULL, while fgets returns a string of specified
+ maximum length _including_ the NULL.*/
+ expectedLen = strlen(outBuf1);
+ actualLen = strlen(inBuf);
+ if (actualLen > expectedLen)
+ {
+ Fail("fgets() was asked to read the first line of a file, but did "
+ "not stop at the end of the line.\n");
+ }
+ else if (actualLen < expectedLen)
+ {
+ Fail("fgets() was asked to read the first line of a file, but did "
+ "not read the entire line.\n");
+ }
+ else if (memcmp(inBuf, outBuf1, actualLen) != 0)
+ {
+ /*We didn't read back exactly outBuf1*/
+ Fail("fgets() was asked to read the first line of a file. It "
+ "has read back a string of the correct length, but the"
+ " contents are not correct.\n");
+ }
+
+ if (fclose(fp) != 0)
+ {
+ Fail("Error closing file after using fgets().\n");
+ }
+
+ PAL_Terminate();
+ return PASS;
+
+}
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/fgets/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fgets/test2/testinfo.dat
new file mode 100644
index 0000000000..d282dbaa65
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fgets/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 = fgets
+Name = Positive Test for fgets
+TYPE = DEFAULT
+EXE1 = test2
+Description
+= Calls fgets to read a full line from a file. A maximum length
+= parameter greater than the length of the line is passed.
+
diff --git a/src/pal/tests/palsuite/c_runtime/fgets/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fgets/test3/CMakeLists.txt
new file mode 100644
index 0000000000..50f0901ee1
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fgets/test3/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test3.c
+)
+
+add_executable(paltest_fgets_test3
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fgets_test3 coreclrpal)
+
+target_link_libraries(paltest_fgets_test3
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fgets/test3/test3.c b/src/pal/tests/palsuite/c_runtime/fgets/test3/test3.c
new file mode 100644
index 0000000000..525ba9327f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fgets/test3/test3.c
@@ -0,0 +1,73 @@
+// Licensed to the .NET Foundation under one or more 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: Tries to read from an empty file using fgets(), to verify
+** handling of EOF condition.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char **argv)
+{
+ char inBuf[10];
+ const char filename[] = "testfile.tmp";
+
+ FILE * fp;
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ /*write the empty file that we will use to test */
+ fp = fopen(filename, "w");
+ if (fp == NULL)
+ {
+ Fail("Unable to open file for write.\n");
+ }
+
+ /*Don't write anything*/
+
+ if (fclose(fp) != 0)
+ {
+ Fail("Error closing stream opened for write.\n");
+ }
+
+
+ /*Open the file and try to read.*/
+ fp = fopen(filename, "r");
+ if (fp == NULL)
+ {
+ Fail("Unable to open file for read.\n");
+ }
+
+
+ if (fgets(inBuf, sizeof(inBuf) , fp) != NULL)
+ {
+ /*NULL could also mean an error condition, but since the PAL
+ doesn't supply feof or ferror, we can't distinguish between
+ the two.*/
+ Fail("fgets doesn't handle EOF properly. When asked to read from "
+ "an empty file, it didn't return NULL as it should have.\n");
+ }
+
+ if (fclose(fp) != 0)
+ {
+ Fail("Error closing an empty file after trying to use fgets().\n");
+ }
+ PAL_Terminate();
+ return PASS;
+
+}
+
+
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/fgets/test3/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fgets/test3/testinfo.dat
new file mode 100644
index 0000000000..e10cf89968
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fgets/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 = fgets
+Name = Positive Test for fgets
+TYPE = DEFAULT
+EXE1 = test3
+Description
+= Tries to read from an empty file using fgets(), to verify handling of
+= EOF condition.
+
diff --git a/src/pal/tests/palsuite/c_runtime/floor/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/floor/CMakeLists.txt
new file mode 100644
index 0000000000..5e1ef7f28b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/floor/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/floor/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/floor/test1/CMakeLists.txt
new file mode 100644
index 0000000000..dbc5abde5b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/floor/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_floor_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_floor_test1 coreclrpal)
+
+target_link_libraries(paltest_floor_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/floor/test1/test1.c b/src/pal/tests/palsuite/c_runtime/floor/test1/test1.c
new file mode 100644
index 0000000000..dba320919b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/floor/test1/test1.c
@@ -0,0 +1,132 @@
+// Licensed to the .NET Foundation under one or more 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 floor with simple positive and negative values. Also tests
+** extreme cases like extremely small values and positive and
+** negative infinity. Makes sure that calling floor on NaN returns
+** NaN
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+// binary64 (double) has a machine epsilon of 2^-52 (approx. 2.22e-16). However, this
+// is slightly too accurate when writing tests meant to run against libm implementations
+// for various platforms. 2^-50 (approx. 8.88e-16) 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 (15-17 digits).
+
+// For example, a test with an expect result in the format of 0.xxxxxxxxxxxxxxxxx will use
+// PAL_EPSILON for the variance, while an expected result in the format of 0.0xxxxxxxxxxxxxxxxx
+// will use PAL_EPSILON / 10 and and expected result in the format of x.xxxxxxxxxxxxxxxx will
+// use PAL_EPSILON * 10.
+#define PAL_EPSILON 8.8817841970012523e-16
+
+#define PAL_NAN sqrt(-1.0)
+#define PAL_POSINF -log(0.0)
+#define PAL_NEGINF log(0.0)
+
+/**
+ * Helper test structure
+ */
+struct test
+{
+ double value; /* value to test the function with */
+ double expected; /* expected result */
+ double variance; /* maximum delta between the expected and actual result */
+};
+
+/**
+ * validate
+ *
+ * test validation function
+ */
+void __cdecl validate(double value, double expected, double variance)
+{
+ double result = floor(value);
+
+ /*
+ * The test is valid when the difference between result
+ * and expected is less than or equal to variance
+ */
+ double delta = fabs(result - expected);
+
+ if (delta > variance)
+ {
+ Fail("floor(%g) returned %20.17g when it should have returned %20.17g",
+ value, result, expected);
+ }
+}
+
+/**
+ * validate
+ *
+ * test validation function for values returning NaN
+ */
+void __cdecl validate_isnan(double value)
+{
+ double result = floor(value);
+
+ if (!_isnan(result))
+ {
+ Fail("floor(%g) returned %20.17g when it should have returned %20.17g",
+ value, result, PAL_NAN);
+ }
+}
+
+/**
+ * main
+ *
+ * executable entry point
+ */
+int __cdecl main(int argc, char *argv[])
+{
+ struct test tests[] =
+ {
+ /* value expected variance */
+ { 0.31830988618379067, 0, PAL_EPSILON }, // value: 1 / pi
+ { 0.43429448190325183, 0, PAL_EPSILON }, // value: log10(e)
+ { 0.63661977236758134, 0, PAL_EPSILON }, // value: 2 / pi
+ { 0.69314718055994531, 0, PAL_EPSILON }, // value: ln(2)
+ { 0.70710678118654752, 0, PAL_EPSILON }, // value: 1 / sqrt(2)
+ { 0.78539816339744831, 0, PAL_EPSILON }, // value: pi / 4
+ { 1.1283791670955126, 1, PAL_EPSILON * 10 }, // value: 2 / sqrt(pi)
+ { 1.4142135623730950, 1, PAL_EPSILON * 10 }, // value: sqrt(2)
+ { 1.4426950408889634, 1, PAL_EPSILON * 10 }, // value: log2(e)
+ { 1.5707963267948966, 1, PAL_EPSILON * 10 }, // value: pi / 2
+ { 2.3025850929940457, 2, PAL_EPSILON * 10 }, // value: ln(10)
+ { 2.7182818284590452, 2, PAL_EPSILON * 10 }, // value: e
+ { 3.1415926535897932, 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.0, 0, PAL_EPSILON);
+
+ validate( 1, 1, PAL_EPSILON * 10);
+ validate(-1.0, -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/floor/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/floor/test1/testinfo.dat
new file mode 100644
index 0000000000..90543ea7af
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/floor/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 = floor
+Name = Positive Test for floor
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Passes to floor() a series of value, checking that
+= each one return to correct value.
diff --git a/src/pal/tests/palsuite/c_runtime/fmod/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fmod/CMakeLists.txt
new file mode 100644
index 0000000000..5e1ef7f28b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fmod/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/fmod/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fmod/test1/CMakeLists.txt
new file mode 100644
index 0000000000..c76df1f0bf
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fmod/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_fmod_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fmod_test1 coreclrpal)
+
+target_link_libraries(paltest_fmod_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fmod/test1/test1.c b/src/pal/tests/palsuite/c_runtime/fmod/test1/test1.c
new file mode 100644
index 0000000000..fd69ca52cb
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fmod/test1/test1.c
@@ -0,0 +1,157 @@
+// Licensed to the .NET Foundation under one or more 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 fmod return the correct values
+**
+** Dependencies: PAL_Initialize
+** PAL_Terminate
+** Fail
+** fabs
+**
+**===========================================================================*/
+
+#include <palsuite.h>
+
+// binary64 (double) has a machine epsilon of 2^-52 (approx. 2.22e-16). However, this
+// is slightly too accurate when writing tests meant to run against libm implementations
+// for various platforms. 2^-50 (approx. 8.88e-16) 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 (15-17 digits).
+
+// For example, a test with an expect result in the format of 0.xxxxxxxxxxxxxxxxx will use
+// PAL_EPSILON for the variance, while an expected result in the format of 0.0xxxxxxxxxxxxxxxxx
+// will use PAL_EPSILON / 10 and and expected result in the format of x.xxxxxxxxxxxxxxxx will
+// use PAL_EPSILON * 10.
+#define PAL_EPSILON 8.8817841970012523e-16
+
+#define PAL_NAN sqrt(-1.0)
+#define PAL_POSINF -log(0.0)
+#define PAL_NEGINF log(0.0)
+
+/**
+ * Helper test structure
+ */
+struct test
+{
+ double numerator; /* second component of the value to test the function with */
+ double denominator; /* first component of the value to test the function with */
+ double expected; /* expected result */
+ double variance; /* maximum delta between the expected and actual result */
+};
+
+/**
+ * validate
+ *
+ * test validation function
+ */
+void __cdecl validate(double numerator, double denominator, double expected, double variance)
+{
+ double result = fmod(numerator, denominator);
+
+ /*
+ * The test is valid when the difference between result
+ * and expected is less than or equal to variance
+ */
+ double delta = fabs(result - expected);
+
+ if (delta > variance)
+ {
+ Fail("fmod(%g, %g) returned %20.17g when it should have returned %20.17g",
+ numerator, denominator, result, expected);
+ }
+}
+
+/**
+ * validate
+ *
+ * test validation function for values returning NaN
+ */
+void __cdecl validate_isnan(double numerator, double denominator)
+{
+ double result = fmod(numerator, denominator);
+
+ if (!_isnan(result))
+ {
+ Fail("fmod(%g, %g) returned %20.17g when it should have returned %20.17g",
+ numerator, denominator, result, PAL_NAN);
+ }
+}
+
+/**
+ * main
+ *
+ * executable entry point
+ */
+INT __cdecl main(INT argc, CHAR **argv)
+{
+ struct test tests[] =
+ {
+ /* numerator denominator expected variance */
+ { 0, PAL_POSINF, 0, PAL_EPSILON },
+ { 0.31296179620778659, 0.94976571538163866, 0.31296179620778658, PAL_EPSILON },
+ { 0.42077048331375735, 0.90716712923909839, 0.42077048331375733, PAL_EPSILON },
+ { 0.59448076852482208, 0.80410982822879171, 0.59448076852482212, PAL_EPSILON },
+ { 0.63896127631363480, 0.76923890136397213, 0.63896127631363475, PAL_EPSILON },
+ { 0.64963693908006244, 0.76024459707563015, 0.64963693908006248, PAL_EPSILON },
+ { 0.70710678118654752, 0.70710678118654752, 0, PAL_EPSILON },
+ { 1, 1, 0, PAL_EPSILON },
+ { 0.84147098480789651, 0.54030230586813972, 0.30116867893975674, PAL_EPSILON },
+ { 0.90371945743584630, 0.42812514788535792, 0.047469161665130377, PAL_EPSILON / 10 },
+ { 0.98776594599273553, 0.15594369476537447, 0.052103777400488605, PAL_EPSILON / 10 },
+ { 0.99180624439366372, 0.12775121753523991, 0.097547721646984359, PAL_EPSILON / 10 },
+ { 0.74398033695749319, -0.66820151019031295, 0.075778826767180285, PAL_EPSILON / 10 },
+ { 0.41078129050290870, -0.91173391478696510, 0.41078129050290868, PAL_EPSILON },
+ { 0, -1, 0, PAL_EPSILON },
+ { 1, 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].numerator, tests[i].denominator, tests[i].expected, tests[i].variance);
+ validate(-tests[i].numerator, tests[i].denominator, -tests[i].expected, tests[i].variance);
+ validate( tests[i].numerator, -tests[i].denominator, tests[i].expected, tests[i].variance);
+ validate(-tests[i].numerator, -tests[i].denominator, -tests[i].expected, tests[i].variance);
+ }
+
+ validate_isnan( 0, 0);
+ validate_isnan(-0.0, 0);
+ validate_isnan( 0, -0.0);
+ validate_isnan(-0.0, -0.0);
+
+ validate_isnan( 1, 0);
+ validate_isnan(-1.0, 0);
+ validate_isnan( 1, -0.0);
+ validate_isnan(-1.0, -0.0);
+
+ validate_isnan(PAL_POSINF, PAL_POSINF);
+ validate_isnan(PAL_NEGINF, PAL_POSINF);
+ validate_isnan(PAL_POSINF, PAL_NEGINF);
+ validate_isnan(PAL_NEGINF, PAL_NEGINF);
+
+ validate_isnan(PAL_POSINF, 0);
+ validate_isnan(PAL_NEGINF, 0);
+ validate_isnan(PAL_POSINF, -0.0);
+ validate_isnan(PAL_NEGINF, -0.0);
+
+ validate_isnan(PAL_POSINF, 1);
+ validate_isnan(PAL_NEGINF, 1);
+ validate_isnan(PAL_POSINF, -1.0);
+ validate_isnan(PAL_NEGINF, -1.0);
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/fmod/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fmod/test1/testinfo.dat
new file mode 100644
index 0000000000..0a81fd80e0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fmod/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 = fmod
+Name = Positive Test for fmod
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Passes to fmod() a series of values, checking that
+= each one return to correct value.
diff --git a/src/pal/tests/palsuite/c_runtime/fmodf/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fmodf/CMakeLists.txt
new file mode 100644
index 0000000000..5e1ef7f28b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fmodf/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/fmodf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fmodf/test1/CMakeLists.txt
new file mode 100644
index 0000000000..d1ea238a98
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fmodf/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_fmodf_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fmodf_test1 coreclrpal)
+
+target_link_libraries(paltest_fmodf_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fmodf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/fmodf/test1/test1.c
new file mode 100644
index 0000000000..31b45d3606
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fmodf/test1/test1.c
@@ -0,0 +1,156 @@
+// Licensed to the .NET Foundation under one or more 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 fmodf return the correct values
+**
+** Dependencies: PAL_Initialize
+** PAL_Terminate
+** Fail
+** fabsf
+**
+**===========================================================================*/
+
+#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 sqrt(-1.0)
+#define PAL_POSINF -log(0.0)
+#define PAL_NEGINF log(0.0)
+
+/**
+ * Helper test structure
+ */
+struct test
+{
+ float numerator; /* second component of the value to test the function with */
+ float denominator; /* 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 numerator, float denominator, float expected, float variance)
+{
+ float result = fmodf(numerator, denominator);
+
+ /*
+ * 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("fmodf(%g, %g) returned %10.9g when it should have returned %10.9g",
+ numerator, denominator, result, expected);
+ }
+}
+
+/**
+ * validate
+ *
+ * test validation function for values returning NaN
+ */
+void __cdecl validate_isnan(float numerator, float denominator)
+{
+ float result = fmodf(numerator, denominator);
+
+ if (!_isnan(result))
+ {
+ Fail("fmodf(%g, %g) returned %10.9g when it should have returned %10.9g",
+ numerator, denominator, result, PAL_NAN);
+ }
+}
+
+/**
+ * main
+ *
+ * executable entry point
+ */
+INT __cdecl main(INT argc, CHAR **argv)
+{
+ struct test tests[] =
+ {
+ /* numerator denominator expected variance */
+ { 0, PAL_POSINF, 0, PAL_EPSILON },
+ { 0.312961796f, 0.949765715f, 0.312961796f, PAL_EPSILON },
+ { 0.420770483f, 0.907167129f, 0.420770483f, PAL_EPSILON },
+ { 0.594480769f, 0.804109828f, 0.594480769f, PAL_EPSILON },
+ { 0.638961276f, 0.769238901f, 0.638961276f, PAL_EPSILON },
+ { 0.649636939f, 0.760244597f, 0.649636939f, PAL_EPSILON },
+ { 0.707106781f, 0.707106781f, 0, PAL_EPSILON },
+ { 1, 1, 0, PAL_EPSILON },
+ { 0.841470985f, 0.540302306f, 0.301168679f, PAL_EPSILON },
+ { 0.903719457f, 0.428125148f, 0.0474691617f, PAL_EPSILON / 10 },
+ { 0.987765946f, 0.155943695f, 0.0521037774f, PAL_EPSILON / 10 },
+ { 0.991806244f, 0.127751218f, 0.0975477216f, PAL_EPSILON / 10 },
+ { 0.743980337f, -0.668201510f, 0.0757788268f, PAL_EPSILON / 10 },
+ { 0.410781291f, -0.911733915f, 0.410781291f, PAL_EPSILON },
+ { 0, -1, 0, PAL_EPSILON },
+ { 1, 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].numerator, tests[i].denominator, tests[i].expected, tests[i].variance);
+ validate(-tests[i].numerator, tests[i].denominator, -tests[i].expected, tests[i].variance);
+ validate( tests[i].numerator, -tests[i].denominator, tests[i].expected, tests[i].variance);
+ validate(-tests[i].numerator, -tests[i].denominator, -tests[i].expected, tests[i].variance);
+ }
+
+ validate_isnan( 0, 0);
+ validate_isnan(-0.0f, 0);
+ validate_isnan( 0, -0.0f);
+ validate_isnan(-0.0f, -0.0f);
+
+ validate_isnan( 1, 0);
+ validate_isnan(-1, 0);
+ validate_isnan( 1, -0.0f);
+ validate_isnan(-1, -0.0f);
+
+ validate_isnan(PAL_POSINF, PAL_POSINF);
+ validate_isnan(PAL_NEGINF, PAL_POSINF);
+ validate_isnan(PAL_POSINF, PAL_NEGINF);
+ validate_isnan(PAL_NEGINF, PAL_NEGINF);
+
+ validate_isnan(PAL_POSINF, 0);
+ validate_isnan(PAL_NEGINF, 0);
+ validate_isnan(PAL_POSINF, -0.0f);
+ validate_isnan(PAL_NEGINF, -0.0f);
+
+ validate_isnan(PAL_POSINF, 1);
+ validate_isnan(PAL_NEGINF, 1);
+ validate_isnan(PAL_POSINF, -1);
+ validate_isnan(PAL_NEGINF, -1);
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/fmodf/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fmodf/test1/testinfo.dat
new file mode 100644
index 0000000000..11c7978925
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fmodf/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 = fmodf
+Name = Positive Test for fmodf
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Passes to fmodf() a series of values, checking that
+= each one return to correct value.
diff --git a/src/pal/tests/palsuite/c_runtime/fopen/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fopen/CMakeLists.txt
new file mode 100644
index 0000000000..19ee487a6a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fopen/CMakeLists.txt
@@ -0,0 +1,10 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+add_subdirectory(test2)
+add_subdirectory(test3)
+add_subdirectory(test4)
+add_subdirectory(test5)
+add_subdirectory(test6)
+add_subdirectory(test7)
+
diff --git a/src/pal/tests/palsuite/c_runtime/fopen/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fopen/test1/CMakeLists.txt
new file mode 100644
index 0000000000..6578c43659
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fopen/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_fopen_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fopen_test1 coreclrpal)
+
+target_link_libraries(paltest_fopen_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fopen/test1/test1.c b/src/pal/tests/palsuite/c_runtime/fopen/test1/test1.c
new file mode 100644
index 0000000000..565b4eb77d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fopen/test1/test1.c
@@ -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: test1.c
+**
+** Purpose: Tests the PAL implementation of the fopen function.
+** This test simply attempts to open a number of files
+** with different modes. It checks to ensure a valid
+** file pointer is returned. It doesn't do any checking
+** to ensure the mode is really what it claims. And checks
+** for a NULL pointer when attempts to open a directory.
+**
+
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+struct testCase
+{
+ int CorrectResult;
+ char mode[20];
+};
+
+int __cdecl main(int argc, char **argv)
+{
+
+ FILE *fp;
+ char name[128];
+ int i;
+
+ struct testCase testCases[] =
+ {
+ {0, "r"}, {1, "w"}, {1, "a"},
+ {0, "r+"}, {1, "w+"}, {1, "a+"},
+ {1, "wt"}, {1, "wb"}, {1, "wS"},
+ {1, "w+c"}, {1, "w+n"}, {1, "wR"},
+ {1, "wT"}, {0, "tw"}
+ };
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+
+ for(i = 0; i < sizeof(testCases) / sizeof(struct testCase); i++)
+ {
+ strcpy(name,"testfiles");
+ strcat(name,testCases[i].mode);
+
+ fp = fopen(name,testCases[i].mode);
+
+ if ((fp == 0 && testCases[i].CorrectResult != 0) ||
+ (testCases[i].CorrectResult == 0 && fp != 0) )
+ {
+ Fail("ERROR: fopen returned incorrectly "
+ "opening a file in %s mode. Perhaps it opened a "
+ "read only file which didn't exist and returned a correct "
+ "pointer?",testCases[i].mode);
+ }
+
+ memset(name, '\0', 128);
+
+ }
+
+ /* When attempt to open a directory fopen should returned NULL */
+ if ( fopen(".", "r") != NULL)
+ {
+ Fail("ERROR: fopen returned non-NULL when trying to open a directory"
+ " the returned value was %d\n", fp);
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/fopen/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fopen/test1/testinfo.dat
new file mode 100644
index 0000000000..d9908549ea
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fopen/test1/testinfo.dat
@@ -0,0 +1,15 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = fopen
+Name = Positive Test for fopen
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= This test simply attempts to open a number of files with different
+= modes. It checks to ensure a valid file pointer is returned. It
+= doesn't do any checking to ensure the mode is really what it claims.
+= Checks for returned value when attempts to open a directory.
diff --git a/src/pal/tests/palsuite/c_runtime/fopen/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fopen/test2/CMakeLists.txt
new file mode 100644
index 0000000000..4458ed21d8
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fopen/test2/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test2.c
+)
+
+add_executable(paltest_fopen_test2
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fopen_test2 coreclrpal)
+
+target_link_libraries(paltest_fopen_test2
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fopen/test2/test2.c b/src/pal/tests/palsuite/c_runtime/fopen/test2/test2.c
new file mode 100644
index 0000000000..4026efe89a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fopen/test2/test2.c
@@ -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: test2.c
+**
+** Purpose: Tests the PAL implementation of the fopen function.
+** Test to ensure that you can write to a 'w' mode file.
+** And that you can't read from a 'w' mode file.
+**
+** Depends:
+** fprintf
+** fseek
+** fgets
+**
+
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char **argv)
+{
+
+ FILE *fp;
+ char buffer[128];
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ if( (fp = fopen( "testfile", "w" )) == NULL )
+ {
+ Fail( "ERROR: The file failed to open with 'w' mode.\n" );
+ }
+
+ /* Test that you can write */
+ if(fprintf(fp,"%s","some text") <= 0)
+ {
+ Fail("ERROR: Attempted to WRITE to a file opened with 'w' mode "
+ "but fprintf failed. Either fopen or fprintf have problems.");
+ }
+
+ if(fseek(fp, 0, SEEK_SET))
+ {
+ Fail("ERROR: fseek failed, and this test depends on it.");
+ }
+
+ /* Test that you can't read */
+ if(fgets(buffer,10,fp) != NULL)
+ {
+ Fail("ERROR: Tried to READ from a file with only 'w' mode set. "
+ "This should fail, but fgets didn't return NULL. Either "
+ "fgets or fopen is broken.");
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/fopen/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fopen/test2/testinfo.dat
new file mode 100644
index 0000000000..4c1a0095f8
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fopen/test2/testinfo.dat
@@ -0,0 +1,15 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = fopen
+Name = Positive Test for fopen
+TYPE = DEFAULT
+EXE1 = test2
+Description
+= Test to ensure that you can write to a 'w' mode file. And that you can't
+= read from a 'w' mode file.
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/fopen/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fopen/test3/CMakeLists.txt
new file mode 100644
index 0000000000..2c80f72ae7
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fopen/test3/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test3.c
+)
+
+add_executable(paltest_fopen_test3
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fopen_test3 coreclrpal)
+
+target_link_libraries(paltest_fopen_test3
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fopen/test3/test3.c b/src/pal/tests/palsuite/c_runtime/fopen/test3/test3.c
new file mode 100644
index 0000000000..f3af42dc8a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fopen/test3/test3.c
@@ -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: test3.c
+**
+** Purpose: Tests the PAL implementation of the fopen function.
+** Test to ensure that you can write to a 'w+' mode file.
+** And that you can read from a 'w+' mode file.
+**
+** Depends:
+** fprintf
+** fseek
+** fgets
+**
+
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char **argv)
+{
+
+ FILE *fp;
+ char buffer[128];
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ /* Open a file with 'w+' mode */
+ if( (fp = fopen( "testfile", "w+" )) == NULL )
+ {
+ Fail( "ERROR: The file failed to open with 'w+' mode.\n" );
+ }
+
+ /* Write some text to the file */
+ if(fprintf(fp,"%s","some text") <= 0)
+ {
+ Fail("ERROR: Attempted to WRITE to a file opened with 'w+' mode "
+ "but fprintf failed. Either fopen or fprintf have problems.");
+ }
+
+ if(fseek(fp, 0, SEEK_SET))
+ {
+ Fail("ERROR: fseek failed, and this test depends on it.");
+ }
+
+ /* Attempt to read from the 'w+' only file, should pass */
+ if(fgets(buffer,10,fp) == NULL)
+ {
+ Fail("ERROR: Tried to READ from a file with 'w+' mode set. "
+ "This should succeed, but fgets returned NULL. Either fgets "
+ "or fopen is broken.");
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/fopen/test3/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fopen/test3/testinfo.dat
new file mode 100644
index 0000000000..c458c1196a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fopen/test3/testinfo.dat
@@ -0,0 +1,15 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = fopen
+Name = Positive Test for fopen
+TYPE = DEFAULT
+EXE1 = test3
+Description
+= Test to ensure that you can write to a 'w+' mode file. And that you can
+= read from a 'w+' mode file.
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/fopen/test4/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fopen/test4/CMakeLists.txt
new file mode 100644
index 0000000000..92e0ef0bd8
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fopen/test4/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test4.c
+)
+
+add_executable(paltest_fopen_test4
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fopen_test4 coreclrpal)
+
+target_link_libraries(paltest_fopen_test4
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fopen/test4/test4.c b/src/pal/tests/palsuite/c_runtime/fopen/test4/test4.c
new file mode 100644
index 0000000000..04683d52c5
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fopen/test4/test4.c
@@ -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: test4.c
+**
+** Purpose: Tests the PAL implementation of the fopen function.
+** Test to ensure that you can't write to a 'r' mode file.
+** And that you can read from a 'r' mode file.
+**
+** Depends:
+** fprintf
+** fclose
+** fgets
+**
+
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char **argv)
+{
+
+ FILE *fp;
+ char buffer[128];
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ /* Open a file with 'w' mode */
+ if( (fp = fopen( "testfile", "w" )) == NULL )
+ {
+ Fail( "ERROR: The file failed to open with 'w' mode.\n" );
+ }
+
+ /* Write some text to the file */
+ if(fprintf(fp,"%s","some text") <= 0)
+ {
+ Fail("ERROR: Attempted to WRITE to a file opened with 'w' mode "
+ "but fprintf failed. Either fopen or fprintf have problems.");
+ }
+
+ if(fclose(fp))
+ {
+ Fail("ERROR: Attempted to close a file, but fclose failed. "
+ "This test depends upon it.");
+ }
+
+ /* Open a file with 'r' mode */
+ if( (fp = fopen( "testfile", "r" )) == NULL )
+ {
+ Fail( "ERROR: The file failed to open with 'r' mode.\n" );
+ }
+
+ /* Attempt to read from the 'r' only file, should pass */
+ if(fgets(buffer,10,fp) == NULL)
+ {
+ Fail("ERROR: Tried to READ from a file with 'r' mode set. "
+ "This should succeed, but fgets returned NULL. Either fgets "
+ "or fopen is broken.");
+ }
+
+ /* Write some text to the file */
+ if(fprintf(fp,"%s","some text") > 0)
+ {
+ Fail("ERROR: Attempted to WRITE to a file opened with 'r' mode "
+ "but fprintf succeeded It should have failed. "
+ "Either fopen or fprintf have problems.");
+ }
+
+
+ PAL_Terminate();
+ return PASS;
+}
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/fopen/test4/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fopen/test4/testinfo.dat
new file mode 100644
index 0000000000..a1ecaf959b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fopen/test4/testinfo.dat
@@ -0,0 +1,15 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = fopen
+Name = Positive Test for fopen
+TYPE = DEFAULT
+EXE1 = test4
+Description
+= Test to ensure that you can't write to a 'r' mode file. And that you can
+= read from a 'r' mode file.
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/fopen/test5/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fopen/test5/CMakeLists.txt
new file mode 100644
index 0000000000..82529b9aab
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fopen/test5/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test5.c
+)
+
+add_executable(paltest_fopen_test5
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fopen_test5 coreclrpal)
+
+target_link_libraries(paltest_fopen_test5
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fopen/test5/test5.c b/src/pal/tests/palsuite/c_runtime/fopen/test5/test5.c
new file mode 100644
index 0000000000..0a760314e1
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fopen/test5/test5.c
@@ -0,0 +1,78 @@
+// Licensed to the .NET Foundation under one or more 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 the PAL implementation of the fopen function.
+** Test to ensure that you can write to a 'r+' mode file.
+** And that you can read from a 'r+' mode file.
+**
+** Depends:
+** fprintf
+** fclose
+** fgets
+** fseek
+**
+
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char **argv)
+{
+
+ FILE *fp;
+ char buffer[128];
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ /* Open a file with 'w' mode */
+ if( (fp = fopen( "testfile", "w" )) == NULL )
+ {
+ Fail( "ERROR: The file failed to open with 'w' mode.\n" );
+ }
+
+ if(fclose(fp))
+ {
+ Fail("ERROR: Attempted to close a file, but fclose failed. "
+ "This test depends upon it.");
+ }
+
+ if( (fp = fopen( "testfile", "r+" )) == NULL )
+ {
+ Fail( "ERROR: The file failed to open with 'r+' mode.\n" );
+ }
+
+ /* Write some text to the file */
+ if(fprintf(fp,"%s","some text") <= 0)
+ {
+ Fail("ERROR: Attempted to WRITE to a file opened with 'r+' mode "
+ "but fprintf failed. Either fopen or fprintf have problems.");
+ }
+
+ if(fseek(fp, 0, SEEK_SET))
+ {
+ Fail("ERROR: fseek failed, and this test depends on it.");
+ }
+
+ /* Attempt to read from the 'r+' only file, should pass */
+ if(fgets(buffer,10,fp) == NULL)
+ {
+ Fail("ERROR: Tried to READ from a file with 'r+' mode set. "
+ "This should succeed, but fgets returned NULL. Either fgets "
+ "or fopen is broken.");
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/fopen/test5/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fopen/test5/testinfo.dat
new file mode 100644
index 0000000000..8f8f5d950b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fopen/test5/testinfo.dat
@@ -0,0 +1,15 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = fopen
+Name = Positive Test for fopen
+TYPE = DEFAULT
+EXE1 = test5
+Description
+= Test to ensure that you can write to a 'r+' mode file. And that you can
+= read from a 'r+' mode file.
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/fopen/test6/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fopen/test6/CMakeLists.txt
new file mode 100644
index 0000000000..9a01cfb9a8
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fopen/test6/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test6.c
+)
+
+add_executable(paltest_fopen_test6
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fopen_test6 coreclrpal)
+
+target_link_libraries(paltest_fopen_test6
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fopen/test6/test6.c b/src/pal/tests/palsuite/c_runtime/fopen/test6/test6.c
new file mode 100644
index 0000000000..03b6067fdd
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fopen/test6/test6.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: test6.c
+**
+** Purpose: Tests the PAL implementation of the fopen function.
+** Test to ensure that you can write to an 'a' mode file.
+** And that you can't read from a 'a' mode file. Also ensure
+** that you can use fseek and still write to the end of a file.
+**
+** Depends:
+** fprintf
+** fgets
+** fseek
+** fclose
+**
+
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char **argv)
+{
+
+ FILE *fp;
+ char buffer[128];
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ /* Open a file with 'a+' mode */
+ if( (fp = fopen( "testfile", "a" )) == NULL )
+ {
+ Fail( "ERROR: The file failed to open with 'a' mode.\n" );
+ }
+
+ /* Write some text to the file */
+ if(fprintf(fp,"%s","some text") <= 0)
+ {
+ Fail("ERROR: Attempted to WRITE to a file opened with 'a' mode "
+ "but fprintf failed. Either fopen or fprintf have problems.");
+ }
+
+ if(fseek(fp, 0, SEEK_SET))
+ {
+ Fail("ERROR: fseek failed, and this test depends on it.");
+ }
+
+ /* Attempt to read from the 'a' only file, should fail */
+ if(fgets(buffer,10,fp) != NULL)
+ {
+ Fail("ERROR: Tried to READ from a file with 'a' mode set. "
+ "This should fail, but fgets returned success. Either fgets "
+ "or fopen is broken.");
+ }
+
+
+ /* Attempt to write to a file after using 'a' and fseek */
+ fp = fopen("testfile2", "a");
+ if(fp == NULL)
+ {
+ Fail("ERROR: The file failed to be created with 'a' mode.\n");
+ }
+
+ /* write text to the file initially */
+ if(fprintf(fp,"%s","abcd") <= 0)
+ {
+ Fail("ERROR: Attempted to WRITE to a file opened with 'a' mode "
+ "but fprintf failed. Either fopen or fprintf have problems.\n");
+ }
+
+ /* set the pointer to the front of the file */
+ if(fseek(fp, 0, SEEK_SET))
+ {
+ Fail("ERROR: fseek failed, and this test depends on it.\n");
+ }
+
+ /* using 'a' should still write to the end of the file, not the front */
+ if(fputs("efgh",fp) < 0)
+ {
+ Fail("ERROR: Attempted to WRITE to a file opened with 'a' mode "
+ "but fputs failed.\n");
+ }
+
+ /* set the pointer to the front of the file */
+ if(fseek(fp, 0, SEEK_SET))
+ {
+ Fail("ERROR: fseek failed, and this test depends on it.\n");
+ }
+
+ /* a file with 'a' mode can only write, so close the file before reading */
+ if(fclose(fp))
+ {
+ Fail("ERROR: fclose failed when it should have succeeded.\n");
+ }
+
+ /* open the file again to read */
+ fp = fopen("testfile2","r");
+ if(fp == NULL)
+ {
+ Fail("ERROR: fopen failed to open the file using 'r' mode");
+ }
+
+ /* Attempt to read from the 'a' only file, should succeed */
+ if(fgets(buffer,10,fp) == NULL)
+ {
+ Fail("ERROR: Tried to READ from a file with 'a' mode set. "
+ "This should pass, but fgets returned failure. Either fgets "
+ "or fopen is broken.\n");
+ }
+
+ /* Compare what was read and what should have been in the file */
+ if(memcmp(buffer,"abcdefgh",8))
+ {
+ Fail("ERROR: The string read should have equaled 'abcdefgh' "
+ "but instead it is %s\n", buffer);
+ }
+
+
+ PAL_Terminate();
+ return PASS;
+}
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/fopen/test6/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fopen/test6/testinfo.dat
new file mode 100644
index 0000000000..5edd94416d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fopen/test6/testinfo.dat
@@ -0,0 +1,15 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = fopen
+Name = Positive Test for fopen
+TYPE = DEFAULT
+EXE1 = test6
+Description
+= Test to ensure that you can write to a 'a' mode file. And that you can't
+= read from a 'a' mode file.
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/fopen/test7/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fopen/test7/CMakeLists.txt
new file mode 100644
index 0000000000..168a5aff53
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fopen/test7/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test7.c
+)
+
+add_executable(paltest_fopen_test7
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fopen_test7 coreclrpal)
+
+target_link_libraries(paltest_fopen_test7
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fopen/test7/test7.c b/src/pal/tests/palsuite/c_runtime/fopen/test7/test7.c
new file mode 100644
index 0000000000..3ef8602ddb
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fopen/test7/test7.c
@@ -0,0 +1,117 @@
+// Licensed to the .NET Foundation under one or more 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 the PAL implementation of the fopen function.
+** Test to ensure that you can write to an 'a+' mode file.
+** And that you can read from a 'a+' mode file. Also ensure
+** that you can use fseek and still write to the end of a file.
+**
+** Depends:
+** fprintf
+** fgets
+** fseek
+** fclose
+**
+
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char **argv)
+{
+
+ FILE *fp;
+ char buffer[128];
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ /* Open a file with 'a+' mode */
+ if( (fp = fopen( "testfile", "a+" )) == NULL )
+ {
+ Fail( "ERROR: The file failed to open with 'a+' mode.\n" );
+ }
+
+ /* Write some text to the file */
+ if(fprintf(fp,"%s","some text") <= 0)
+ {
+ Fail("ERROR: Attempted to WRITE to a file opened with 'a+' mode "
+ "but fprintf failed. Either fopen or fprintf have problems.\n");
+ }
+
+ if(fseek(fp, 0, SEEK_SET))
+ {
+ Fail("ERROR: fseek failed, and this test depends on it.\n");
+ }
+
+ /* Attempt to read from the 'a+' only file, should succeed */
+ if(fgets(buffer,10,fp) == NULL)
+ {
+ Fail("ERROR: Tried to READ from a file with 'a+' mode set. "
+ "This should pass, but fgets returned failure. Either fgets "
+ "or fopen is broken.\n");
+ }
+
+
+ /* Attempt to write to a file after using 'a+' and fseek */
+ fp = fopen("testfile2", "a+");
+ if(fp == NULL)
+ {
+ Fail("ERROR: The file failed to be created with 'a+' mode.\n");
+ }
+
+ /* write text to the file initially */
+ if(fprintf(fp,"%s","abcd") <= 0)
+ {
+ Fail("ERROR: Attempted to WRITE to a file opened with 'a+' mode "
+ "but fprintf failed. Either fopen or fprintf have problems.\n");
+ }
+
+ /* set the pointer to the front of the file */
+ if(fseek(fp, 0, SEEK_SET))
+ {
+ Fail("ERROR: fseek failed, and this test depends on it.\n");
+ }
+
+ /* using 'a+' should still write to the end of the file, not the front */
+ if(fputs("efgh",fp) < 0)
+ {
+ Fail("ERROR: Attempted to WRITE to a file opened with 'a+' mode "
+ "but fputs failed.\n");
+ }
+
+ /* set the pointer to the front of the file */
+ if(fseek(fp, 0, SEEK_SET))
+ {
+ Fail("ERROR: fseek failed, and this test depends on it.\n");
+ }
+
+ /* Attempt to read from the 'a+' only file, should succeed */
+ if(fgets(buffer,10,fp) == NULL)
+ {
+ Fail("ERROR: Tried to READ from a file with 'a+' mode set. "
+ "This should pass, but fgets returned failure. Either fgets "
+ "or fopen is broken.\n");
+ }
+
+ /* Compare what was read and what should have been in the file */
+ if(memcmp(buffer,"abcdefgh",8))
+ {
+ Fail("ERROR: The string read should have equaled 'abcdefgh' "
+ "but instead it is %s\n", buffer);
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/fopen/test7/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fopen/test7/testinfo.dat
new file mode 100644
index 0000000000..e4bc99c910
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fopen/test7/testinfo.dat
@@ -0,0 +1,15 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = fopen
+Name = Positive Test for fopen
+TYPE = DEFAULT
+EXE1 = test7
+Description
+= Test to ensure that you can write to a 'a+' mode file. And that you can
+= read from a 'a+' mode file.
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fprintf/CMakeLists.txt
new file mode 100644
index 0000000000..cafb9536b0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/CMakeLists.txt
@@ -0,0 +1,22 @@
+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/fprintf/fprintf.h b/src/pal/tests/palsuite/c_runtime/fprintf/fprintf.h
new file mode 100644
index 0000000000..380eb0a0b3
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/fprintf.h
@@ -0,0 +1,177 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*NOTE:
+The creation of the test file within each function is because the FILE
+structure is not defined within pal.h. Therefore, unable to have
+function with this as a return type.
+*/
+
+#ifndef __FPRINTF_H__
+#define __FPRINTF_H__
+
+void DoStrTest(char *formatstr, char* param, char *checkstr)
+{
+ FILE *fp;
+ char buf[256] = { 0 };
+
+ if ((fp = fopen("testfile.txt", "w+")) == NULL )
+ Fail("ERROR: fopen failed to create testfile\n");
+ if ((fprintf(fp, formatstr, param)) < 0)
+ Fail("ERROR: fprintf failed\n");
+ if ((fseek(fp, 0, SEEK_SET)) != 0)
+ Fail("ERROR: fseek failed\n");
+ if ((fgets(buf, 100, fp)) == NULL)
+ Fail("ERROR: fseek failed\n");
+
+ if (memcmp(buf, checkstr, strlen(buf) + 1) != 0)
+ {
+ Fail("ERROR: failed to insert string \"%s\" into \"%s\"\n"
+ "Expected \"%s\" got \"%s\".\n",
+ param, formatstr, checkstr, buf);
+ }
+ fclose(fp);
+}
+
+void DoWStrTest(char *formatstr, WCHAR* param, char *checkstr)
+{
+ FILE *fp;
+ char buf[256] = { 0 };
+
+ if ((fp = fopen("testfile.txt", "w+")) == NULL )
+ Fail("ERROR: fopen failed to create testfile\n");
+ if ((fprintf(fp, formatstr, param)) < 0)
+ Fail("ERROR: fprintf failed\n");
+ if ((fseek(fp, 0, SEEK_SET)) != 0)
+ Fail("ERROR: fseek failed\n");
+ if ((fgets(buf, 100, fp)) == NULL)
+ Fail("ERROR: fseek failed\n");
+
+ if (memcmp(buf, checkstr, strlen(buf) + 1) != 0)
+ {
+ Fail("ERROR: failed to insert wide string \"%s\" into \"%s\"\n"
+ "Expected \"%s\" got \"%s\".\n",
+ convertC(param), formatstr, checkstr, buf);
+ }
+ fclose(fp);
+}
+
+
+void DoCharTest(char *formatstr, char param, char *checkstr)
+{
+ FILE *fp;
+ char buf[256] = { 0 };
+
+ if ((fp = fopen("testfile.txt", "w+")) == NULL )
+ Fail("ERROR: fopen failed to create testfile\n");
+ if ((fprintf(fp, formatstr, param)) < 0)
+ Fail("ERROR: fprintf failed\n");
+ if ((fseek(fp, 0, SEEK_SET)) != 0)
+ Fail("ERROR: fseek failed\n");
+ if ((fgets(buf, 100, fp)) == NULL)
+ Fail("ERROR: fseek failed\n");
+
+ if (memcmp(buf, checkstr, strlen(buf) + 1) != 0)
+ {
+ Fail("ERROR: failed to insert char \'%c\' (%d) into \"%s\"\n"
+ "Expected \"%s\" got \"%s\".\n",
+ param, param, formatstr, checkstr, buf);
+ }
+ fclose(fp);
+}
+
+void DoWCharTest(char *formatstr, WCHAR param, char *checkstr)
+{
+ FILE *fp;
+ char buf[256] = { 0 };
+
+ if ((fp = fopen("testfile.txt", "w+")) == NULL )
+ Fail("ERROR: fopen failed to create testfile\n");
+ if ((fprintf(fp, formatstr, param)) < 0)
+ Fail("ERROR: fprintf failed\n");
+ if ((fseek(fp, 0, SEEK_SET)) != 0)
+ Fail("ERROR: fseek failed\n");
+ if ((fgets(buf, 100, fp)) == NULL)
+ Fail("ERROR: fseek failed\n");
+
+ if (memcmp(buf, checkstr, strlen(buf) + 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);
+ }
+ fclose(fp);
+}
+
+void DoNumTest(char *formatstr, int value, char *checkstr)
+{
+ FILE *fp;
+ char buf[256] = { 0 };
+
+ if ((fp = fopen("testfile.txt", "w+")) == NULL )
+ Fail("ERROR: fopen failed to create testfile\n");
+ if ((fprintf(fp, formatstr, value)) < 0)
+ Fail("ERROR: fprintf failed\n");
+ if ((fseek(fp, 0, SEEK_SET)) != 0)
+ Fail("ERROR: fseek failed\n");
+ if ((fgets(buf, 100, fp)) == NULL)
+ Fail("ERROR: fseek failed\n");
+
+ if (memcmp(buf, checkstr, strlen(buf) + 1) != 0)
+ {
+ Fail("ERROR: failed to insert %#x into \"%s\"\n"
+ "Expected \"%s\" got \"%s\".\n",
+ value, formatstr, checkstr, buf);
+ }
+ fclose(fp);
+}
+
+void DoI64Test(char *formatstr, INT64 value, char *valuestr, char *checkstr1, char *checkstr2)
+{
+ FILE *fp;
+ char buf[256] = { 0 };
+
+ if ((fp = fopen("testfile.txt", "w+")) == NULL )
+ Fail("ERROR: fopen failed to create testfile\n");
+ if ((fprintf(fp, formatstr, value)) < 0)
+ Fail("ERROR: fprintf failed\n");
+ if ((fseek(fp, 0, SEEK_SET)) != 0)
+ Fail("ERROR: fseek failed\n");
+ if ((fgets(buf, 100, fp)) == NULL)
+ Fail("ERROR: fseek failed\n");
+
+ if (memcmp(buf, checkstr1, strlen(buf) + 1) != 0 &&
+ memcmp(buf, checkstr2, strlen(buf) + 1) != 0)
+ {
+ Fail("ERROR: failed to insert %s into \"%s\"\n"
+ "Expected \"%s\" or \"%s\", got \"%s\".\n",
+ valuestr, formatstr, checkstr1, checkstr2, buf);
+ }
+ fclose(fp);
+}
+
+void DoDoubleTest(char *formatstr, double value, char *checkstr1, char *checkstr2)
+{
+ FILE *fp;
+ char buf[256] = { 0 };
+
+ if ((fp = fopen("testfile.txt", "w+")) == NULL )
+ Fail("ERROR: fopen failed to create testfile\n");
+ if ((fprintf(fp, formatstr, value)) < 0)
+ Fail("ERROR: fprintf failed\n");
+ if ((fseek(fp, 0, SEEK_SET)) != 0)
+ Fail("ERROR: fseek failed\n");
+ if ((fgets(buf, 100, fp)) == NULL)
+ Fail("ERROR: fseek failed\n");
+
+ if (memcmp(buf, checkstr1, strlen(buf) + 1) != 0 &&
+ memcmp(buf, checkstr2, strlen(buf) + 1) != 0)
+ {
+ Fail("ERROR: failed to insert %f into \"%s\"\n"
+ "Expected \"%s\" or \"%s\", got \"%s\".\n",
+ value, formatstr, checkstr1, checkstr2, buf);
+ }
+ fclose(fp);
+}
+#endif
diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fprintf/test1/CMakeLists.txt
new file mode 100644
index 0000000000..ab4176563d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/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_fprintf_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fprintf_test1 coreclrpal)
+
+target_link_libraries(paltest_fprintf_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/fprintf/test1/test1.c
new file mode 100644
index 0000000000..d55fc2534c
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test1/test1.c
@@ -0,0 +1,80 @@
+// Licensed to the .NET Foundation under one or more 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 (fprintf)
+**
+** Purpose: A single, basic, test case with no formatting.
+** Test modeled after the sprintf series.
+**
+
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+/*
+ * Depends on memcmp, strlen, fopen, fgets, fseek and fclose.
+ */
+
+int __cdecl main(int argc, char *argv[])
+{
+ FILE *fp;
+ char testfile[] = "testfile.txt";
+ char checkstr[] = "hello world";
+ char buf[256];
+
+ if (PAL_Initialize(argc, argv) != 0)
+ {
+ return(FAIL);
+ }
+
+ if ((fp = fopen(testfile, "w+")) == NULL)
+ {
+ Fail("ERROR: fopen failed to create \"%s\"\n", testfile);
+ }
+
+ if ((fprintf(fp, "hello world")) < 0)
+ {
+ Fail("ERROR: fprintf failed to print to \"%s\"\n", testfile);
+ }
+
+ if ((fseek( fp, 0, SEEK_SET)) != 0)
+
+ {
+
+ Fail("ERROR: Fseek failed to set pointer to beginning of file\n" );
+
+ }
+
+
+
+ if ((fgets( buf, 100, fp )) == NULL)
+
+ {
+
+ Fail("ERROR: fgets failed\n");
+
+ }
+
+
+ if (memcmp(checkstr, buf, strlen(checkstr)+1) != 0)
+ {
+ Fail("ERROR: expected %s, got %s\n", checkstr, buf);
+ }
+
+
+
+ if ((fclose( fp )) != 0)
+
+ {
+
+ Fail("ERROR: fclose failed to close \"%s\"\n", testfile);
+
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fprintf/test1/testinfo.dat
new file mode 100644
index 0000000000..be3bf4b78a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/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 = fprintf
+Name = Positive Test for fprintf
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= A single, basic, test case with no formatting.
+= Test modeled after the sprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test10/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fprintf/test10/CMakeLists.txt
new file mode 100644
index 0000000000..f718ad7934
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test10/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test10.c
+)
+
+add_executable(paltest_fprintf_test10
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fprintf_test10 coreclrpal)
+
+target_link_libraries(paltest_fprintf_test10
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test10/test10.c b/src/pal/tests/palsuite/c_runtime/fprintf/test10/test10.c
new file mode 100644
index 0000000000..5988e8da74
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test10/test10.c
@@ -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: test10.c (fprintf)
+**
+** Purpose: Tests the octal specifier (%o).
+** This test is modeled after the fprintf series.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+#include "../fprintf.h"
+
+/*
+ * Depends on memcmp, strlen, fopen, fseek and fgets.
+ */
+
+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", "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/fprintf/test10/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fprintf/test10/testinfo.dat
new file mode 100644
index 0000000000..7afffeaf75
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test10/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 = fprintf
+Name = Positive Test for fprintf
+TYPE = DEFAULT
+EXE1 = test10
+Description
+= Tests the octal specifier (%o).
+= This test is modeled after the fprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test11/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fprintf/test11/CMakeLists.txt
new file mode 100644
index 0000000000..6ccd58ddd2
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test11/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test11.c
+)
+
+add_executable(paltest_fprintf_test11
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fprintf_test11 coreclrpal)
+
+target_link_libraries(paltest_fprintf_test11
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test11/test11.c b/src/pal/tests/palsuite/c_runtime/fprintf/test11/test11.c
new file mode 100644
index 0000000000..01880552b7
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test11/test11.c
@@ -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: test11.c (fprintf)
+**
+** Purpose: Test the unsigned int specifier (%u).
+** This test is modeled after the fprintf series.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+#include "../fprintf.h"
+
+/*
+ * Depends on memcmp, strlen, fopen, fseek and fgets.
+ */
+
+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", "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/fprintf/test11/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fprintf/test11/testinfo.dat
new file mode 100644
index 0000000000..8275f0f7ce
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test11/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 = fprintf
+Name = Positive Test for fprintf
+TYPE = DEFAULT
+EXE1 = test11
+Description
+= Test the unsigned int specifier (%u).
+= This test is modeled after the fprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test12/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fprintf/test12/CMakeLists.txt
new file mode 100644
index 0000000000..17bc7f100b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test12/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test12.c
+)
+
+add_executable(paltest_fprintf_test12
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fprintf_test12 coreclrpal)
+
+target_link_libraries(paltest_fprintf_test12
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test12/test12.c b/src/pal/tests/palsuite/c_runtime/fprintf/test12/test12.c
new file mode 100644
index 0000000000..0292e15014
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test12/test12.c
@@ -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: Tests the (lowercase) hexadecimal specifier (%x).
+** This test is modeled after the fprintf series.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+#include "../fprintf.h"
+
+/*
+ * Depends on memcmp, strlen, fopen, fseek and fgets.
+ */
+
+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", "foo 0x1234567887654321");
+ 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/fprintf/test12/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fprintf/test12/testinfo.dat
new file mode 100644
index 0000000000..4b44cfc313
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test12/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 = fprintf
+Name = Positive Test for fprintf
+TYPE = DEFAULT
+EXE1 = test12
+Description
+= Tests the (lowercase) hexadecimal specifier (%x).
+= This test is modeled after the fprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test13/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fprintf/test13/CMakeLists.txt
new file mode 100644
index 0000000000..c6eb0f9075
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test13/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test13.c
+)
+
+add_executable(paltest_fprintf_test13
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fprintf_test13 coreclrpal)
+
+target_link_libraries(paltest_fprintf_test13
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test13/test13.c b/src/pal/tests/palsuite/c_runtime/fprintf/test13/test13.c
new file mode 100644
index 0000000000..e171aeacce
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test13/test13.c
@@ -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 (fprintf)
+**
+** Purpose: Tests the (uppercase) hexadecimal specifier (%X).
+** This test is modeled after the fprintf series.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+#include "../fprintf.h"
+
+/*
+ * Depends on memcmp, strlen, fopen, fseek and fgets.
+ */
+
+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", "foo 0x1234567887654321");
+ 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/fprintf/test13/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fprintf/test13/testinfo.dat
new file mode 100644
index 0000000000..ae983ec78a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test13/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 = fprintf
+Name = Positive Test for fprintf
+TYPE = DEFAULT
+EXE1 = test13
+Description
+= Tests the (uppercase) hexadecimal specifier (%X).
+= This test is modeled after the fprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test14/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fprintf/test14/CMakeLists.txt
new file mode 100644
index 0000000000..6bb281bc62
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test14/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test14.c
+)
+
+add_executable(paltest_fprintf_test14
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fprintf_test14 coreclrpal)
+
+target_link_libraries(paltest_fprintf_test14
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test14/test14.c b/src/pal/tests/palsuite/c_runtime/fprintf/test14/test14.c
new file mode 100644
index 0000000000..5d7d77387d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test14/test14.c
@@ -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: test14.c (fprintf)
+**
+** Purpose: Tests the lowercase exponential
+** notation double specifier (%e).
+** This test is modeled after the fprintf series.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+#include "../fprintf.h"
+
+/*
+ * Depends on memcmp, strlen, fopen, fseek and fgets.
+ */
+
+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/fprintf/test14/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fprintf/test14/testinfo.dat
new file mode 100644
index 0000000000..f0a843f480
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/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 = fprintf
+Name = Positive Test for fprintf
+TYPE = DEFAULT
+EXE1 = test14
+Description
+= Tests the lowercase exponential
+= notation double specifier (%e).
+= This test is modeled after the fprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test15/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fprintf/test15/CMakeLists.txt
new file mode 100644
index 0000000000..ce1a8b6111
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test15/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test15.c
+)
+
+add_executable(paltest_fprintf_test15
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fprintf_test15 coreclrpal)
+
+target_link_libraries(paltest_fprintf_test15
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test15/test15.c b/src/pal/tests/palsuite/c_runtime/fprintf/test15/test15.c
new file mode 100644
index 0000000000..d024bdbd8a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test15/test15.c
@@ -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: test15.c (fprintf)
+**
+** Purpose: Tests the uppercase exponential
+** notation double specifier (%E).
+** This test is modeled after the fprintf series.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+#include "../fprintf.h"
+
+/*
+ * Depends on memcmp, strlen, fopen, fseek and fgets.
+ */
+
+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/fprintf/test15/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fprintf/test15/testinfo.dat
new file mode 100644
index 0000000000..fedabca3c6
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/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 = fprintf
+Name = Positive Test for fprintf
+TYPE = DEFAULT
+EXE1 = test15
+Description
+= Tests the uppercase exponential
+= notation double specifier (%E).
+= This test is modeled after the fprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test16/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fprintf/test16/CMakeLists.txt
new file mode 100644
index 0000000000..011cd13fb1
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test16/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test16.c
+)
+
+add_executable(paltest_fprintf_test16
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fprintf_test16 coreclrpal)
+
+target_link_libraries(paltest_fprintf_test16
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test16/test16.c b/src/pal/tests/palsuite/c_runtime/fprintf/test16/test16.c
new file mode 100644
index 0000000000..079faeaf59
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test16/test16.c
@@ -0,0 +1,48 @@
+// Licensed to the .NET Foundation under one or more 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 (fprintf)
+**
+** Purpose: Tests the decimal notation double specifier (%f).
+** This test is modeled after the fprintf series.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+#include "../fprintf.h"
+
+/*
+ * Depends on memcmp, strlen, fopen, fseek and fgets.
+ */
+
+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/fprintf/test16/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fprintf/test16/testinfo.dat
new file mode 100644
index 0000000000..ef93c7c05d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test16/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 = fprintf
+Name = Positive Test for fprintf
+TYPE = DEFAULT
+EXE1 = test16
+Description
+= Tests the decimal notation double specifier (%f).
+= This test is modeled after the fprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test17/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fprintf/test17/CMakeLists.txt
new file mode 100644
index 0000000000..4516f4b769
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test17/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test17.c
+)
+
+add_executable(paltest_fprintf_test17
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fprintf_test17 coreclrpal)
+
+target_link_libraries(paltest_fprintf_test17
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test17/test17.c b/src/pal/tests/palsuite/c_runtime/fprintf/test17/test17.c
new file mode 100644
index 0000000000..7bd817d7db
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test17/test17.c
@@ -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: test17.c (fprintf)
+**
+** Purpose: Tests the lowercase shorthand notation double specifier (%g).
+** This test is modeled after the fprintf series.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+#include "../fprintf.h"
+
+/*
+ * Depends on memcmp, strlen, fopen, fseek and fgets.
+ */
+
+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/fprintf/test17/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fprintf/test17/testinfo.dat
new file mode 100644
index 0000000000..420703c668
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test17/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 = fprintf
+Name = Positive Test for fprintf
+TYPE = DEFAULT
+EXE1 = test17
+Description
+= Tests the lowercase shorthand notation double specifier (%g).
+= This test is modeled after the fprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test18/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fprintf/test18/CMakeLists.txt
new file mode 100644
index 0000000000..fc035020ca
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test18/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test18.c
+)
+
+add_executable(paltest_fprintf_test18
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fprintf_test18 coreclrpal)
+
+target_link_libraries(paltest_fprintf_test18
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test18/test18.c b/src/pal/tests/palsuite/c_runtime/fprintf/test18/test18.c
new file mode 100644
index 0000000000..6582c41e0f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test18/test18.c
@@ -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: test18.c (fprintf)
+**
+** Purpose: Tests the uppercase shorthand notation double specifier (%G).
+** This test is modeled after the fprintf series.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+#include "../fprintf.h"
+
+/*
+ * Depends on memcmp, strlen, fopen, fseek and fgets.
+ */
+
+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/fprintf/test18/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fprintf/test18/testinfo.dat
new file mode 100644
index 0000000000..129febec27
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test18/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 = fprintf
+Name = Positive Test for fprintf
+TYPE = DEFAULT
+EXE1 = test18
+Description
+= Tests the uppercase shorthand notation double specifier (%G).
+= This test is modeled after the fprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test19/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fprintf/test19/CMakeLists.txt
new file mode 100644
index 0000000000..3781b426f2
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test19/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test19.c
+)
+
+add_executable(paltest_fprintf_test19
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fprintf_test19 coreclrpal)
+
+target_link_libraries(paltest_fprintf_test19
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test19/test19.c b/src/pal/tests/palsuite/c_runtime/fprintf/test19/test19.c
new file mode 100644
index 0000000000..9d9a28c325
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test19/test19.c
@@ -0,0 +1,153 @@
+// Licensed to the .NET Foundation under one or more 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 (fprintf)
+**
+** Purpose: Tests the variable length precision argument.
+** This test is modeled after the fprintf series.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+#include "../fprintf.h"
+
+/*
+ * Depends on memcmp, strlen, fopen, fseek and fgets.
+ */
+
+#define DOTEST(a,b,c,d,e,f) DoTest(a,b,(void*)c,d,e,f)
+
+void DoTest(char *formatstr, int precision, void *param,
+ char *paramstr, char *checkstr1, char *checkstr2)
+{
+ FILE *fp;
+ char buf[256];
+
+ if ((fp = fopen("testfile.txt", "w+")) == NULL )
+ {
+ Fail("ERROR: fopen failed to create testfile\n");
+ }
+
+ if ((fprintf(fp, formatstr, precision, param)) < 0)
+ {
+ Fail("ERROR: fprintf failed\n");
+ }
+
+ if ((fseek(fp, 0, SEEK_SET)) != 0)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+
+ if ((fgets(buf, 100, fp)) == NULL)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+
+ if (memcmp(buf, checkstr1, strlen(buf) + 1) != 0 &&
+ memcmp(buf, checkstr2, strlen(buf) + 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);
+ }
+
+ if ((fclose( fp )) != 0)
+
+ {
+ Fail("ERROR: fclose failed to close \"testfile.txt\"\n");
+ }
+
+}
+
+void DoublePrecTest(char *formatstr, int precision,
+ double param, char *checkstr1, char *checkstr2)
+{
+ FILE *fp;
+ char buf[256];
+
+ if ((fp = fopen("testfile.txt", "w+")) == NULL )
+ {
+ Fail("ERROR: fopen failed to create testfile\n");
+ }
+
+ if ((fprintf(fp, formatstr, precision, param)) < 0)
+ {
+ Fail("ERROR: fprintf failed\n");
+ }
+
+ if ((fseek(fp, 0, SEEK_SET)) != 0)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+
+ if ((fgets(buf, 100, fp)) == NULL)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+
+ if (memcmp(buf, checkstr1, strlen(buf) + 1) != 0 &&
+ memcmp(buf, checkstr2, strlen(buf) + 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);
+ }
+
+ if ((fclose( fp )) != 0)
+ {
+ Fail("ERROR: fclose failed to close \"testfile.txt\"\n");
+ }
+
+}
+
+int __cdecl main(int argc, char *argv[])
+{
+
+ if (PAL_Initialize(argc, argv) != 0)
+ return(FAIL);
+
+ DOTEST("%.*s", 2, "bar", "bar", "ba", "ba");
+ DOTEST("%.*S", 2, convert("bar"), "bar", "ba", "ba");
+
+ //DOTEST("%.*n", 4, 2, "2", "0002");
+ DOTEST("%.*c", 0, 'a', "a", "a", "a");
+ DOTEST("%.*c", 4, 'a', "a", "a", "a");
+ DOTEST("%.*C", 0, (WCHAR)'a', "a", "a", "a");
+ DOTEST("%.*C", 4, (WCHAR)'a', "a", "a", "a");
+ DOTEST("%.*d", 1, 42, "42", "42", "42");
+ DOTEST("%.*d", 3, 42, "42", "042", "042");
+ DOTEST("%.*i", 1, 42, "42", "42", "42");
+ DOTEST("%.*i", 3, 42, "42", "042", "042");
+ DOTEST("%.*o", 1, 42, "42", "52", "52");
+ DOTEST("%.*o", 3, 42, "42", "052", "052");
+ DOTEST("%.*u", 1, 42, "42", "42", "42");
+ DOTEST("%.*u", 3, 42, "42", "042", "042");
+ DOTEST("%.*x", 1, 0x42, "0x42", "42", "42");
+ DOTEST("%.*x", 3, 0x42, "0x42", "042", "042");
+ DOTEST("%.*X", 1, 0x42, "0x42", "42", "42");
+ DOTEST("%.*X", 3, 0x42, "0x42", "042", "042");
+
+
+ DoublePrecTest("%.*e", 1, 2.01, "2.0e+000", "2.0e+00");
+ DoublePrecTest("%.*e", 3, 2.01, "2.010e+000", "2.010e+00");
+ DoublePrecTest("%.*E", 1, 2.01, "2.0E+000", "2.0E+00");
+ DoublePrecTest("%.*E", 3, 2.01, "2.010E+000", "2.010E+00");
+ DoublePrecTest("%.*f", 1, 2.01, "2.0", "2.0");
+ DoublePrecTest("%.*f", 3, 2.01, "2.010", "2.010");
+ DoublePrecTest("%.*g", 1, 256.01, "3e+002", "3e+02");
+ DoublePrecTest("%.*g", 3, 256.01, "256", "256");
+ DoublePrecTest("%.*g", 4, 256.01, "256", "256");
+ DoublePrecTest("%.*g", 6, 256.01, "256.01", "256.01");
+ DoublePrecTest("%.*G", 1, 256.01, "3E+002", "3E+02");
+ DoublePrecTest("%.*G", 3, 256.01, "256", "256");
+ DoublePrecTest("%.*G", 4, 256.01, "256", "256");
+ DoublePrecTest("%.*G", 6, 256.01, "256.01", "256.01");
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test19/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fprintf/test19/testinfo.dat
new file mode 100644
index 0000000000..25025b920a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test19/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 = fprintf
+Name = Positive Test for fprintf
+TYPE = DEFAULT
+EXE1 = test19
+Description
+= Tests the variable length precision argument.
+= This test is modeled after the fprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fprintf/test2/CMakeLists.txt
new file mode 100644
index 0000000000..0ef44b6b7d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test2/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test2.c
+)
+
+add_executable(paltest_fprintf_test2
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fprintf_test2 coreclrpal)
+
+target_link_libraries(paltest_fprintf_test2
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test2/test2.c b/src/pal/tests/palsuite/c_runtime/fprintf/test2/test2.c
new file mode 100644
index 0000000000..1ed7f3fd23
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test2/test2.c
@@ -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: test2.c (fprintf)
+**
+** Purpose: Tests the string specifier (%s).
+** This test is modeled after the fprintf series.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+#include "../fprintf.h"
+
+/*
+ * Depends on memcmp, strlen, fopen, fseek and fgets.
+ */
+
+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/fprintf/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fprintf/test2/testinfo.dat
new file mode 100644
index 0000000000..d4c7dbff43
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test2/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 = fprintf
+Name = Positive Test for fprintf
+TYPE = DEFAULT
+EXE1 = test2
+Description
+= Tests the string specifier (%s).
+= This test is modeled after the fprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fprintf/test3/CMakeLists.txt
new file mode 100644
index 0000000000..adfd36fce7
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test3/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test3.c
+)
+
+add_executable(paltest_fprintf_test3
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fprintf_test3 coreclrpal)
+
+target_link_libraries(paltest_fprintf_test3
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test3/test3.c b/src/pal/tests/palsuite/c_runtime/fprintf/test3/test3.c
new file mode 100644
index 0000000000..6185135581
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test3/test3.c
@@ -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: test3.c (fprintf)
+**
+** Purpose: Tests the wide string specifier (%S).
+** This test is modeled after the fprintf series.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+#include "../fprintf.h"
+
+/*
+ * Depends on memcmp, strlen, fopen, fseek and fgets.
+ */
+
+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/fprintf/test3/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fprintf/test3/testinfo.dat
new file mode 100644
index 0000000000..88a1b03a7f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test3/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 = fprintf
+Name = Positive Test for fprintf
+TYPE = DEFAULT
+EXE1 = test3
+Description
+= Tests the wide string specifier (%S).
+= This test is modeled after the fprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test4/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fprintf/test4/CMakeLists.txt
new file mode 100644
index 0000000000..7d471b1b9c
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test4/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test4.c
+)
+
+add_executable(paltest_fprintf_test4
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fprintf_test4 coreclrpal)
+
+target_link_libraries(paltest_fprintf_test4
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test4/test4.c b/src/pal/tests/palsuite/c_runtime/fprintf/test4/test4.c
new file mode 100644
index 0000000000..51ec1f099c
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test4/test4.c
@@ -0,0 +1,110 @@
+// Licensed to the .NET Foundation under one or more 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 (fprintf)
+**
+** Purpose: Tests the pointer specifier (%p).
+** This test is modeled after the fprintf series.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+#include "../fprintf.h"
+
+/*
+ * Depends on memcmp, strlen, fopen, fseek and fgets.
+ */
+
+static void DoTest(char *formatstr, void* param, char* paramstr,
+ char *checkstr1, char *checkstr2)
+{
+ FILE *fp;
+ char buf[256] = { 0 };
+
+ if ((fp = fopen("testfile.txt", "w+")) == NULL )
+ {
+ Fail("ERROR: fopen failed to create testfile\n");
+ }
+
+ if ((fprintf(fp, formatstr, param)) < 0)
+ {
+ Fail("ERROR: fprintf failed\n");
+ }
+
+ if ((fseek(fp, 0, SEEK_SET)) != 0)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+
+ if ((fgets(buf, 100, fp)) == NULL)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+
+ if (memcmp(buf, checkstr1, strlen(buf) + 1) != 0 &&
+ memcmp(buf, checkstr2, strlen(buf) + 1) != 0 )
+ {
+ Fail("ERROR: failed to insert %s into \"%s\"\n"
+ "Expected \"%s\" or \"%s\" got \"%s\".\n",
+ paramstr, formatstr, checkstr1, checkstr2, buf);
+ }
+
+ if ((fclose( fp )) != 0)
+
+ {
+
+ Fail("ERROR: fclose failed to close \"testfile.txt\"\n");
+
+ }
+}
+
+
+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");
+ DoTest("%p", NULL, "NULL", "0000000000000000", "0x0");
+ DoTest("%p", ptr, "pointer to 0x123456", "0000000000123456", "0x123456");
+ DoTest("%17p", ptr, "pointer to 0x123456", " 0000000000123456", " 0x123456");
+ DoTest("%17p", ptr, "pointer to 0x123456", " 0000000000123456", "0x0123456");
+ DoTest("%-17p", ptr, "pointer to 0x123456", "0000000000123456 ", "0x123456 ");
+ DoTest("%+p", ptr, "pointer to 0x123456", "0000000000123456", "0x123456");
+ DoTest("%#p", ptr, "pointer to 0x123456", "0X0000000000123456", "0x123456");
+ DoTest("%lp", ptr, "pointer to 0x123456", "00123456", "0x123456");
+ DoTest("%hp", ptr, "pointer to 0x123456", "00003456", "0x3456");
+ DoTest("%Lp", ptr, "pointer to 0x123456", "00123456", "0x123456");
+ DoI64Test("%I64p", lptr, "pointer to 0x1234567887654321",
+ "1234567887654321", "0x1234567887654321");
+#else
+ Trace("Testing for Non 64 Bit Platforms \n");
+ DoTest("%p", NULL, "NULL", "00000000", "0x0");
+ DoTest("%p", ptr, "pointer to 0x123456", "00123456", "0x123456");
+ DoTest("%9p", ptr, "pointer to 0x123456", " 00123456", " 0x123456");
+ DoTest("%09p", ptr, "pointer to 0x123456", " 00123456", "0x0123456");
+ DoTest("%-9p", ptr, "pointer to 0x123456", "00123456 ", "0x123456 ");
+ DoTest("%+p", ptr, "pointer to 0x123456", "00123456", "0x123456");
+ DoTest("%#p", ptr, "pointer to 0x123456", "0X00123456", "0x123456");
+ DoTest("%lp", ptr, "pointer to 0x123456", "00123456", "0x123456");
+ DoTest("%hp", ptr, "pointer to 0x123456", "00003456", "0x3456");
+ DoTest("%Lp", ptr, "pointer to 0x123456", "00123456", "0x123456");
+ DoI64Test("%I64p", lptr, "pointer to 0x1234567887654321",
+ "1234567887654321", "0x1234567887654321");
+#endif
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test4/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fprintf/test4/testinfo.dat
new file mode 100644
index 0000000000..5f373ac230
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test4/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 = fprintf
+Name = Positive Test for fprintf
+TYPE = DEFAULT
+EXE1 = test4
+Description
+= Tests the pointer specifier (%p).
+= This test is modeled after the fprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test5/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fprintf/test5/CMakeLists.txt
new file mode 100644
index 0000000000..1e3a568513
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test5/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test5.c
+)
+
+add_executable(paltest_fprintf_test5
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fprintf_test5 coreclrpal)
+
+target_link_libraries(paltest_fprintf_test5
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test5/test5.c b/src/pal/tests/palsuite/c_runtime/fprintf/test5/test5.c
new file mode 100644
index 0000000000..c53e3f45b4
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test5/test5.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: test5.c (fprintf)
+**
+** Purpose: Tests the count specifier (%n).
+** This test is modeled after the fprintf series.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+#include "../fprintf.h"
+
+/*
+ * Depends on memcmp, strlen, fopen, fseek and fgets.
+ */
+
+static void DoTest(char *formatstr, int param, char *checkstr)
+{
+ FILE *fp;
+ char buf[256] = { 0 };
+ int n = -1;
+
+ if ((fp = fopen("testfile.txt", "w+")) == NULL )
+ {
+ Fail("ERROR: fopen failed to create testfile\n");
+ }
+
+ if ((fprintf(fp, formatstr, &n)) < 0)
+ {
+ Fail("ERROR: fprintf failed\n");
+ }
+
+ if ((fseek(fp, 0, SEEK_SET)) != 0)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+
+ if ((fgets(buf, 100, fp)) == NULL)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+
+ if (n != param)
+ {
+ Fail("ERROR: Expected count parameter to resolve to %d, got %X\n",
+ param, n);
+ }
+
+ if (memcmp(buf, checkstr, strlen(buf) + 1) != 0)
+ {
+ Fail("ERROR: Expected \"%s\" got \"%s\".\n", checkstr, buf);
+ }
+
+
+ if ((fclose( fp )) != 0)
+
+ {
+
+ Fail("ERROR: fclose failed to close \"testfile.txt\"\n");
+
+ }
+}
+
+static void DoShortTest(char *formatstr, int param, char *checkstr)
+{
+ FILE *fp;
+ char buf[256] = { 0 };
+ short int n = -1;
+
+ if ((fp = fopen("testfile.txt", "w+")) == NULL )
+ {
+ Fail("ERROR: fopen failed to create testfile\n");
+ }
+
+ if ((fprintf(fp, formatstr, &n)) < 0)
+ {
+ Fail("ERROR: fprintf failed\n");
+ }
+
+ if ((fseek(fp, 0, SEEK_SET)) != 0)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+
+ if ((fgets(buf, 100, fp)) == NULL)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+
+ if (n != param)
+ {
+ Fail("ERROR: Expected count parameter to resolve to %d, got %X\n",
+ param, n);
+ }
+
+ if (memcmp(buf, checkstr, strlen(buf) + 1) != 0)
+ {
+ Fail("ERROR: Expected \"%s\" got \"%s\".\n", checkstr, buf);
+ }
+
+ if ((fclose( fp )) != 0)
+ {
+ Fail("ERROR: fclose failed to close \"testfile.txt\"\n");
+ }
+}
+
+int __cdecl main(int argc, char *argv[])
+{
+ if (PAL_Initialize(argc, argv) != 0)
+ return(FAIL);
+
+ DoTest("foo %n bar", 4, "foo bar");
+ DoTest("foo %#n bar", 4, "foo bar");
+ DoTest("foo % n bar", 4, "foo bar");
+ DoTest("foo %+n bar", 4, "foo bar");
+ DoTest("foo %-n bar", 4, "foo bar");
+ DoTest("foo %0n bar", 4, "foo bar");
+ DoShortTest("foo %hn bar", 4, "foo bar");
+ DoTest("foo %ln bar", 4, "foo bar");
+ DoTest("foo %Ln bar", 4, "foo bar");
+ DoTest("foo %I64n bar", 4, "foo bar");
+ DoTest("foo %20.3n bar", 4, "foo bar");
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test5/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fprintf/test5/testinfo.dat
new file mode 100644
index 0000000000..b4d0e81777
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test5/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 = fprintf
+Name = Positive Test for fprintf
+TYPE = DEFAULT
+EXE1 = test5
+Description
+= Tests the count specifier (%n).
+= This test is modeled after the fprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test6/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fprintf/test6/CMakeLists.txt
new file mode 100644
index 0000000000..89620dd453
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test6/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test6.c
+)
+
+add_executable(paltest_fprintf_test6
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fprintf_test6 coreclrpal)
+
+target_link_libraries(paltest_fprintf_test6
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test6/test6.c b/src/pal/tests/palsuite/c_runtime/fprintf/test6/test6.c
new file mode 100644
index 0000000000..0a8bc6b103
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test6/test6.c
@@ -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 (fprintf)
+**
+** Purpose: Tests the char specifier (%c).
+** This test is modeled after the fprintf series.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+#include "../fprintf.h"
+
+/*
+ * Depends on memcmp, strlen, fopen, fseek and fgets.
+ */
+
+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/fprintf/test6/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fprintf/test6/testinfo.dat
new file mode 100644
index 0000000000..a8a071ca21
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test6/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 = fprintf
+Name = Positive Test for fprintf
+TYPE = DEFAULT
+EXE1 = test6
+Description
+= Tests the char specifier (%c).
+= This test is modeled after the fprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test7/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fprintf/test7/CMakeLists.txt
new file mode 100644
index 0000000000..3dc10dd6dc
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test7/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test7.c
+)
+
+add_executable(paltest_fprintf_test7
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fprintf_test7 coreclrpal)
+
+target_link_libraries(paltest_fprintf_test7
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test7/test7.c b/src/pal/tests/palsuite/c_runtime/fprintf/test7/test7.c
new file mode 100644
index 0000000000..088e328de5
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test7/test7.c
@@ -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: test7.c (fprintf)
+**
+** Purpose: Tests the wide char specifier (%C).
+** This test is modeled after the fprintf series.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+#include "../fprintf.h"
+
+/*
+ * Depends on memcmp, strlen, fopen, fseek and fgets.
+ */
+
+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/fprintf/test7/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fprintf/test7/testinfo.dat
new file mode 100644
index 0000000000..fc12718063
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test7/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 = fprintf
+Name = Positive Test for fprintf
+TYPE = DEFAULT
+EXE1 = test7
+Description
+= Tests the wide char specifier (%C).
+= This test is modeled after the fprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test8/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fprintf/test8/CMakeLists.txt
new file mode 100644
index 0000000000..f6dd984af9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test8/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test8.c
+)
+
+add_executable(paltest_fprintf_test8
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fprintf_test8 coreclrpal)
+
+target_link_libraries(paltest_fprintf_test8
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test8/test8.c b/src/pal/tests/palsuite/c_runtime/fprintf/test8/test8.c
new file mode 100644
index 0000000000..c781abc968
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test8/test8.c
@@ -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 (fprintf)
+**
+** Purpose: Tests the decimal specifier (%d).
+** This test is modeled after the fprintf series.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+#include "../fprintf.h"
+
+/*
+ * Depends on memcmp, strlen, fopen, fseek and fgets.
+ */
+
+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", "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/fprintf/test8/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fprintf/test8/testinfo.dat
new file mode 100644
index 0000000000..2609260786
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test8/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 = fprintf
+Name = Positive Test for fprintf
+TYPE = DEFAULT
+EXE1 = test8
+Description
+= Tests the decimal specifier (%d).
+= This test is modeled after the fprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test9/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fprintf/test9/CMakeLists.txt
new file mode 100644
index 0000000000..62aa85e6ff
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test9/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test9.c
+)
+
+add_executable(paltest_fprintf_test9
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fprintf_test9 coreclrpal)
+
+target_link_libraries(paltest_fprintf_test9
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test9/test9.c b/src/pal/tests/palsuite/c_runtime/fprintf/test9/test9.c
new file mode 100644
index 0000000000..3b06daec48
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test9/test9.c
@@ -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 (fprintf)
+**
+** Purpose: Tests the integer specifier (%i).
+** This test is modeled after the fprintf series.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+#include "../fprintf.h"
+
+/*
+ * Depends on memcmp, strlen, fopen, fseek and fgets.
+ */
+
+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", "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/fprintf/test9/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fprintf/test9/testinfo.dat
new file mode 100644
index 0000000000..e502af70b2
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fprintf/test9/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 = fprintf
+Name = Positive Test for fprintf
+TYPE = DEFAULT
+EXE1 = test9
+Description
+= Tests the integer specifier (%i).
+= This test is modeled after the fprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fputs/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fputs/CMakeLists.txt
new file mode 100644
index 0000000000..ef14ea5352
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fputs/CMakeLists.txt
@@ -0,0 +1,5 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+add_subdirectory(test2)
+
diff --git a/src/pal/tests/palsuite/c_runtime/fputs/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fputs/test1/CMakeLists.txt
new file mode 100644
index 0000000000..e4a92d5966
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fputs/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_fputs_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fputs_test1 coreclrpal)
+
+target_link_libraries(paltest_fputs_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fputs/test1/test1.c b/src/pal/tests/palsuite/c_runtime/fputs/test1/test1.c
new file mode 100644
index 0000000000..b90ea082e9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fputs/test1/test1.c
@@ -0,0 +1,100 @@
+// Licensed to the .NET Foundation under one or more 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 fputs twice and write two strings to a file. Then
+** call fread on the file and check that the data which was written is what
+** we expect it to be.
+**
+
+**
+**===================================================================*/
+
+
+#include <palsuite.h>
+
+
+int __cdecl main(int argc, char **argv)
+{
+
+ FILE* TheFile;
+ char* StringOne = "FooBar";
+ char* StringTwo = "BarFoo";
+ char* CompleteString = "FooBarBarFoo";
+ char ReadBuffer[64];
+ int ret;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ /* Open the file that we'll be working with */
+
+ TheFile = fopen("TestFile", "w+");
+
+ if(TheFile == NULL)
+ {
+ Fail("ERROR: fopen failed to open the file 'TestFile' in read/write "
+ "mode.\n");
+ }
+
+ /* Call fputs twice to write two strings to the file stream */
+
+ if(fputs(StringOne, TheFile) < 0)
+ {
+ Fail("ERROR: fputs returned a negative value when attempting to "
+ "put the string '%s' to the file.\n",StringOne);
+ }
+
+ if(fputs(StringTwo, TheFile) < 0)
+ {
+ Fail("ERROR: fputs returned a negative value when attempting to "
+ "put the string '%s' to the file.\n",StringTwo);
+ }
+
+ /* Flush the buffers */
+ if(fflush(TheFile) != 0)
+ {
+ Fail("ERROR: fflush failed to properly flush the buffers.\n");
+ }
+
+ /* Now read from the file to ensure the data was written correctly.
+ Note: We read more than what was written to make sure nothing extra
+ was written.
+ */
+
+ if(fseek(TheFile, 0, SEEK_SET) != 0)
+ {
+ Fail("ERROR: fseek failed to set the file pointer back to the start "
+ "of the file.\n");
+ }
+
+
+ if((ret = fread(ReadBuffer, 1, 20, TheFile)) != 12)
+ {
+ Fail("ERROR: fread should have returned that it read in 12 characters "
+ "from the file, but instead it returned %d.\n", ret);
+ }
+
+ ReadBuffer[ret] = '\0';
+
+ if(strcmp(ReadBuffer, CompleteString) != 0)
+ {
+ Fail("ERROR: The data read back from the file is not exactly the same "
+ "as the data that was written by fputs. The file contains '%s' "
+ "instead of '%s'.\n",ReadBuffer, CompleteString);
+ }
+
+ if(fclose(TheFile) != 0)
+ {
+ Fail("ERROR: fclose failed to close the file stream.\n");
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/fputs/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fputs/test1/testinfo.dat
new file mode 100644
index 0000000000..bdef09c60f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fputs/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 = fputs
+Name = Check that fputs writes correctly to a valid stream
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Call fputs twice and write two strings to a file. Then
+= call fread on the file and check that the data which was written is what
+= we expect it to be.
diff --git a/src/pal/tests/palsuite/c_runtime/fputs/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fputs/test2/CMakeLists.txt
new file mode 100644
index 0000000000..6e939f3346
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fputs/test2/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test2.c
+)
+
+add_executable(paltest_fputs_test2
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fputs_test2 coreclrpal)
+
+target_link_libraries(paltest_fputs_test2
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fputs/test2/test2.c b/src/pal/tests/palsuite/c_runtime/fputs/test2/test2.c
new file mode 100644
index 0000000000..b8e2f410bb
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fputs/test2/test2.c
@@ -0,0 +1,88 @@
+// Licensed to the .NET Foundation under one or more 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: Check to see that fputs fails and returns EOF when called on
+** a closed file stream and a read-only file stream.
+**
+
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char **argv)
+{
+
+ FILE* TheFile;
+ char* StringOne = "FooBar";
+ int ret;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ /* Create a file with read/write access */
+
+ TheFile = fopen("TestFile", "w+");
+
+ if(TheFile == NULL)
+ {
+ Fail("ERROR: fopen failed to open the file 'TestFile' in read/write "
+ "mode.\n");
+ }
+
+ /* Then close that file we just opened */
+
+ if(fclose(TheFile) != 0)
+ {
+ Fail("ERROR: fclose failed to close the file.\n");
+ }
+
+ /* Check that calling fputs on this closed file stream fails. */
+
+ if((ret = fputs(StringOne, TheFile)) >= 0)
+ {
+ Fail("ERROR: fputs should have failed to write to a closed "
+ "file stream, but it didn't return a negative value.\n");
+ }
+
+ if(ret != EOF)
+ {
+ Fail("ERROR: fputs should have returned EOF on an error, but instead "
+ "returned %d.\n",ret);
+ }
+
+ /* Open a file as Readonly */
+
+ TheFile = fopen("TestFile", "r");
+
+ if(TheFile == NULL)
+ {
+ Fail("ERROR: fopen failed to open the file 'TestFile' in read/write "
+ "mode.\n");
+ }
+
+ /* Check that fputs fails when trying to write to a read-only stream */
+
+ if((ret = fputs(StringOne, TheFile)) >= 0)
+ {
+ Fail("ERROR: fputs should have failed to write to a read-only "
+ "file stream, but it didn't return a negative value.\n");
+ }
+
+ if(ret != EOF)
+ {
+ Fail("ERROR: fputs should have returned EOF when writing to a "
+ "read-only filestream, but instead "
+ "returned %d.\n",ret);
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/fputs/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fputs/test2/testinfo.dat
new file mode 100644
index 0000000000..0e2abbdc30
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fputs/test2/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 = fputs
+Name = Check that fputs returns EOF when called on closed/readonly streams
+TYPE = DEFAULT
+EXE1 = test2
+Description
+= Check to see that fputs fails and returns EOF when called on
+= a closed file stream and a read-only file stream.
diff --git a/src/pal/tests/palsuite/c_runtime/fread/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fread/CMakeLists.txt
new file mode 100644
index 0000000000..1962ade358
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fread/CMakeLists.txt
@@ -0,0 +1,6 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+add_subdirectory(test2)
+add_subdirectory(test3)
+
diff --git a/src/pal/tests/palsuite/c_runtime/fread/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fread/test1/CMakeLists.txt
new file mode 100644
index 0000000000..a2e09579b1
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fread/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_fread_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fread_test1 coreclrpal)
+
+target_link_libraries(paltest_fread_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fread/test1/test1.c b/src/pal/tests/palsuite/c_runtime/fread/test1/test1.c
new file mode 100644
index 0000000000..b706b2e91c
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fread/test1/test1.c
@@ -0,0 +1,135 @@
+// Licensed to the .NET Foundation under one or more 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 fread function.
+** Open a file in READ mode, and then try to read all
+** the characters, more than all the characters,
+** 0 characters and 0 sized characters and check that
+** the return values are correct.
+**
+** Depends:
+** fopen
+** fseek
+** fclose
+**
+**
+**===================================================================*/
+
+/* Note: testfile should exist in the directory with 15 characters
+ in it ... something got lost if it isn't here.
+*/
+
+/* Note: Under win32, fread() crashes when passed NULL. The test to ensure that
+ it returns 0 has been removed to reflect this.
+*/
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char **argv)
+{
+ const char filename[] = "testfile";
+ char buffer[128];
+ FILE * fp = NULL;
+ int result;
+
+ if (0 != PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ /* Open a file in READ mode */
+
+ if((fp = fopen(filename, "r")) == NULL)
+ {
+ Fail("Unable to open a file for reading. Is the file "
+ "in the directory? It should be.");
+ }
+
+ /* Read 15 characters from the file. The file has exactly this many
+ in it.
+ */
+ if((result = fread(buffer,1,15,fp)) == 0)
+ {
+ Fail("ERROR: Zero characters read from the file. It should have "
+ "15 characters in it.");
+ }
+
+ if(result != 15)
+ {
+ Fail("ERROR: The fread function should have returned that it read "
+ "in 15 characters from the file. But it indicates having "
+ "read %i characters.",result);
+ }
+
+ /* Go back to the start of the file */
+
+ if(fseek(fp, 0, SEEK_SET))
+ {
+ Fail("ERROR: fseek failed, and this test depends on it.");
+ }
+
+ /* Attempt to read 17 characters, the return should still be 15 */
+
+ if((result = fread(buffer,1,17,fp)) == 0)
+ {
+ Fail("ERROR: Zero characters read from the file. It should have "
+ "15 characters in it. Though, it attempted to read 17.");
+ }
+
+ if(result != 15)
+ {
+ Fail("ERROR: The fread function should have returned that it read "
+ "in 15 characters from the file. "
+ "But it indicates having read %i characters.",result);
+ }
+
+ /* Back to the start of the file */
+
+ if(fseek(fp, 0, SEEK_SET))
+ {
+ Fail("ERROR: fseek failed, and this test depends on it.");
+ }
+
+ /* Read 0 characters and ensure the function returns 0 */
+
+ if((result = fread(buffer,1,0,fp)) != 0)
+ {
+ Fail("ERROR: The return value should be 0, as we attempted to "
+ "read 0 characters.");
+ }
+
+ /* Read characters of 0 size and ensure the return value is 0 */
+
+ if((result = fread(buffer,0,5,fp)) != 0)
+ {
+ Fail("ERROR: The return value should be 0, as we attempted to "
+ "read 0 sized data.");
+ }
+
+ /* Close the file */
+
+ if(fclose(fp))
+ {
+ Fail("ERROR: fclose failed. Test depends on it.");
+ }
+
+ /* Read 5 characters of 1 size from a closed file pointer
+ and ensure the return value is 0
+ */
+
+ if((result = fread(buffer,1,5,fp)) != 0)
+ {
+ Fail("ERROR: The return value should be 0, as we attempted to "
+ "read data from a closed file pointer.");
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/fread/test1/testfile b/src/pal/tests/palsuite/c_runtime/fread/test1/testfile
new file mode 100644
index 0000000000..273c1a9ffd
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fread/test1/testfile
@@ -0,0 +1 @@
+This is a test. \ No newline at end of file
diff --git a/src/pal/tests/palsuite/c_runtime/fread/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fread/test1/testinfo.dat
new file mode 100644
index 0000000000..0f8b860616
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fread/test1/testinfo.dat
@@ -0,0 +1,15 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = fread
+Name = Positive Test for fread
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Tests the PAL implementation of the fread function.
+= Open a file in READ mode, and then try to read all the characters,
+= more than all the characters, 0 characters and 0 sized characters and
+= check that the return values are correct.
diff --git a/src/pal/tests/palsuite/c_runtime/fread/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fread/test2/CMakeLists.txt
new file mode 100644
index 0000000000..0538e0c3af
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fread/test2/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test2.c
+)
+
+add_executable(paltest_fread_test2
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fread_test2 coreclrpal)
+
+target_link_libraries(paltest_fread_test2
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fread/test2/test2.c b/src/pal/tests/palsuite/c_runtime/fread/test2/test2.c
new file mode 100644
index 0000000000..d7262a9321
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fread/test2/test2.c
@@ -0,0 +1,143 @@
+// Licensed to the .NET Foundation under one or more 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 the PAL implementation of the fread function.
+** Open a file in READ mode, and then try to read all
+** the characters, more than all the characters,
+** 0 characters and 0 sized characters and check that
+** the strings read in are correct.
+**
+** Depends:
+** fopen
+** fseek
+** fclose
+** strcmp
+** memset
+**
+**
+**===================================================================*/
+
+/* Note: testfile should exist in the directory with 15 characters
+ in it ... something got lost if it isn't here.
+*/
+
+/* Note: The behaviour in win32 is to crash if a NULL pointer is passed to
+ fread, so the test to check that it returns 0 has been removed.
+*/
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char **argv)
+{
+ const char filename[] = "testfile";
+ char buffer[128];
+ FILE * fp = NULL;
+
+ if (0 != PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ /* Open a file in READ mode */
+
+ if((fp = fopen(filename, "r")) == NULL)
+ {
+ Fail("Unable to open a file for reading. Is the file "
+ "in the directory? It should be.");
+ }
+
+ /* Read 15 characters from the file. The file has exactly this many
+ in it. Then check to see that the data read in is correct.
+ Note: The 'testfile' should have "This is a test." written in it.
+ */
+ memset(buffer,'\0',128);
+ fread(buffer,1,15,fp);
+
+ if(strcmp(buffer,"This is a test.") != 0)
+ {
+ Fail("ERROR: The data read in should have been "
+ "'This is a test.' but, the buffer contains '%s'.",
+ buffer);
+ }
+
+ /* Go back to the start of the file */
+
+ if(fseek(fp, 0, SEEK_SET))
+ {
+ Fail("ERROR: fseek failed, and this test depends on it.");
+ }
+
+ /* Attempt to read 17 characters. The same 15 characters should
+ be in the buffer.
+ */
+
+ memset(buffer,'\0',128);
+ fread(buffer,1,17,fp);
+
+ if(strcmp(buffer,"This is a test.") != 0)
+ {
+ Fail("ERROR: The data read in should have been "
+ "'This is a test.' but, the buffer contains '%s'.",
+ buffer);
+ }
+
+ /* Back to the start of the file */
+
+ if(fseek(fp, 0, SEEK_SET))
+ {
+ Fail("ERROR: fseek failed, and this test depends on it.");
+ }
+
+ /* Read 0 characters and ensure the buffer is empty */
+
+ memset(buffer,'\0',128);
+ fread(buffer,1,0,fp);
+
+ if(strcmp(buffer,"\0") != 0)
+ {
+ Fail("ERROR: The data read in should have been "
+ "NULL but, the buffer contains '%s'.",
+ buffer);
+ }
+
+ /* Read characters of 0 size and ensure the buffer is empty */
+
+ memset(buffer,'\0',128);
+ fread(buffer,0,5,fp);
+
+ if(strcmp(buffer,"\0") != 0)
+ {
+ Fail("ERROR: The data read in should have been "
+ "NULL but, the buffer contains '%s'.",
+ buffer);
+ }
+
+ /* Close the file */
+
+ if(fclose(fp))
+ {
+ Fail("ERROR: fclose failed. Test depends on it.");
+ }
+
+ /* Read 5 characters of 1 size from a closed file pointer
+ and ensure the buffer is empty
+ */
+ memset(buffer,'\0',128);
+ fread(buffer,1,5,fp);
+ if(strcmp(buffer,"\0") != 0)
+ {
+ Fail("ERROR: The data read in should have been "
+ "NULL but, the buffer contains '%s'.",
+ buffer);
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/fread/test2/testfile b/src/pal/tests/palsuite/c_runtime/fread/test2/testfile
new file mode 100644
index 0000000000..273c1a9ffd
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fread/test2/testfile
@@ -0,0 +1 @@
+This is a test. \ No newline at end of file
diff --git a/src/pal/tests/palsuite/c_runtime/fread/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fread/test2/testinfo.dat
new file mode 100644
index 0000000000..a73c0ecf9e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fread/test2/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 = fread
+Name = Positive Test for fread
+TYPE = DEFAULT
+EXE1 = test2
+Description
+= Tests the PAL implementation of the fread function.
+= Open a file in READ mode, and then try to read all
+= the characters, more than all the characters,
+= 0 characters and 0 sized characters and check that
+= the strings read in are correct.
diff --git a/src/pal/tests/palsuite/c_runtime/fread/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fread/test3/CMakeLists.txt
new file mode 100644
index 0000000000..f3c636f3df
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fread/test3/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test3.c
+)
+
+add_executable(paltest_fread_test3
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fread_test3 coreclrpal)
+
+target_link_libraries(paltest_fread_test3
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fread/test3/test3.c b/src/pal/tests/palsuite/c_runtime/fread/test3/test3.c
new file mode 100644
index 0000000000..8c79bee582
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fread/test3/test3.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: test3.c
+**
+** Purpose: Tests the PAL implementation of the fread function.
+** Open a file in READ mode, then try to read from the file with
+** different 'size' params. Check to ensure the return values and
+** the text in the buffer is correct.
+**
+** Depends:
+** fopen
+** fseek
+** strcmp
+** memset
+**
+**
+**===================================================================*/
+
+/* Note: testfile should exist in the directory with 15 characters
+ in it ... something got lost if it isn't here.
+*/
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char **argv)
+{
+ const char filename[] = "testfile";
+ char buffer[128];
+ FILE * fp = NULL;
+ int result;
+
+ if (0 != PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ /* Open a file in READ mode */
+
+ if((fp = fopen(filename, "r")) == NULL)
+ {
+ Fail("Unable to open a file for reading. Is the file "
+ "in the directory? It should be.");
+ }
+
+ memset(buffer,'x',128);
+
+ /* Put the null one character past the end of the text that was read
+ in, to ensure that it wasn't reading in 0
+ */
+
+ buffer[16] = '\0';
+
+ /* Attempt to read in 5 bytes at a time. This should return 3 and
+ contain the full string in the buffer.
+ */
+
+ if((result = fread(buffer,5,3,fp)) != 3)
+ {
+ Fail("ERROR: Attempted to read in data of size 5. The file has "
+ "15 bytes in it so 3 items should have been read. But the value "
+ "returned was %d.",result);
+ }
+
+ if(strcmp(buffer, "This is a test.x") != 0)
+ {
+ Fail("ERROR: The buffer should have contained the text "
+ "'This is a test.x' but instead contained '%s'.",buffer);
+ }
+
+ memset(buffer,'x',128);
+
+ if(fseek(fp, 0, SEEK_SET))
+ {
+ Fail("ERROR: fseek failed, and this test depends on it.");
+ }
+
+ buffer[16] = '\0';
+
+ /* Attempt to read in 6 bytes at a time. The return should be 2. The
+ full string should still be in the buffer.
+ */
+
+ if((result = fread(buffer,6,3,fp)) != 2)
+ {
+ Fail("ERROR: Attempted to read in data of size 6. The file has "
+ "15 bytes in it, so 2 items should have been read. But the "
+ "value returned was %d.",result);
+ }
+
+ if(strcmp(buffer, "This is a test.x") != 0)
+ {
+ Fail("ERROR: The buffer should have contained the text "
+ "'This is a test.x' but instead contained '%s'.",buffer);
+ }
+
+ memset(buffer,'x',128);
+
+ buffer[7] = '\0';
+
+ if(fseek(fp, 0, SEEK_SET))
+ {
+ Fail("ERROR: fseek failed, and this test depends on it.");
+ }
+
+ /* Attempt to read in 6 bytes at a time but only one item max.
+ The return should be 1. The first 6 characters should be in the
+ buffer.
+ */
+
+ if((result = fread(buffer,6,1,fp)) != 1)
+ {
+ Fail("ERROR: Attempted to read in data of size 6 with a max count "
+ "of 1. Thus, one item should have been read, but the "
+ "value returned was %d.",result);
+ }
+
+ if(strcmp(buffer, "This ix") != 0)
+ {
+ Fail("ERROR: The buffer should have contained the text "
+ "'This ix.' but instead contained '%s'.",buffer);
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/fread/test3/testfile b/src/pal/tests/palsuite/c_runtime/fread/test3/testfile
new file mode 100644
index 0000000000..273c1a9ffd
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fread/test3/testfile
@@ -0,0 +1 @@
+This is a test. \ No newline at end of file
diff --git a/src/pal/tests/palsuite/c_runtime/fread/test3/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fread/test3/testinfo.dat
new file mode 100644
index 0000000000..95bc30ebcf
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fread/test3/testinfo.dat
@@ -0,0 +1,15 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = fread
+Name = Positive Test for fread
+TYPE = DEFAULT
+EXE1 = test3
+Description
+= Tests the PAL implementation of the fread function.
+= Open a file in READ mode, then try to read from the file with
+= different 'size' params. Check to ensure the return values and
+= the text in the buffer is correct
diff --git a/src/pal/tests/palsuite/c_runtime/free/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/free/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/free/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/free/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/free/test1/CMakeLists.txt
new file mode 100644
index 0000000000..bd94cb5733
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/free/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_free_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_free_test1 coreclrpal)
+
+target_link_libraries(paltest_free_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/free/test1/test1.c b/src/pal/tests/palsuite/c_runtime/free/test1/test1.c
new file mode 100644
index 0000000000..4ff8dfb094
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/free/test1/test1.c
@@ -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: Repeatedly allocates and frees a chunk of memory, to verify
+** that free is really returning memory to the heap
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char **argv)
+{
+
+ char *testA;
+
+ long i;
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ /* check that free really returns memory to the heap. */
+ for(i=1; i<1000000; i++)
+ {
+ testA = (char *)malloc(1000*sizeof(char));
+ if (testA==NULL)
+ {
+ Fail("Either free is failing to return memory to the heap, or"
+ " the system is running out of memory for some other "
+ "reason.\n");
+ }
+ free(testA);
+ }
+
+ free(NULL); /*should do nothing*/
+ PAL_Terminate();
+ return PASS;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/free/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/free/test1/testinfo.dat
new file mode 100644
index 0000000000..5bf400ce27
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/free/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 = free
+Name = Positive Test for free
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Repeatedly allocates and frees a chunk of memory, to verify that free
+= is really returning memory to the heap
+
diff --git a/src/pal/tests/palsuite/c_runtime/fseek/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fseek/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fseek/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/fseek/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fseek/test1/CMakeLists.txt
new file mode 100644
index 0000000000..fb55bd1051
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fseek/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_fseek_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fseek_test1 coreclrpal)
+
+target_link_libraries(paltest_fseek_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fseek/test1/test1.c b/src/pal/tests/palsuite/c_runtime/fseek/test1/test1.c
new file mode 100644
index 0000000000..8496289a01
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fseek/test1/test1.c
@@ -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(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/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fseek/test1/testinfo.dat
new file mode 100644
index 0000000000..788f8d4bea
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fseek/test1/testinfo.dat
@@ -0,0 +1,15 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = fseek
+Name = Positive Test for fseek
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Call seek 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.
diff --git a/src/pal/tests/palsuite/c_runtime/ftell/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/ftell/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/ftell/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/ftell/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/ftell/test1/CMakeLists.txt
new file mode 100644
index 0000000000..7ea9a51111
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/ftell/test1/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ ftell.c
+)
+
+add_executable(paltest_ftell_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_ftell_test1 coreclrpal)
+
+target_link_libraries(paltest_ftell_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/ftell/test1/ftell.c b/src/pal/tests/palsuite/c_runtime/ftell/test1/ftell.c
new file mode 100644
index 0000000000..66e0854847
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/ftell/test1/ftell.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: ftell.c (test 1)
+**
+** Purpose: Tests the PAL implementation of the ftell function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+FILE* pFile;
+struct TESTS
+{
+ long lDist;
+ int nFrom;
+ long lPosition;
+};
+
+
+/*************************************************
+**
+** Validate
+**
+** Purpose:
+** Tests whether the move was successful. If
+** it passes, it returns TRUE. If it fails
+** it outputs some error messages and returns
+** FALSE.
+**
+*************************************************/
+BOOL Validate(long lExpected)
+{
+ long lPos = -2;
+
+ if (((lPos = ftell(pFile)) == -1) || (lPos != lExpected))
+ {
+ Trace("ftell: ERROR -> ftell returned %ld when expecting %ld.\n",
+ lPos,
+ lExpected);
+ if (fclose(pFile) != 0)
+ {
+ Trace("ftell: ERROR -> fclose failed to close the file.\n");
+ }
+ return FALSE;
+ }
+ return TRUE;
+}
+
+
+/*************************************************
+**
+** MovePointer
+**
+** Purpose:
+** Accepts the distance to move and the
+** distance and calls fseek to move the file
+** pointer. If the fseek fails, error messages
+** are displayed and FALSE is returned. TRUE
+** is returned on a successful fseek.
+**
+*************************************************/
+BOOL MovePointer(long lDist, int nFrom)
+{
+ /* move the file pointer*/
+ if (fseek(pFile, lDist, nFrom) != 0)
+ {
+ Trace("ftell: ERROR -> fseek failed to move the file pointer "
+ "%l characters.\n",
+ lDist);
+ if (fclose(pFile) != 0)
+ {
+ Trace("ftell: ERROR -> fclose failed to close the file.\n");
+ }
+ return FALSE;
+ }
+ return TRUE;
+}
+
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ const char szFileName[] = {"testfile.txt"};
+ long lPos = -1;
+ int i;
+ char szTempBuffer[256];
+ struct TESTS testCase[] =
+ {
+ {0, SEEK_SET, 0},
+ {10, SEEK_CUR, 10},
+ {-5, SEEK_CUR, 5},
+ {-2, SEEK_END, 50}
+ };
+
+
+
+ if (0 != PAL_Initialize(argc,argv))
+ {
+ return FAIL;
+ }
+
+ memset(szTempBuffer, 0, 256);
+
+
+ /* open the test file */
+ pFile = fopen(szFileName, "r");
+ if (pFile == NULL)
+ {
+ Fail("ftell: ERROR -> fopen failed to open the file \"%s\".\n");
+ }
+
+ /* loop through the test cases */
+ for (i = 0; i < (sizeof(testCase)/sizeof(struct TESTS)); i++)
+ {
+ if (MovePointer(testCase[i].lDist, testCase[i].nFrom) != TRUE)
+ {
+ Fail("");
+ }
+ else if (Validate(testCase[i].lPosition) != TRUE)
+ {
+ Fail("");
+ }
+ }
+
+ if (fclose(pFile) != 0)
+ {
+ Fail("ftell: ERROR -> fclose failed to close the file.\n");
+ }
+
+ /* lets just see if we can find out where we are in a closed stream... */
+ if ((lPos = ftell(pFile)) != -1)
+ {
+ Fail("ftell: ERROR -> ftell returned a valid position (%ld) on a "
+ "closed file handle\n",
+ lPos);
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/ftell/test1/testfile.txt b/src/pal/tests/palsuite/c_runtime/ftell/test1/testfile.txt
new file mode 100644
index 0000000000..dd0fe15fe1
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/ftell/test1/testfile.txt
@@ -0,0 +1 @@
+The quick brown fox jumped over the lazy dog's back. \ No newline at end of file
diff --git a/src/pal/tests/palsuite/c_runtime/ftell/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/ftell/test1/testinfo.dat
new file mode 100644
index 0000000000..c17ec9ad99
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/ftell/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 = ftell
+Name = test for ftell (test 1)
+Type = DEFAULT
+EXE1 = ftell
+Description
+= Use fseek and a static list of distances to move, direction
+= to move and expected results to test the ftell function. A typical
+= test will move the file pointer with fseek then call ftell. The
+= results from ftell will then be compared to the expected result to
+= determine whether the test passed or failed.
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/CMakeLists.txt
new file mode 100644
index 0000000000..cafb9536b0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/CMakeLists.txt
@@ -0,0 +1,22 @@
+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/fwprintf/fwprintf.h b/src/pal/tests/palsuite/c_runtime/fwprintf/fwprintf.h
new file mode 100644
index 0000000000..36756636cf
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/fwprintf.h
@@ -0,0 +1,453 @@
+// Licensed to the .NET Foundation under one or more 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: fwprintf.h
+**
+** Purpose: Containts common testing functions for fwprintf
+**
+**
+**==========================================================================*/
+
+#ifndef __fwprintf_H__
+#define __fwprintf_H__
+
+void DoStrTest(WCHAR *formatstr, char* param, char *checkstr)
+{
+ FILE *fp;
+ char buf[256] = { 0 };
+
+ if ((fp = fopen("testfile.txt", "w+")) == NULL )
+ {
+ Fail("ERROR: fopen failed to create testfile\n");
+ }
+ if ((fwprintf(fp, formatstr, param)) < 0)
+ {
+ Fail("ERROR: fwprintf failed\n");
+ }
+ if ((fseek(fp, 0, SEEK_SET)) != 0)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+ if ((fgets(buf, 100, fp)) == NULL)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+
+ if (memcmp(buf, checkstr, strlen(checkstr) + 1) != 0)
+ {
+ Fail("ERROR: failed to insert string \"%\" into \"%S\"\n"
+ "Expected \"%s\" got \"%s\".\n",
+ param, formatstr, checkstr, buf);
+ }
+ fclose(fp);
+}
+
+void DoWStrTest(WCHAR *formatstr, WCHAR* param, char *checkstr)
+{
+ FILE *fp;
+ char buf[256] = { 0 };
+
+ if ((fp = fopen("testfile.txt", "w+")) == NULL )
+ {
+ Fail("ERROR: fopen failed to create testfile\n");
+ }
+ if ((fwprintf(fp, formatstr, param)) < 0)
+ {
+ Fail("ERROR: fwprintf failed\n");
+ }
+ if ((fseek(fp, 0, SEEK_SET)) != 0)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+ if ((fgets(buf, 100, fp)) == NULL)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+
+ 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);
+ }
+ fclose(fp);
+}
+
+
+void DoPointerTest(WCHAR *formatstr, void* param, char* paramstr,
+ char *checkstr1, char *checkstr2)
+{
+ FILE *fp;
+ char buf[256] = { 0 };
+
+ if ((fp = fopen("testfile.txt", "w+")) == NULL )
+ {
+ Fail("ERROR: fopen failed to create testfile\n");
+ }
+
+ if ((fwprintf(fp, formatstr, param)) < 0)
+ {
+ Fail("ERROR: fwprintf failed\n");
+ }
+
+ if ((fseek(fp, 0, SEEK_SET)) != 0)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+
+ if ((fgets(buf, 100, fp)) == NULL)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+
+ if (memcmp(buf, checkstr1, strlen(checkstr1) + 1) != 0 &&
+ memcmp(buf, checkstr2, strlen(checkstr2) + 1) != 0 )
+ {
+ Fail("ERROR: failed to insert %s into \"%s\"\n"
+ "Expected \"%s\" or \"%s\" got \"%s\".\n",
+ paramstr, formatstr, checkstr1, checkstr2, buf);
+ }
+
+ if ((fclose( fp )) != 0)
+ {
+ Fail("ERROR: fclose failed to close \"testfile.txt\"\n");
+ }
+}
+
+
+
+void DoCountTest(WCHAR *formatstr, int param, char *checkstr)
+{
+ FILE *fp;
+ char buf[512] = { 0 };
+ int n = -1;
+
+ if ((fp = fopen("testfile.txt", "w+")) == NULL )
+ {
+ Fail("ERROR: fopen failed to create testfile\n");
+ }
+
+ if ((fwprintf(fp, formatstr, &n)) < 0)
+ {
+ Fail("ERROR: fwprintf failed\n");
+ }
+
+ if ((fseek(fp, 0, SEEK_SET)) != 0)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+
+ if ((fgets(buf, sizeof(buf), fp)) == NULL)
+ {
+ Fail("ERROR: fseek failed\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);
+ }
+
+ if ((fclose( fp )) != 0)
+ {
+ Fail("ERROR: fclose failed to close \"testfile.txt\"\n");
+ }
+}
+
+void DoShortCountTest(WCHAR *formatstr, int param, char *checkstr)
+{
+ FILE *fp;
+ char buf[512] = { 0 };
+ short int n = -1;
+
+ if ((fp = fopen("testfile.txt", "w+")) == NULL )
+ {
+ Fail("ERROR: fopen failed to create testfile\n");
+ }
+
+ if ((fwprintf(fp, formatstr, &n)) < 0)
+ {
+ Fail("ERROR: fwprintf failed\n");
+ }
+
+ if ((fseek(fp, 0, SEEK_SET)) != 0)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+
+ if ((fgets(buf, 100, fp)) == NULL)
+ {
+ Fail("ERROR: fseek failed\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);
+ }
+
+ if ((fclose( fp )) != 0)
+ {
+ Fail("ERROR: fclose failed to close \"testfile.txt\"\n");
+ }
+}
+
+
+void DoCharTest(WCHAR *formatstr, char param, char *checkstr)
+{
+ FILE *fp;
+ char buf[256] = { 0 };
+
+ if ((fp = fopen("testfile.txt", "w+")) == NULL )
+ {
+ Fail("ERROR: fopen failed to create testfile\n");
+ }
+ if ((fwprintf(fp, formatstr, param)) < 0)
+ {
+ Fail("ERROR: fwprintf failed\n");
+ }
+ if ((fseek(fp, 0, SEEK_SET)) != 0)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+ if ((fgets(buf, 100, fp)) == NULL)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+
+ 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);
+ }
+ fclose(fp);
+}
+
+void DoWCharTest(WCHAR *formatstr, WCHAR param, char *checkstr)
+{
+ FILE *fp;
+ char buf[256] = { 0 };
+
+ if ((fp = fopen("testfile.txt", "w+")) == NULL )
+ {
+ Fail("ERROR: fopen failed to create testfile\n");
+ }
+ if ((fwprintf(fp, formatstr, param)) < 0)
+ {
+ Fail("ERROR: fwprintf failed\n");
+ }
+ if ((fseek(fp, 0, SEEK_SET)) != 0)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+ if ((fgets(buf, 100, fp)) == NULL)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+
+ 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);
+ }
+ fclose(fp);
+}
+
+void DoNumTest(WCHAR *formatstr, int value, char *checkstr)
+{
+ FILE *fp;
+ char buf[256] = { 0 };
+
+ if ((fp = fopen("testfile.txt", "w+")) == NULL )
+ {
+ Fail("ERROR: fopen failed to create testfile\n");
+ }
+ if ((fwprintf(fp, formatstr, value)) < 0)
+ {
+ Fail("ERROR: fwprintf failed\n");
+ }
+ if ((fseek(fp, 0, SEEK_SET)) != 0)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+ if ((fgets(buf, 100, fp)) == NULL)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+
+ 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);
+ }
+ fclose(fp);
+}
+
+void DoI64Test(WCHAR *formatstr, INT64 value, char *valuestr, char *checkstr1,
+ char *checkstr2)
+{
+ FILE *fp;
+ char buf[256] = { 0 };
+
+ if ((fp = fopen("testfile.txt", "w+")) == NULL )
+ {
+ Fail("ERROR: fopen failed to create testfile\n");
+ }
+ if ((fwprintf(fp, formatstr, value)) < 0)
+ {
+ Fail("ERROR: fwprintf failed\n");
+ }
+ if ((fseek(fp, 0, SEEK_SET)) != 0)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+ if ((fgets(buf, 100, fp)) == NULL)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+
+ if (memcmp(buf, checkstr1, strlen(checkstr1) + 1) != 0 &&
+ memcmp(buf, checkstr2, strlen(checkstr2) + 1) != 0)
+ {
+ Fail("ERROR: failed to insert %s into \"%S\"\n"
+ "Expected \"%s\" or \"%s\", got \"%s\".\n",
+ valuestr, formatstr, checkstr1, checkstr2, buf);
+ }
+ fclose(fp);
+}
+
+void DoDoubleTest(WCHAR *formatstr, double value, char *checkstr1,
+ char *checkstr2)
+{
+ FILE *fp;
+ char buf[256] = { 0 };
+
+ if ((fp = fopen("testfile.txt", "w+")) == NULL )
+ {
+ Fail("ERROR: fopen failed to create testfile\n");
+ }
+
+ if ((fwprintf(fp, formatstr, value)) < 0)
+ {
+ Fail("ERROR: fwprintf failed\n");
+ }
+ if ((fseek(fp, 0, SEEK_SET)) != 0)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+ if ((fgets(buf, 100, fp)) == NULL)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+
+ 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);
+ }
+ fclose(fp);
+}
+
+
+void DoArgumentPrecTest(WCHAR *formatstr, int precision, void *param,
+ char *paramstr, char *checkstr1, char *checkstr2)
+{
+ FILE *fp;
+ char buf[256];
+
+ if ((fp = fopen("testfile.txt", "w+")) == NULL )
+ {
+ Fail("ERROR: fopen failed to create testfile\n");
+ }
+
+ if ((fwprintf(fp, formatstr, precision, param)) < 0)
+ {
+ Fail("ERROR: fwprintf failed\n");
+ }
+
+ if ((fseek(fp, 0, SEEK_SET)) != 0)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+
+ if ((fgets(buf, 100, fp)) == NULL)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+
+ 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);
+ }
+
+
+ if ((fclose( fp )) != 0)
+ {
+ Fail("ERROR: fclose failed to close \"testfile.txt\"\n");
+ }
+
+}
+
+void DoArgumentPrecDoubleTest(WCHAR *formatstr, int precision, double param,
+ char *checkstr1, char *checkstr2)
+{
+ FILE *fp;
+ char buf[256];
+
+ if ((fp = fopen("testfile.txt", "w+")) == NULL )
+ {
+ Fail("ERROR: fopen failed to create testfile\n");
+ }
+
+ if ((fwprintf(fp, formatstr, precision, param)) < 0)
+ {
+ Fail("ERROR: fwprintf failed\n");
+ }
+
+ if ((fseek(fp, 0, SEEK_SET)) != 0)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+
+ if ((fgets(buf, 100, fp)) == NULL)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+
+ 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);
+ }
+
+ if ((fclose( fp )) != 0)
+ {
+ Fail("ERROR: fclose failed to close \"testfile.txt\"\n");
+ }
+
+}
+
+#endif
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test1/CMakeLists.txt
new file mode 100644
index 0000000000..ce4271edb2
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/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_fwprintf_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fwprintf_test1 coreclrpal)
+
+target_link_libraries(paltest_fwprintf_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test1/test1.c
new file mode 100644
index 0000000000..8a171db52a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test1/test1.c
@@ -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: A single, basic, test case with no formatting.
+** Test modeled after the sprintf series.
+**
+
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+/*
+ * Depends on memcmp, strlen, fopen, fgets, fseek and fclose.
+ */
+
+int __cdecl main(int argc, char *argv[])
+{
+ FILE *fp;
+ char testfile[] = "testfile.txt";
+
+ WCHAR *outstr;
+ char checkstr[] = "hello world";
+ char buf[256];
+
+ if (PAL_Initialize(argc, argv) != 0)
+ {
+ return(FAIL);
+ }
+
+ outstr = convert(checkstr);
+ if ((fp = fopen(testfile, "w+")) == NULL)
+ {
+ Fail("ERROR: fopen failed to create \"%s\"\n", testfile);
+ }
+
+ if ((fwprintf(fp, outstr)) < 0)
+ {
+ Fail("ERROR: fwprintf failed to print to \"%s\"\n", testfile);
+ }
+
+ if ((fseek( fp, 0, SEEK_SET)) != 0)
+ {
+ Fail("ERROR: Fseek failed to set pointer to beginning of file\n" );
+ }
+
+
+ if ((fgets( buf, 100, fp )) == NULL)
+ {
+ Fail("ERROR: fgets failed\n");
+ }
+
+ if (memcmp(checkstr, buf, strlen(checkstr)+1) != 0)
+ {
+ Fail("ERROR: expected %s, got %s\n", checkstr, buf);
+ }
+
+
+ if ((fclose( fp )) != 0)
+ {
+ Fail("ERROR: fclose failed to close \"%s\"\n", testfile);
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fwprintf/test1/testinfo.dat
new file mode 100644
index 0000000000..3bef5c6384
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/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 = fwprintf
+Name = Positive Test for fwprintf
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= A single, basic, test case with no formatting.
+= Test modeled after the sprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test10/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test10/CMakeLists.txt
new file mode 100644
index 0000000000..a8323b4fc7
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test10/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test10.c
+)
+
+add_executable(paltest_fwprintf_test10
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fwprintf_test10 coreclrpal)
+
+target_link_libraries(paltest_fwprintf_test10
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test10/test10.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test10/test10.c
new file mode 100644
index 0000000000..3aa2c45c7c
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test10/test10.c
@@ -0,0 +1,51 @@
+// Licensed to the .NET Foundation under one or more 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 the octal specifier (%o).
+** 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 neg = -42;
+ int pos = 42;
+ INT64 l = 42;
+
+ if (PAL_Initialize(argc, argv) != 0)
+ {
+ return(FAIL);
+ }
+
+ DoNumTest(convert("foo %o"), pos, "foo 52");
+ DoNumTest(convert("foo %lo"), 0xFFFF, "foo 177777");
+ DoNumTest(convert("foo %ho"), 0xFFFF, "foo 177777");
+ DoNumTest(convert("foo %Lo"), pos, "foo 52");
+ DoI64Test(convert("foo %I64o"), l, "42", "foo 52", "foo 52");
+ DoNumTest(convert("foo %3o"), pos, "foo 52");
+ DoNumTest(convert("foo %-3o"), pos, "foo 52 ");
+ DoNumTest(convert("foo %.1o"), pos, "foo 52");
+ DoNumTest(convert("foo %.3o"), pos, "foo 052");
+ DoNumTest(convert("foo %03o"), pos, "foo 052");
+ DoNumTest(convert("foo %#o"), pos, "foo 052");
+ DoNumTest(convert("foo %+o"), pos, "foo 52");
+ DoNumTest(convert("foo % o"), pos, "foo 52");
+ DoNumTest(convert("foo %+o"), neg, "foo 37777777726");
+ DoNumTest(convert("foo % o"), neg, "foo 37777777726");
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test10/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fwprintf/test10/testinfo.dat
new file mode 100644
index 0000000000..17902cb7fc
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test10/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 = fwprintf
+Name = Positive Test for fwprintf
+TYPE = DEFAULT
+EXE1 = test10
+Description
+= Tests the octal specifier (%o).
+= This test is modeled after the sprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test11/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test11/CMakeLists.txt
new file mode 100644
index 0000000000..1b7987400a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test11/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test11.c
+)
+
+add_executable(paltest_fwprintf_test11
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fwprintf_test11 coreclrpal)
+
+target_link_libraries(paltest_fwprintf_test11
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test11/test11.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test11/test11.c
new file mode 100644
index 0000000000..5867cd64fb
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test11/test11.c
@@ -0,0 +1,51 @@
+// Licensed to the .NET Foundation under one or more 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 the unsigned int specifier (%u).
+** 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 neg = -42;
+ int pos = 42;
+ INT64 l = 42;
+
+ if (PAL_Initialize(argc, argv) != 0)
+ {
+ return(FAIL);
+ }
+
+ DoNumTest(convert("foo %u"), pos, "foo 42");
+ DoNumTest(convert("foo %lu"), 0xFFFF, "foo 65535");
+ DoNumTest(convert("foo %hu"), 0xFFFF, "foo 65535");
+ DoNumTest(convert("foo %Lu"), pos, "foo 42");
+ DoI64Test(convert("foo %I64u"), l, "42", "foo 42", "foo 42");
+ DoNumTest(convert("foo %3u"), pos, "foo 42");
+ DoNumTest(convert("foo %-3u"), pos, "foo 42 ");
+ DoNumTest(convert("foo %.1u"), pos, "foo 42");
+ DoNumTest(convert("foo %.3u"), pos, "foo 042");
+ DoNumTest(convert("foo %03u"), pos, "foo 042");
+ DoNumTest(convert("foo %#u"), pos, "foo 42");
+ DoNumTest(convert("foo %+u"), pos, "foo 42");
+ DoNumTest(convert("foo % u"), pos, "foo 42");
+ DoNumTest(convert("foo %+u"), neg, "foo 4294967254");
+ DoNumTest(convert("foo % u"), neg, "foo 4294967254");
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test11/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fwprintf/test11/testinfo.dat
new file mode 100644
index 0000000000..beda0cc3ab
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test11/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 = fwprintf
+Name = Positive Test for fwprintf
+TYPE = DEFAULT
+EXE1 = test11
+Description
+= Test the unsigned int specifier (%u).
+= This test is modeled after the sprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test12/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test12/CMakeLists.txt
new file mode 100644
index 0000000000..1e43a4c906
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test12/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test12.c
+)
+
+add_executable(paltest_fwprintf_test12
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fwprintf_test12 coreclrpal)
+
+target_link_libraries(paltest_fwprintf_test12
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test12/test12.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test12/test12.c
new file mode 100644
index 0000000000..48a6123423
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test12/test12.c
@@ -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: test12.c
+**
+** Purpose: Tests the (lowercase) hexadecimal specifier (%x).
+** 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 neg = -42;
+ int pos = 0x1234ab;
+ INT64 l = I64(0x1234567887654321);
+
+ if (PAL_Initialize(argc, argv) != 0)
+ {
+ return(FAIL);
+ }
+
+ DoNumTest(convert("foo %x"), pos, "foo 1234ab");
+ DoNumTest(convert("foo %lx"), pos, "foo 1234ab");
+ DoNumTest(convert("foo %hx"), pos, "foo 34ab");
+ DoNumTest(convert("foo %Lx"), pos, "foo 1234ab");
+ DoI64Test(convert("foo %I64x"), l, "0x1234567887654321",
+ "foo 1234567887654321", "foo 0x1234567887654321");
+ DoNumTest(convert("foo %7x"), pos, "foo 1234ab");
+ DoNumTest(convert("foo %-7x"), pos, "foo 1234ab ");
+ DoNumTest(convert("foo %.1x"), pos, "foo 1234ab");
+ DoNumTest(convert("foo %.7x"), pos, "foo 01234ab");
+ DoNumTest(convert("foo %07x"), pos, "foo 01234ab");
+ DoNumTest(convert("foo %#x"), pos, "foo 0x1234ab");
+ DoNumTest(convert("foo %+x"), pos, "foo 1234ab");
+ DoNumTest(convert("foo % x"), pos, "foo 1234ab");
+ DoNumTest(convert("foo %+x"), neg, "foo ffffffd6");
+ DoNumTest(convert("foo % x"), neg, "foo ffffffd6");
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test12/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fwprintf/test12/testinfo.dat
new file mode 100644
index 0000000000..3d0bf4c8f8
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test12/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 = fwprintf
+Name = Positive Test for fwprintf
+TYPE = DEFAULT
+EXE1 = test12
+Description
+= Tests the (lowercase) hexadecimal specifier (%x).
+= This test is modeled after the sprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test13/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test13/CMakeLists.txt
new file mode 100644
index 0000000000..c84dc3ea41
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test13/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test13.c
+)
+
+add_executable(paltest_fwprintf_test13
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fwprintf_test13 coreclrpal)
+
+target_link_libraries(paltest_fwprintf_test13
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test13/test13.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test13/test13.c
new file mode 100644
index 0000000000..6eabec6c77
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test13/test13.c
@@ -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: test13.c
+**
+** Purpose: Tests the (uppercase) hexadecimal specifier (%X).
+** 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 neg = -42;
+ int pos = 0x1234AB;
+ INT64 l = I64(0x1234567887654321);
+
+ if (PAL_Initialize(argc, argv) != 0)
+ {
+ return(FAIL);
+ }
+
+ DoNumTest(convert("foo %X"), pos, "foo 1234AB");
+ DoNumTest(convert("foo %lX"), pos, "foo 1234AB");
+ DoNumTest(convert("foo %hX"), pos, "foo 34AB");
+ DoNumTest(convert("foo %LX"), pos, "foo 1234AB");
+ DoI64Test(convert("foo %I64X"), l, "0x1234567887654321",
+ "foo 1234567887654321", "foo 0x1234567887654321");
+ DoNumTest(convert("foo %7X"), pos, "foo 1234AB");
+ DoNumTest(convert("foo %-7X"), pos, "foo 1234AB ");
+ DoNumTest(convert("foo %.1X"), pos, "foo 1234AB");
+ DoNumTest(convert("foo %.7X"), pos, "foo 01234AB");
+ DoNumTest(convert("foo %07X"), pos, "foo 01234AB");
+ DoNumTest(convert("foo %#X"), pos, "foo 0X1234AB");
+ DoNumTest(convert("foo %+X"), pos, "foo 1234AB");
+ DoNumTest(convert("foo % X"), pos, "foo 1234AB");
+ DoNumTest(convert("foo %+X"), neg, "foo FFFFFFD6");
+ DoNumTest(convert("foo % X"), neg, "foo FFFFFFD6");
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test13/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fwprintf/test13/testinfo.dat
new file mode 100644
index 0000000000..c3222e7c9e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test13/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 = fwprintf
+Name = Positive Test for fwprintf
+TYPE = DEFAULT
+EXE1 = test13
+Description
+= Tests the (uppercase) hexadecimal specifier (%X).
+= This test is modeled after the sprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test14/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test14/CMakeLists.txt
new file mode 100644
index 0000000000..97824c76b7
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test14/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test14.c
+)
+
+add_executable(paltest_fwprintf_test14
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fwprintf_test14 coreclrpal)
+
+target_link_libraries(paltest_fwprintf_test14
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test14/test14.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test14/test14.c
new file mode 100644
index 0000000000..001cf72689
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test14/test14.c
@@ -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 the lowercase exponential
+** notation double specifier (%e).
+** 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[])
+{
+ double val = 256.0;
+ double neg = -256.0;
+
+ if (PAL_Initialize(argc, argv) != 0)
+ {
+ return(FAIL);
+ }
+
+ DoDoubleTest(convert("foo %e"), val, "foo 2.560000e+002",
+ "foo 2.560000e+02");
+ DoDoubleTest(convert("foo %le"), val, "foo 2.560000e+002",
+ "foo 2.560000e+02");
+ DoDoubleTest(convert("foo %he"), val, "foo 2.560000e+002",
+ "foo 2.560000e+02");
+ DoDoubleTest(convert("foo %Le"), val, "foo 2.560000e+002",
+ "foo 2.560000e+02");
+ DoDoubleTest(convert("foo %I64e"), val, "foo 2.560000e+002",
+ "foo 2.560000e+02");
+ DoDoubleTest(convert("foo %14e"), val, "foo 2.560000e+002",
+ "foo 2.560000e+02");
+ DoDoubleTest(convert("foo %-14e"), val, "foo 2.560000e+002 ",
+ "foo 2.560000e+02 ");
+ DoDoubleTest(convert("foo %.1e"), val, "foo 2.6e+002",
+ "foo 2.6e+02");
+ DoDoubleTest(convert("foo %.8e"), val, "foo 2.56000000e+002",
+ "foo 2.56000000e+02");
+ DoDoubleTest(convert("foo %014e"), val, "foo 02.560000e+002",
+ "foo 002.560000e+02");
+ DoDoubleTest(convert("foo %#e"), val, "foo 2.560000e+002",
+ "foo 2.560000e+02");
+ DoDoubleTest(convert("foo %+e"), val, "foo +2.560000e+002",
+ "foo +2.560000e+02");
+ DoDoubleTest(convert("foo % e"), val, "foo 2.560000e+002",
+ "foo 2.560000e+02");
+ DoDoubleTest(convert("foo %+e"), neg, "foo -2.560000e+002",
+ "foo -2.560000e+02");
+ DoDoubleTest(convert("foo % e"), neg, "foo -2.560000e+002",
+ "foo -2.560000e+02");
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test14/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fwprintf/test14/testinfo.dat
new file mode 100644
index 0000000000..a723f76083
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/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 = fwprintf
+Name = Positive Test for fwprintf
+TYPE = DEFAULT
+EXE1 = test14
+Description
+= Tests the lowercase exponential
+= notation double specifier (%e).
+= This test is modeled after the sprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test15/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test15/CMakeLists.txt
new file mode 100644
index 0000000000..6786c5b774
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test15/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test15.c
+)
+
+add_executable(paltest_fwprintf_test15
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fwprintf_test15 coreclrpal)
+
+target_link_libraries(paltest_fwprintf_test15
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test15/test15.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test15/test15.c
new file mode 100644
index 0000000000..9dfe82eccc
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test15/test15.c
@@ -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: test15.c
+**
+** Purpose: Tests the uppercase exponential
+** notation double specifier (%E).
+** 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[])
+{
+ double val = 256.0;
+ double neg = -256.0;
+
+ if (PAL_Initialize(argc, argv) != 0)
+ {
+ return(FAIL);
+ }
+
+ DoDoubleTest(convert("foo %E"), val, "foo 2.560000E+002",
+ "foo 2.560000E+02");
+ DoDoubleTest(convert("foo %lE"), val, "foo 2.560000E+002",
+ "foo 2.560000E+02");
+ DoDoubleTest(convert("foo %hE"), val, "foo 2.560000E+002",
+ "foo 2.560000E+02");
+ DoDoubleTest(convert("foo %LE"), val, "foo 2.560000E+002",
+ "foo 2.560000E+02");
+ DoDoubleTest(convert("foo %I64E"), val, "foo 2.560000E+002",
+ "foo 2.560000E+02");
+ DoDoubleTest(convert("foo %14E"), val, "foo 2.560000E+002",
+ "foo 2.560000E+02");
+ DoDoubleTest(convert("foo %-14E"), val, "foo 2.560000E+002 ",
+ "foo 2.560000E+02 ");
+ DoDoubleTest(convert("foo %.1E"), val, "foo 2.6E+002",
+ "foo 2.6E+02");
+ DoDoubleTest(convert("foo %.8E"), val, "foo 2.56000000E+002",
+ "foo 2.56000000E+02");
+ DoDoubleTest(convert("foo %014E"), val, "foo 02.560000E+002",
+ "foo 002.560000E+02");
+ DoDoubleTest(convert("foo %#E"), val, "foo 2.560000E+002",
+ "foo 2.560000E+02");
+ DoDoubleTest(convert("foo %+E"), val, "foo +2.560000E+002",
+ "foo +2.560000E+02");
+ DoDoubleTest(convert("foo % E"), val, "foo 2.560000E+002",
+ "foo 2.560000E+02");
+ DoDoubleTest(convert("foo %+E"), neg, "foo -2.560000E+002",
+ "foo -2.560000E+02");
+ DoDoubleTest(convert("foo % E"), neg, "foo -2.560000E+002",
+ "foo -2.560000E+02");
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test15/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fwprintf/test15/testinfo.dat
new file mode 100644
index 0000000000..246072f797
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/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 = fwprintf
+Name = Positive Test for fwprintf
+TYPE = DEFAULT
+EXE1 = test15
+Description
+= Tests the uppercase exponential
+= notation double specifier (%E).
+= This test is modeled after the sprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test16/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test16/CMakeLists.txt
new file mode 100644
index 0000000000..be14870863
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test16/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test16.c
+)
+
+add_executable(paltest_fwprintf_test16
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fwprintf_test16 coreclrpal)
+
+target_link_libraries(paltest_fwprintf_test16
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test16/test16.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test16/test16.c
new file mode 100644
index 0000000000..1969be1824
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test16/test16.c
@@ -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 the decimal notation double specifier (%f).
+** 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[])
+{
+ double val = 2560.001;
+ double neg = -2560.001;
+
+ if (PAL_Initialize(argc, argv) != 0)
+ {
+ return(FAIL);
+ }
+
+ DoDoubleTest(convert("foo %f"), val, "foo 2560.001000",
+ "foo 2560.001000");
+ DoDoubleTest(convert("foo %lf"), val, "foo 2560.001000",
+ "foo 2560.001000");
+ DoDoubleTest(convert("foo %hf"), val, "foo 2560.001000",
+ "foo 2560.001000");
+ DoDoubleTest(convert("foo %Lf"), val, "foo 2560.001000",
+ "foo 2560.001000");
+ DoDoubleTest(convert("foo %I64f"), val, "foo 2560.001000",
+ "foo 2560.001000");
+ DoDoubleTest(convert("foo %12f"), val, "foo 2560.001000",
+ "foo 2560.001000");
+ DoDoubleTest(convert("foo %-12f"), val, "foo 2560.001000 ",
+ "foo 2560.001000 ");
+ DoDoubleTest(convert("foo %.1f"), val, "foo 2560.0",
+ "foo 2560.0");
+ DoDoubleTest(convert("foo %.8f"), val, "foo 2560.00100000",
+ "foo 2560.00100000");
+ DoDoubleTest(convert("foo %012f"), val, "foo 02560.001000",
+ "foo 02560.001000");
+ DoDoubleTest(convert("foo %#f"), val, "foo 2560.001000",
+ "foo 2560.001000");
+ DoDoubleTest(convert("foo %+f"), val, "foo +2560.001000",
+ "foo +2560.001000");
+ DoDoubleTest(convert("foo % f"), val, "foo 2560.001000",
+ "foo 2560.001000");
+ DoDoubleTest(convert("foo %+f"), neg, "foo -2560.001000",
+ "foo -2560.001000");
+ DoDoubleTest(convert("foo % f"), neg, "foo -2560.001000",
+ "foo -2560.001000");
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test16/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fwprintf/test16/testinfo.dat
new file mode 100644
index 0000000000..9e5faf9baf
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test16/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 = fwprintf
+Name = Positive Test for fwprintf
+TYPE = DEFAULT
+EXE1 = test16
+Description
+= Tests the decimal notation double specifier (%f).
+= This test is modeled after the sprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test17/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test17/CMakeLists.txt
new file mode 100644
index 0000000000..b390d15620
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test17/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test17.c
+)
+
+add_executable(paltest_fwprintf_test17
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fwprintf_test17 coreclrpal)
+
+target_link_libraries(paltest_fwprintf_test17
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test17/test17.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test17/test17.c
new file mode 100644
index 0000000000..66b12716d0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test17/test17.c
@@ -0,0 +1,51 @@
+// Licensed to the .NET Foundation under one or more 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 the lowercase shorthand notation double specifier (%g).
+** 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[])
+{
+ double val = 2560.001;
+ double neg = -2560.001;
+
+ if (PAL_Initialize(argc, argv) != 0)
+ {
+ return(FAIL);
+ }
+
+ DoDoubleTest(convert("foo %g"), val, "foo 2560", "foo 2560");
+ DoDoubleTest(convert("foo %lg"), val, "foo 2560", "foo 2560");
+ DoDoubleTest(convert("foo %hg"), val, "foo 2560", "foo 2560");
+ DoDoubleTest(convert("foo %Lg"), val, "foo 2560", "foo 2560");
+ DoDoubleTest(convert("foo %I64g"), val, "foo 2560", "foo 2560");
+ DoDoubleTest(convert("foo %5g"), val, "foo 2560", "foo 2560");
+ DoDoubleTest(convert("foo %-5g"), val, "foo 2560 ", "foo 2560 ");
+ DoDoubleTest(convert("foo %.1g"), val, "foo 3e+003", "foo 3e+03");
+ DoDoubleTest(convert("foo %.2g"), val, "foo 2.6e+003", "foo 2.6e+03");
+ DoDoubleTest(convert("foo %.12g"), val, "foo 2560.001", "foo 2560.001");
+ DoDoubleTest(convert("foo %06g"), val, "foo 002560", "foo 002560");
+ DoDoubleTest(convert("foo %#g"), val, "foo 2560.00", "foo 2560.00");
+ DoDoubleTest(convert("foo %+g"), val, "foo +2560", "foo +2560");
+ DoDoubleTest(convert("foo % g"), val, "foo 2560", "foo 2560");
+ DoDoubleTest(convert("foo %+g"), neg, "foo -2560", "foo -2560");
+ DoDoubleTest(convert("foo % g"), neg, "foo -2560", "foo -2560");
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test17/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fwprintf/test17/testinfo.dat
new file mode 100644
index 0000000000..fe637d744c
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test17/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 = fwprintf
+Name = Positive Test for fwprintf
+TYPE = DEFAULT
+EXE1 = test17
+Description
+= Tests the lowercase shorthand notation double specifier (%g).
+= This test is modeled after the sprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test18/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test18/CMakeLists.txt
new file mode 100644
index 0000000000..6f6d79bce5
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test18/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test18.c
+)
+
+add_executable(paltest_fwprintf_test18
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fwprintf_test18 coreclrpal)
+
+target_link_libraries(paltest_fwprintf_test18
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test18/test18.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test18/test18.c
new file mode 100644
index 0000000000..a33dea39b3
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test18/test18.c
@@ -0,0 +1,51 @@
+// Licensed to the .NET Foundation under one or more 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 the uppercase shorthand notation double specifier (%G).
+** 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[])
+{
+ double val = 2560.001;
+ double neg = -2560.001;
+
+ if (PAL_Initialize(argc, argv) != 0)
+ {
+ return(FAIL);
+ }
+
+ DoDoubleTest(convert("foo %G"), val, "foo 2560", "foo 2560");
+ DoDoubleTest(convert("foo %lG"), val, "foo 2560", "foo 2560");
+ DoDoubleTest(convert("foo %hG"), val, "foo 2560", "foo 2560");
+ DoDoubleTest(convert("foo %LG"), val, "foo 2560", "foo 2560");
+ DoDoubleTest(convert("foo %I64G"), val, "foo 2560", "foo 2560");
+ DoDoubleTest(convert("foo %5G"), val, "foo 2560", "foo 2560");
+ DoDoubleTest(convert("foo %-5G"), val, "foo 2560 ", "foo 2560 ");
+ DoDoubleTest(convert("foo %.1G"), val, "foo 3E+003", "foo 3E+03");
+ DoDoubleTest(convert("foo %.2G"), val, "foo 2.6E+003", "foo 2.6E+03");
+ DoDoubleTest(convert("foo %.12G"), val, "foo 2560.001", "foo 2560.001");
+ DoDoubleTest(convert("foo %06G"), val, "foo 002560", "foo 002560");
+ DoDoubleTest(convert("foo %#G"), val, "foo 2560.00", "foo 2560.00");
+ DoDoubleTest(convert("foo %+G"), val, "foo +2560", "foo +2560");
+ DoDoubleTest(convert("foo % G"), val, "foo 2560", "foo 2560");
+ DoDoubleTest(convert("foo %+G"), neg, "foo -2560", "foo -2560");
+ DoDoubleTest(convert("foo % G"), neg, "foo -2560", "foo -2560");
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test18/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fwprintf/test18/testinfo.dat
new file mode 100644
index 0000000000..23f621733b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test18/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 = fwprintf
+Name = Positive Test for fwprintf
+TYPE = DEFAULT
+EXE1 = test18
+Description
+= Tests the uppercase shorthand notation double specifier (%G).
+= This test is modeled after the sprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test19/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test19/CMakeLists.txt
new file mode 100644
index 0000000000..bc10825ce1
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test19/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test19.c
+)
+
+add_executable(paltest_fwprintf_test19
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fwprintf_test19 coreclrpal)
+
+target_link_libraries(paltest_fwprintf_test19
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test19/test19.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test19/test19.c
new file mode 100644
index 0000000000..4600de7fa9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test19/test19.c
@@ -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, 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/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fwprintf/test19/testinfo.dat
new file mode 100644
index 0000000000..24aa8778c3
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test19/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 = fwprintf
+Name = Positive Test for fwprintf
+TYPE = DEFAULT
+EXE1 = test19
+Description
+= Tests the variable length precision argument.
+= This test is modeled after the sprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test2/CMakeLists.txt
new file mode 100644
index 0000000000..64314651c0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test2/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test2.c
+)
+
+add_executable(paltest_fwprintf_test2
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fwprintf_test2 coreclrpal)
+
+target_link_libraries(paltest_fwprintf_test2
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test2/test2.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test2/test2.c
new file mode 100644
index 0000000000..ecd3c513df
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test2/test2.c
@@ -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: test2.c
+**
+** Purpose: Tests the string specifier (%s).
+** 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[])
+{
+
+ if (PAL_Initialize(argc, argv) != 0)
+ {
+ return(FAIL);
+ }
+
+ DoWStrTest(convert("foo %s"), convert("bar"), "foo bar");
+ DoStrTest(convert("foo %hs"), "bar", "foo bar");
+ DoWStrTest(convert("foo %ls"), convert("bar"), "foo bar");
+ DoWStrTest(convert("foo %ws"), convert("bar"), "foo bar");
+ DoWStrTest(convert("foo %Ls"), convert("bar"), "foo bar");
+ DoWStrTest(convert("foo %I64s"), convert("bar"), "foo bar");
+ DoWStrTest(convert("foo %5s"), convert("bar"), "foo bar");
+ DoWStrTest(convert("foo %.2s"), convert("bar"), "foo ba");
+ DoWStrTest(convert("foo %5.2s"), convert("bar"), "foo ba");
+ DoWStrTest(convert("foo %-5s"), convert("bar"), "foo bar ");
+ DoWStrTest(convert("foo %05s"), convert("bar"), "foo 00bar");
+
+ PAL_Terminate();
+ return PASS;
+}
+
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fwprintf/test2/testinfo.dat
new file mode 100644
index 0000000000..1933682f24
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test2/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 = fwprintf
+Name = Positive Test for fwprintf
+TYPE = DEFAULT
+EXE1 = test2
+Description
+= Tests the string specifier (%s).
+= This test is modeled after the sprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test3/CMakeLists.txt
new file mode 100644
index 0000000000..6906722cde
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test3/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test3.c
+)
+
+add_executable(paltest_fwprintf_test3
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fwprintf_test3 coreclrpal)
+
+target_link_libraries(paltest_fwprintf_test3
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test3/test3.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test3/test3.c
new file mode 100644
index 0000000000..d718a19067
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test3/test3.c
@@ -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 the wide string specifier (%S).
+** 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[])
+{
+ if (PAL_Initialize(argc, argv) != 0)
+ {
+ return(FAIL);
+ }
+
+ DoStrTest(convert("foo %S"), "bar", "foo bar");
+ DoStrTest(convert("foo %hS"), "bar", "foo bar");
+ DoWStrTest(convert("foo %lS"), convert("bar"), "foo bar");
+ DoWStrTest(convert("foo %wS"), convert("bar"), "foo bar");
+ DoStrTest(convert("foo %LS"), "bar", "foo bar");
+ DoStrTest(convert("foo %I64S"), "bar", "foo bar");
+ DoStrTest(convert("foo %5S"), "bar", "foo bar");
+ DoStrTest(convert("foo %.2S"), "bar", "foo ba");
+ DoStrTest(convert("foo %5.2S"),"bar", "foo ba");
+ DoStrTest(convert("foo %-5S"), "bar", "foo bar ");
+ DoStrTest(convert("foo %05S"), "bar", "foo 00bar");
+
+ PAL_Terminate();
+ return PASS;
+}
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test3/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fwprintf/test3/testinfo.dat
new file mode 100644
index 0000000000..fa8a0bcf75
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test3/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 = fwprintf
+Name = Positive Test for fwprintf
+TYPE = DEFAULT
+EXE1 = test3
+Description
+= Tests the wide string specifier (%S).
+= This test is modeled after the sprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test4/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test4/CMakeLists.txt
new file mode 100644
index 0000000000..b91bc87195
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test4/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test4.c
+)
+
+add_executable(paltest_fwprintf_test4
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fwprintf_test4 coreclrpal)
+
+target_link_libraries(paltest_fwprintf_test4
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test4/test4.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test4/test4.c
new file mode 100644
index 0000000000..96fb472c3e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test4/test4.c
@@ -0,0 +1,85 @@
+// Licensed to the .NET Foundation under one or more 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 the pointer specifier (%p).
+** 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[])
+{
+ 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, "NULL", "0000000000000000", "0x0");
+ DoPointerTest(convert("%p"), ptr, "pointer to 0x123456", "0000000000123456",
+ "0x123456");
+ DoPointerTest(convert("%17p"), ptr, "pointer to 0x123456", " 0000000000123456",
+ " 0x123456");
+ DoPointerTest(convert("%17p"), ptr, "pointer to 0x123456", " 0000000000123456",
+ "0x0123456");
+ DoPointerTest(convert("%-17p"), ptr, "pointer to 0x123456", "0000000000123456 ",
+ "0x123456 ");
+ DoPointerTest(convert("%+p"), ptr, "pointer to 0x123456", "0000000000123456",
+ "0x123456");
+ DoPointerTest(convert("%#p"), ptr, "pointer to 0x123456", "0X0000000000123456",
+ "0x123456");
+ DoPointerTest(convert("%lp"), ptr, "pointer to 0x123456", "00123456",
+ "0x123456");
+ DoPointerTest(convert("%hp"), ptr, "pointer to 0x123456", "00003456",
+ "0x3456");
+ DoPointerTest(convert("%Lp"), ptr, "pointer to 0x123456", "00123456",
+ "0x123456");
+ DoI64Test(convert("%I64p"), lptr, "pointer to 0x1234567887654321",
+ "1234567887654321", "0x1234567887654321");
+#else
+ Trace("Testing for Non 64 Bit Platforms \n");
+ DoPointerTest(convert("%p"), NULL, "NULL", "00000000", "0x0");
+ DoPointerTest(convert("%p"), ptr, "pointer to 0x123456", "00123456",
+ "0x123456");
+ DoPointerTest(convert("%9p"), ptr, "pointer to 0x123456", " 00123456",
+ " 0x123456");
+ DoPointerTest(convert("%09p"), ptr, "pointer to 0x123456", " 00123456",
+ "0x0123456");
+ DoPointerTest(convert("%-9p"), ptr, "pointer to 0x123456", "00123456 ",
+ "0x123456 ");
+ DoPointerTest(convert("%+p"), ptr, "pointer to 0x123456", "00123456",
+ "0x123456");
+ DoPointerTest(convert("%#p"), ptr, "pointer to 0x123456", "0X00123456",
+ "0x123456");
+ DoPointerTest(convert("%lp"), ptr, "pointer to 0x123456", "00123456",
+ "0x123456");
+ DoPointerTest(convert("%hp"), ptr, "pointer to 0x123456", "00003456",
+ "0x3456");
+ DoPointerTest(convert("%Lp"), ptr, "pointer to 0x123456", "00123456",
+ "0x123456");
+ DoI64Test(convert("%I64p"), lptr, "pointer to 0x1234567887654321",
+ "1234567887654321", "0x1234567887654321");
+#endif
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test4/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fwprintf/test4/testinfo.dat
new file mode 100644
index 0000000000..92140c29bb
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test4/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 = fwprintf
+Name = Positive Test for fwprintf
+TYPE = DEFAULT
+EXE1 = test4
+Description
+= Tests the pointer specifier (%p).
+= This test is modeled after the sprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test5/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test5/CMakeLists.txt
new file mode 100644
index 0000000000..53bf482b6f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test5/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test5.c
+)
+
+add_executable(paltest_fwprintf_test5
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fwprintf_test5 coreclrpal)
+
+target_link_libraries(paltest_fwprintf_test5
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test5/test5.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test5/test5.c
new file mode 100644
index 0000000000..9d95989090
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test5/test5.c
@@ -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: test5.c
+**
+** Purpose: Tests the count specifier (%n).
+** 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[])
+{
+ WCHAR *longStr;
+ 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))
+ {
+ return FAIL;
+ }
+
+ longStr =
+ convert("really-long-string-that-just-keeps-going-on-and-on-and-on.."
+ "..................useless-filler.................................."
+ "..................useless-filler.................................."
+ "..................useless-filler.................................."
+ "%n bar");
+ DoCountTest(convert("foo %n bar"), 4, "foo bar");
+ DoCountTest(longStr, 257, longResult);
+ DoCountTest(convert("fo%n bar"), 2, "fo bar");
+ DoCountTest(convert("%n foo"), 0, " foo");
+ DoCountTest(convert("foo %#n bar"), 4, "foo bar");
+ DoCountTest(convert("foo % n bar"), 4, "foo bar");
+ DoCountTest(convert("foo %+n bar"), 4, "foo bar");
+ DoCountTest(convert("foo %-n bar"), 4, "foo bar");
+ DoCountTest(convert("foo %0n bar"), 4, "foo bar");
+ DoShortCountTest(convert("foo %hn bar"), 4, "foo bar");
+ DoCountTest(convert("foo %ln bar"), 4, "foo bar");
+ DoCountTest(convert("foo %Ln bar"), 4, "foo bar");
+ DoCountTest(convert("foo %I64n bar"), 4, "foo bar");
+ DoCountTest(convert("foo %20.3n bar"), 4, "foo bar");
+
+ PAL_Terminate();
+
+ free(longStr);
+
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test5/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fwprintf/test5/testinfo.dat
new file mode 100644
index 0000000000..152f56334b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test5/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 = fwprintf
+Name = Positive Test for fwprintf
+TYPE = DEFAULT
+EXE1 = test5
+Description
+= Tests the count specifier (%n).
+= This test is modeled after the sprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test6/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test6/CMakeLists.txt
new file mode 100644
index 0000000000..bf7d7cccb8
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test6/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test6.c
+)
+
+add_executable(paltest_fwprintf_test6
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fwprintf_test6 coreclrpal)
+
+target_link_libraries(paltest_fwprintf_test6
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test6/test6.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test6/test6.c
new file mode 100644
index 0000000000..160ff524e0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test6/test6.c
@@ -0,0 +1,48 @@
+// Licensed to the .NET Foundation under one or more 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 the char specifier (%c).
+** 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[])
+{
+ WCHAR wb = (WCHAR) 'b';
+
+ if (PAL_Initialize(argc, argv) != 0)
+ {
+ return(FAIL);
+ }
+
+ DoWCharTest(convert("foo %c"), wb, "foo b");
+ DoCharTest(convert("foo %hc"), 'c', "foo c");
+ DoWCharTest(convert("foo %lc"), wb, "foo b");
+ DoWCharTest(convert("foo %Lc"), wb, "foo b");
+ DoWCharTest(convert("foo %I64c"), wb, "foo b");
+ DoWCharTest(convert("foo %5c"), wb, "foo b");
+ DoWCharTest(convert("foo %.0c"), wb, "foo b");
+ DoWCharTest(convert("foo %-5c"), wb, "foo b ");
+ DoWCharTest(convert("foo %05c"), wb, "foo 0000b");
+ DoWCharTest(convert("foo % c"), wb, "foo b");
+ DoWCharTest(convert("foo %#c"), wb, "foo b");
+
+ PAL_Terminate();
+ return PASS;
+}
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test6/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fwprintf/test6/testinfo.dat
new file mode 100644
index 0000000000..cc968bdf7f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test6/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 = fwprintf
+Name = Positive Test for fwprintf
+TYPE = DEFAULT
+EXE1 = test6
+Description
+= Tests the char specifier (%c).
+= This test is modeled after the sprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test7/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test7/CMakeLists.txt
new file mode 100644
index 0000000000..68bcc9ca65
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test7/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test7.c
+)
+
+add_executable(paltest_fwprintf_test7
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fwprintf_test7 coreclrpal)
+
+target_link_libraries(paltest_fwprintf_test7
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test7/test7.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test7/test7.c
new file mode 100644
index 0000000000..c5515a8640
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test7/test7.c
@@ -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 the wide char specifier (%C).
+** 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[])
+{
+ WCHAR wb = (WCHAR) 'b';
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ DoCharTest(convert("foo %C"), 'c', "foo c");
+ DoWCharTest(convert("foo %hc"), wb, "foo b");
+ DoCharTest(convert("foo %lC"), 'c', "foo c");
+ DoCharTest(convert("foo %LC"), 'c', "foo c");
+ DoCharTest(convert("foo %I64C"), 'c', "foo c");
+ DoCharTest(convert("foo %5C"), 'c', "foo c");
+ DoCharTest(convert("foo %.0C"), 'c', "foo c");
+ DoCharTest(convert("foo %-5C"), 'c', "foo c ");
+ DoCharTest(convert("foo %05C"), 'c', "foo 0000c");
+ DoCharTest(convert("foo % C"), 'c', "foo c");
+ DoCharTest(convert("foo %#C"), 'c', "foo c");
+
+ PAL_Terminate();
+ return PASS;
+}
+
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test7/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fwprintf/test7/testinfo.dat
new file mode 100644
index 0000000000..46cb35cf4b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test7/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 = fwprintf
+Name = Positive Test for fwprintf
+TYPE = DEFAULT
+EXE1 = test7
+Description
+= Tests the wide char specifier (%C).
+= This test is modeled after the sprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test8/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test8/CMakeLists.txt
new file mode 100644
index 0000000000..e07cbb9119
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test8/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test8.c
+)
+
+add_executable(paltest_fwprintf_test8
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fwprintf_test8 coreclrpal)
+
+target_link_libraries(paltest_fwprintf_test8
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test8/test8.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test8/test8.c
new file mode 100644
index 0000000000..efc81a954a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test8/test8.c
@@ -0,0 +1,51 @@
+// Licensed to the .NET Foundation under one or more 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 the decimal specifier (%d).
+** 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 neg = -42;
+ int pos = 42;
+ INT64 l = 42;
+
+ if (PAL_Initialize(argc, argv) != 0)
+ {
+ return(FAIL);
+ }
+
+ DoNumTest(convert("foo %d"), pos, "foo 42");
+ DoNumTest(convert("foo %ld"), 0xFFFF, "foo 65535");
+ DoNumTest(convert("foo %hd"), 0xFFFF, "foo -1");
+ DoNumTest(convert("foo %Ld"), pos, "foo 42");
+ DoI64Test(convert("foo %I64d"), l, "42", "foo 42", "foo 42");
+ DoNumTest(convert("foo %3d"), pos, "foo 42");
+ DoNumTest(convert("foo %-3d"), pos, "foo 42 ");
+ DoNumTest(convert("foo %.1d"), pos, "foo 42");
+ DoNumTest(convert("foo %.3d"), pos, "foo 042");
+ DoNumTest(convert("foo %03d"), pos, "foo 042");
+ DoNumTest(convert("foo %#d"), pos, "foo 42");
+ DoNumTest(convert("foo %+d"), pos, "foo +42");
+ DoNumTest(convert("foo % d"), pos, "foo 42");
+ DoNumTest(convert("foo %+d"), neg, "foo -42");
+ DoNumTest(convert("foo % d"), neg, "foo -42");
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test8/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fwprintf/test8/testinfo.dat
new file mode 100644
index 0000000000..c8ce33acb9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test8/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 = fwprintf
+Name = Positive Test for fwprintf
+TYPE = DEFAULT
+EXE1 = test8
+Description
+= Tests the decimal specifier (%d).
+= This test is modeled after the sprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test9/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test9/CMakeLists.txt
new file mode 100644
index 0000000000..898da1a64f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test9/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test9.c
+)
+
+add_executable(paltest_fwprintf_test9
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fwprintf_test9 coreclrpal)
+
+target_link_libraries(paltest_fwprintf_test9
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test9/test9.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test9/test9.c
new file mode 100644
index 0000000000..23db2d8971
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test9/test9.c
@@ -0,0 +1,51 @@
+// Licensed to the .NET Foundation under one or more 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 the integer specifier (%i).
+** 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 neg = -42;
+ int pos = 42;
+ INT64 l = 42;
+
+ if (PAL_Initialize(argc, argv) != 0)
+ {
+ return(FAIL);
+ }
+
+ DoNumTest(convert("foo %i"), pos, "foo 42");
+ DoNumTest(convert("foo %li"), 0xFFFF, "foo 65535");
+ DoNumTest(convert("foo %hi"), 0xFFFF, "foo -1");
+ DoNumTest(convert("foo %Li"), pos, "foo 42");
+ DoI64Test(convert("foo %I64i"), l, "42", "foo 42", "foo 42");
+ DoNumTest(convert("foo %3i"), pos, "foo 42");
+ DoNumTest(convert("foo %-3i"), pos, "foo 42 ");
+ DoNumTest(convert("foo %.1i"), pos, "foo 42");
+ DoNumTest(convert("foo %.3i"), pos, "foo 042");
+ DoNumTest(convert("foo %03i"), pos, "foo 042");
+ DoNumTest(convert("foo %#i"), pos, "foo 42");
+ DoNumTest(convert("foo %+i"), pos, "foo +42");
+ DoNumTest(convert("foo % i"), pos, "foo 42");
+ DoNumTest(convert("foo %+i"), neg, "foo -42");
+ DoNumTest(convert("foo % i"), neg, "foo -42");
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test9/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fwprintf/test9/testinfo.dat
new file mode 100644
index 0000000000..5c2ec25ab5
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test9/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 = fwprintf
+Name = Positive Test for fwprintf
+TYPE = DEFAULT
+EXE1 = test9
+Description
+= Tests the integer specifier (%i).
+= This test is modeled after the sprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fwrite/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwrite/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwrite/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/fwrite/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwrite/test1/CMakeLists.txt
new file mode 100644
index 0000000000..701e56acb5
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwrite/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_fwrite_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fwrite_test1 coreclrpal)
+
+target_link_libraries(paltest_fwrite_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fwrite/test1/test1.c b/src/pal/tests/palsuite/c_runtime/fwrite/test1/test1.c
new file mode 100644
index 0000000000..392522879f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwrite/test1/test1.c
@@ -0,0 +1,104 @@
+// Licensed to the .NET Foundation under one or more 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: Write a short string to a file and check that it was written
+** properly.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char **argv)
+{
+ const char filename[] = "testfile.tmp";
+ const char outBuffer[] = "This is a test.";
+ char inBuffer[sizeof(outBuffer) + 10];
+ int itemsExpected;
+ int itemsWritten;
+ FILE * fp = NULL;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ if((fp = fopen(filename, "w")) == NULL)
+ {
+ Fail("Unable to open a file for write.\n");
+ }
+
+ itemsExpected = sizeof(outBuffer);
+ itemsWritten = fwrite(outBuffer,
+ sizeof(outBuffer[0]),
+ sizeof(outBuffer),
+ fp);
+
+ if (itemsWritten == 0)
+ {
+ if(fclose(fp) != 0)
+ {
+ Fail("fwrite: Error occurred during the closing of a file.\n");
+ }
+
+ Fail("fwrite() couldn't write to a stream at all\n");
+ }
+ else if (itemsWritten != itemsExpected)
+ {
+ if(fclose(fp) != 0)
+ {
+ Fail("fwrite: Error occurred during the closing of a file.\n");
+ }
+
+ Fail("fwrite() produced errors writing to a stream.\n");
+ }
+
+ if(fclose(fp) != 0)
+ {
+ Fail("fwrite: Error occurred during the closing of a file.\n");
+ }
+
+ /* open the file to verify what was written to the file */
+ if ((fp = fopen(filename, "r")) == NULL)
+ {
+ Fail("Couldn't open newly written file for read.\n");
+ }
+
+ if (fgets(inBuffer, sizeof(inBuffer), fp) == NULL)
+ {
+ if(fclose(fp) != 0)
+ {
+ Fail("fwrite: Error occurred during the closing of a file.\n");
+ }
+
+ Fail("We wrote something to a file using fwrite() and got errors"
+ " when we tried to read it back using fgets(). Either "
+ "fwrite() or fgets() is broken.\n");
+ }
+
+ if (strcmp(inBuffer, outBuffer) != 0)
+ {
+ if(fclose(fp) != 0)
+ {
+ Fail("fwrite: Error occurred during the closing of a file.\n");
+ }
+
+ Fail("fwrite() (or fgets()) is broken. The string read back from"
+ " the file does not match the string written.\n");
+ }
+
+ if(fclose(fp) != 0)
+ {
+ Fail("fwrite: Error occurred during the closing of a file.\n");
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/fwrite/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fwrite/test1/testinfo.dat
new file mode 100644
index 0000000000..75ad9ed05d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwrite/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 = fwrite
+Name = Positive Test for fwrite
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Write a short string to a file and check that it was written properly.
diff --git a/src/pal/tests/palsuite/c_runtime/getc/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/getc/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/getc/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/getc/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/getc/test1/CMakeLists.txt
new file mode 100644
index 0000000000..2a29e8af0a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/getc/test1/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ getc.c
+)
+
+add_executable(paltest_getc_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_getc_test1 coreclrpal)
+
+target_link_libraries(paltest_getc_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/getc/test1/getc.c b/src/pal/tests/palsuite/c_runtime/getc/test1/getc.c
new file mode 100644
index 0000000000..dfe10d6160
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/getc/test1/getc.c
@@ -0,0 +1,152 @@
+// Licensed to the .NET Foundation under one or more 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: getc.c (test 1)
+**
+** Purpose: Tests the PAL implementation of the getc function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ const char szFileName[] = {"testfile.tmp"};
+ const char szTestString[] =
+ {"The quick brown fox jumped over the lazy dog's back."};
+ FILE* pFile = NULL;
+ int nCount = 0;
+ int nChar = 0;
+ char szBuiltString[256];
+
+
+ if (0 != PAL_Initialize(argc,argv))
+ {
+ return FAIL;
+ }
+
+ memset(szBuiltString, 0, 256);
+
+
+ /* create/open a file for read and write */
+ pFile = fopen(szFileName, "w+");
+ if (pFile == NULL)
+ {
+ Fail("getc: ERROR -> fopen failed to create the file %s with the "
+ "error code %ld\n",
+ szFileName,
+ GetLastError());
+ }
+
+ /* try reading from an empty file */
+ if ((nChar = getc(pFile)) != EOF)
+ {
+ Trace("getc: ERROR -> getc returned \"%c\" when run on "
+ "an empty file.\n", nChar);
+ if (fclose(pFile) != 0)
+ {
+ Trace("getc: ERROR -> fclose failed to close the file. "
+ "GetLastError returned %ld\n",
+ GetLastError());
+ }
+ Fail("");
+ }
+
+ // Move the file pointer back to the beginning of the file. Some
+ // platforms require an fseek() between a getc() that returns EOF
+ // and any subsequent output to the file.
+ if (fseek(pFile, 0, SEEK_SET) != 0)
+ {
+ Trace("getc: ERROR -> fseek failed to move the file pointer to the "
+ "beginning of the file. GetLastError returned %ld\n",
+ GetLastError());
+ if (fclose(pFile) != 0)
+ {
+ Trace("getc: ERROR -> fclose failed to close the file. "
+ "GetLastError returned %ld\n",
+ GetLastError());
+ }
+ Fail("");
+ }
+
+ /* populate the file with a known string */
+ nCount = fprintf(pFile, szTestString);
+ if (nCount != strlen(szTestString))
+ {
+ Fail("getc: ERROR -> fprintf failed to write %s. The string is %d "
+ "characters long but fprintf apparently only wrote %d characters."
+ " GetLastError returned %ld\n",
+ szTestString,
+ strlen(szTestString),
+ nCount,
+ GetLastError());
+ }
+
+ /* move the file pointer back to the beginning of the file */
+ if (fseek(pFile, 0, SEEK_SET) != 0)
+ {
+ Trace("getc: ERROR -> fseek failed to move the file pointer to the "
+ "beginning of the file. GetLastError returned %ld\n",
+ GetLastError());
+ if (fclose(pFile) != 0)
+ {
+ Trace("getc: ERROR -> fclose failed to close the file. "
+ "GetLastError returned %ld\n",
+ GetLastError());
+ }
+ Fail("");
+ }
+
+ /* now get the characters one at a time */
+ nCount = 0;
+ while ((nChar = getc(pFile)) != EOF)
+ {
+ szBuiltString[nCount++] = nChar;
+ }
+
+ /* now, let's see if it worked */
+ if (strcmp(szBuiltString, szTestString) != 0)
+ {
+ Trace("getc: ERROR -> Reading one char at a time, getc built \"%s\" "
+ "however it should have built \"%s\".\n",
+ szBuiltString,
+ szTestString);
+ if (fclose(pFile) != 0)
+ {
+ Trace("getc: ERROR -> fclose failed to close the file. "
+ "GetLastError returned %ld\n",
+ GetLastError());
+ }
+ Fail("");
+ }
+
+ /* with the file pointer at EOF, try reading past EOF*/
+ if ((nChar = getc(pFile)) != EOF)
+ {
+ Trace("getc: ERROR -> getc returned \"%c\" when reading past "
+ "the end of the file.\n", nChar);
+ if (fclose(pFile) != 0)
+ {
+ Trace("getc: ERROR -> fclose failed to close the file. "
+ "GetLastError returned %ld\n",
+ GetLastError());
+ }
+ Fail("");
+ }
+
+ if (fclose(pFile) != 0)
+ {
+ Fail("getc: ERROR -> fclose failed to close the file. "
+ "GetLastError returned %ld\n",
+ GetLastError());
+ }
+
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/getc/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/getc/test1/testinfo.dat
new file mode 100644
index 0000000000..19a0c1ee1a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/getc/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 = file_io
+Function = getc
+Name = test for getc (test 1)
+Type = DEFAULT
+EXE1 = getc
+Description
+= Write a string to a file, read it in one character
+= at a time with getc and compare with the original string.
+= It also verifies that getc can't read past EOF.
diff --git a/src/pal/tests/palsuite/c_runtime/getenv/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/getenv/CMakeLists.txt
new file mode 100644
index 0000000000..1962ade358
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/getenv/CMakeLists.txt
@@ -0,0 +1,6 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+add_subdirectory(test2)
+add_subdirectory(test3)
+
diff --git a/src/pal/tests/palsuite/c_runtime/getenv/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/getenv/test1/CMakeLists.txt
new file mode 100644
index 0000000000..6243c032ab
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/getenv/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_getenv_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_getenv_test1 coreclrpal)
+
+target_link_libraries(paltest_getenv_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/getenv/test1/test1.c b/src/pal/tests/palsuite/c_runtime/getenv/test1/test1.c
new file mode 100644
index 0000000000..0fb9025c8f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/getenv/test1/test1.c
@@ -0,0 +1,78 @@
+// Licensed to the .NET Foundation under one or more 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: Create an environment variable and then use getenv to get
+** a pointer to it. Check that the pointer is valid and that the string
+** is what we expected. Also check that searching for a non-existent
+** variable will cause getenv to return NULL. Also check that function
+** passes when the parameter has it's casing changed (e.g upper case)
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char **argv)
+{
+
+ const char* SetVariable = "PalTestingEnvironmentVariable=The value";
+ const char* VariableName = "PalTestingEnvironmentVariable";
+ const char* VariableValue = "The value";
+ char* result;
+
+
+ if (0 != (PAL_Initialize(argc, argv)))
+ {
+ return FAIL;
+ }
+
+ /* Use _putenv to set an environment variable. This ensures that the
+ variable we're testing on is always present.
+ */
+
+ if(_putenv(SetVariable) == -1)
+ {
+ Fail("ERROR: _putenv failed to set an environment variable that "
+ "getenv will be using for testing.\n");
+ }
+
+ /* Call getenv -- ensure it doesn't return NULL and the string it returns
+ is the value we set above.
+ */
+
+ result = getenv(VariableName);
+ if(result == NULL)
+ {
+ Fail("ERROR: The result of getenv on a valid Environment Variable "
+ "was NULL, which indicates the environment varaible was not "
+ "found.\n");
+ }
+
+ if(strcmp(result, VariableValue) != 0)
+ {
+ Fail("ERROR: The value obtained by getenv() was not equal to the "
+ "correct value of the environment variable. The correct "
+ "value is '%s' and the function returned '%s'.\n",
+ VariableValue,
+ result);
+ }
+
+ /* Try calling getenv on an environment variable which doesn't
+ exist.
+ */
+ result = getenv("SomeEnvironmentVariableThatReallyDoesNotExist");
+
+ if(result != NULL)
+ {
+ Fail("ERROR: Called getenv on an environment variable which "
+ "doesn't exist and it returned '%s' instead of NULL.\n",result);
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/getenv/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/getenv/test1/testinfo.dat
new file mode 100644
index 0000000000..b9cbf71986
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/getenv/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 = getenv
+Name = Test retrieval of variables correctly, and failure if they don't exist
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Create an environment variable and then use getenv to get
+= a pointer to it. Check that the pointer is valid and that the string
+= is what we expected. Also check that searching for a non-existent
+= variable will cause getenv to return NULL. Also check that changing
+= the case (upper or lower) of a variable does not effect functionality.
diff --git a/src/pal/tests/palsuite/c_runtime/getenv/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/getenv/test2/CMakeLists.txt
new file mode 100644
index 0000000000..7a301a5ca6
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/getenv/test2/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test2.c
+)
+
+add_executable(paltest_getenv_test2
+ ${SOURCES}
+)
+
+add_dependencies(paltest_getenv_test2 coreclrpal)
+
+target_link_libraries(paltest_getenv_test2
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/getenv/test2/test2.c b/src/pal/tests/palsuite/c_runtime/getenv/test2/test2.c
new file mode 100644
index 0000000000..26f245fcce
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/getenv/test2/test2.c
@@ -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: test2.c
+**
+** Purpose: Create environment variables that differ only in Case, and
+** verify that the BSD operating system treats the variables
+** differently.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char **argv)
+{
+#if WIN32
+
+ return PASS;
+
+#else
+
+ const char* FirstVariable = "PalTestingEnvironmentVariable=The value";
+ const char* SecondVariable = "PALTESTINGEnvironmentVariable=Different value";
+ const char* FirstVarName = "PalTestingEnvironmentVariable";
+ const char* SecondVarName = "PALTESTINGEnvironmentVariable";
+ const char* FirstVarValue = "The value";
+ const char* SecondVarValue = "Different value";
+ char* result;
+
+
+ if (0 != (PAL_Initialize(argc, argv)))
+ {
+ return FAIL;
+ }
+
+ /* Use _putenv to set the environment variables. This ensures that the
+ variables we're testing with are always present.
+ */
+ if(_putenv(FirstVariable) != 0)
+ {
+ Fail("ERROR: _putenv failed to set an environment variable that "
+ "getenv will be using for testing.\n");
+ }
+
+ if(_putenv(SecondVariable) != 0)
+ {
+ Fail("ERROR: _putenv failed to set an environment variable that "
+ "getenv will be using for testing.\n");
+ }
+
+
+ /* Call getenv -- ensure it doesn't return NULL and the string it returns
+ is the value we set above. Also make sure that each environment variable,
+ differing only by case, returns it's own value.
+ */
+
+ result = getenv(FirstVarName);
+ if(result == NULL)
+ {
+ Fail("ERROR: The result of getenv on a valid Environment Variable "
+ "was NULL, which indicates the environment varaible was not "
+ "found.\n");
+ }
+
+ if(strcmp(result, FirstVarValue) != 0)
+ {
+ Fail("ERROR: The value obtained by getenv() was not equal to the "
+ "correct value of the environment variable. The correct "
+ "value is '%s' and the function returned '%s'.\n",
+ FirstVarValue,
+ result);
+ }
+
+
+ result = getenv(SecondVarName);
+ if(result == NULL)
+ {
+ Fail("ERROR: The result of getenv on a valid Environment Variable "
+ "was NULL, which indicates the environment varaible was not "
+ "found.\n");
+ }
+
+ if(strcmp(result, SecondVarValue) != 0)
+ {
+ Fail("ERROR: The value obtained by getenv() was not equal to the "
+ "correct value of the environment variable. The correct "
+ "value is '%s' and the function returned '%s'.\n",
+ SecondVarValue,
+ result);
+ }
+
+
+ PAL_Terminate();
+ return PASS;
+
+#endif
+}
diff --git a/src/pal/tests/palsuite/c_runtime/getenv/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/getenv/test2/testinfo.dat
new file mode 100644
index 0000000000..90a4ac5aff
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/getenv/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 = getenv
+Name = Test retrieval of variables differing only by case.
+TYPE = DEFAULT
+EXE1 = test2
+Description
+= Check that environment variables differing only by their
+= case are interpreted as separate variables by the BSD Operationg
+= System.
diff --git a/src/pal/tests/palsuite/c_runtime/getenv/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/getenv/test3/CMakeLists.txt
new file mode 100644
index 0000000000..2cbe472221
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/getenv/test3/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test3.c
+)
+
+add_executable(paltest_getenv_test3
+ ${SOURCES}
+)
+
+add_dependencies(paltest_getenv_test3 coreclrpal)
+
+target_link_libraries(paltest_getenv_test3
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/getenv/test3/test3.c b/src/pal/tests/palsuite/c_runtime/getenv/test3/test3.c
new file mode 100644
index 0000000000..1eefd9d40c
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/getenv/test3/test3.c
@@ -0,0 +1,75 @@
+// Licensed to the .NET Foundation under one or more 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: Create an environment variable and try to retrieve
+** it using the same name but with different case. This
+** is to show that the Win32 representation of getenv
+** is case insensitive.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char **argv)
+{
+#if WIN32
+
+ const char* FirstVariable = "PalTestingEnvironmentVariable=The value";
+ const char* ModifiedName = "PALTESTINGEnvironmentVariable";
+ const char* FirstVarValue = "The value";
+ char* result;
+
+
+ if (0 != (PAL_Initialize(argc, argv)))
+ {
+ return FAIL;
+ }
+
+ /* Use _putenv to set an environment variable. This ensures that the
+ variable we're testing on is always present.
+ */
+
+ if(_putenv(FirstVariable) != 0)
+ {
+ Fail("ERROR: _putenv failed to set an environment variable that "
+ "getenv will be using for testing.\n");
+ }
+
+
+ /* Call getenv -- ensure it doesn't return NULL and the string it returns
+ is the value we set above. Also make sure that each environment variable,
+ differing only by case, doesn't affect the return value.
+ */
+
+ result = getenv(ModifiedName);
+ if(result == NULL)
+ {
+ Fail("ERROR: The result of getenv on a valid Environment Variable "
+ "was NULL, which indicates the environment varaible was not "
+ "found.\n");
+ }
+
+ if(strcmp(result, FirstVarValue) != 0)
+ {
+ Fail("ERROR: The value obtained by getenv() was not equal to the "
+ "correct value of the environment variable. The correct "
+ "value is '%s' and the function returned '%s'.\n",
+ FirstVarValue,
+ result);
+ }
+
+
+ PAL_Terminate();
+ return PASS;
+
+#else
+ return PASS;
+
+#endif
+}
diff --git a/src/pal/tests/palsuite/c_runtime/getenv/test3/testinfo.dat b/src/pal/tests/palsuite/c_runtime/getenv/test3/testinfo.dat
new file mode 100644
index 0000000000..6e12fc4385
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/getenv/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 = getenv
+Name = Test retrieval of variables differing only by case.
+TYPE = DEFAULT
+EXE1 = test3
+Description
+= Check that environment variables differing only by their
+= case are interpreted as the same variables in the WIN32
+= platform.
diff --git a/src/pal/tests/palsuite/c_runtime/isalnum/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/isalnum/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/isalnum/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/isalnum/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/isalnum/test1/CMakeLists.txt
new file mode 100644
index 0000000000..3879bb7902
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/isalnum/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_isalnum_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_isalnum_test1 coreclrpal)
+
+target_link_libraries(paltest_isalnum_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/isalnum/test1/test1.c b/src/pal/tests/palsuite/c_runtime/isalnum/test1/test1.c
new file mode 100644
index 0000000000..d9cdfcadf6
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/isalnum/test1/test1.c
@@ -0,0 +1,88 @@
+// Licensed to the .NET Foundation under one or more 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 isalnum function
+** Check that a number of characters return the correct
+** values for whether they are alpha/numeric or not.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+
+struct testCase
+{
+ int CorrectResult;
+ int character;
+};
+
+int __cdecl main(int argc, char **argv)
+{
+
+ int result;
+ int i;
+
+ struct testCase testCases[] =
+ {
+ {1, 'a'},
+ {1, 'z'},
+ {1, 'B'},
+ {1, '5'},
+ {1, '0'},
+ {0, '?'},
+ {0, 230}
+ };
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ /* Loop through each case. Check to see if each is alpha/numeric or
+ not.
+ */
+
+ for(i = 0; i < sizeof(testCases) / sizeof(struct testCase); i++)
+ {
+
+ result = isalnum(testCases[i].character);
+
+ /* The return value is 'non-zero' for success. This if condition
+ * will still work if that non-zero isn't just 1
+ */
+ if ( ((testCases[i].CorrectResult == 1) && (result == 0)) ||
+ ( (testCases[i].CorrectResult == 0) && (result != 0) ))
+ {
+ Fail("ERROR: isalnum returned %i instead of %i for character "
+ " %c.\n",
+ result,
+ testCases[i].CorrectResult,
+ testCases[i].character);
+ }
+
+ }
+
+
+ PAL_Terminate();
+ return PASS;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/isalnum/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/isalnum/test1/testinfo.dat
new file mode 100644
index 0000000000..ba8f07a722
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/isalnum/test1/testinfo.dat
@@ -0,0 +1,19 @@
+# Licensed to the .NET Foundation under one or more 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 = isalnum
+Name = Positive Test for isalnum
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Tests the PAL implementation of the isalnum function
+= Check that a number of characters return the correct values for whether
+= they are alpha/numeric or not.
+
+
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/isalpha/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/isalpha/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/isalpha/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/isalpha/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/isalpha/test1/CMakeLists.txt
new file mode 100644
index 0000000000..44fb72d7fe
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/isalpha/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_isalpha_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_isalpha_test1 coreclrpal)
+
+target_link_libraries(paltest_isalpha_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/isalpha/test1/test1.c b/src/pal/tests/palsuite/c_runtime/isalpha/test1/test1.c
new file mode 100644
index 0000000000..b494d14a92
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/isalpha/test1/test1.c
@@ -0,0 +1,86 @@
+// Licensed to the .NET Foundation under one or more 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 isalpha function
+** Check that a number of characters return the correct
+** values for whether they are alpha or not.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+struct testCase
+{
+ int CorrectResult;
+ int character;
+};
+
+int __cdecl main(int argc, char **argv)
+{
+
+ int result;
+ int i;
+
+ struct testCase testCases[] =
+ {
+ {1, 'a'},
+ {1, 'z'},
+ {1, 'B'},
+ {0, '5'},
+ {0, '?'},
+ {0, 230}
+ };
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ /* Loop through each case. Check to see if each is alpha or
+ not.
+ */
+
+ for(i = 0; i < sizeof(testCases) / sizeof(struct testCase); i++)
+ {
+
+ result = isalpha(testCases[i].character);
+
+ /* The return value is 'non-zero' for success. This if condition
+ * will still work if that non-zero isn't just 1
+ */
+ if ( ((testCases[i].CorrectResult == 1) && (result == 0)) ||
+ ( (testCases[i].CorrectResult == 0) && (result != 0) ))
+ {
+ Fail("ERROR: isalpha returned %i instead of %i for character "
+ "%c.\n",
+ result,
+ testCases[i].CorrectResult,
+ testCases[i].character);
+ }
+
+ }
+
+
+ PAL_Terminate();
+ return PASS;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/isalpha/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/isalpha/test1/testinfo.dat
new file mode 100644
index 0000000000..7d508366e8
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/isalpha/test1/testinfo.dat
@@ -0,0 +1,19 @@
+# Licensed to the .NET Foundation under one or more 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 = isalpha
+Name = Positive Test for isalpha
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Tests the PAL implementation of the isalpha function
+= Check that a number of characters return the correct values for whether
+= they are alpha or not.
+
+
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/isdigit/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/isdigit/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/isdigit/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/isdigit/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/isdigit/test1/CMakeLists.txt
new file mode 100644
index 0000000000..dd03b238e1
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/isdigit/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_isdigit_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_isdigit_test1 coreclrpal)
+
+target_link_libraries(paltest_isdigit_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/isdigit/test1/test1.c b/src/pal/tests/palsuite/c_runtime/isdigit/test1/test1.c
new file mode 100644
index 0000000000..ad2344827f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/isdigit/test1/test1.c
@@ -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: Checks every character against the known range of digits.
+**
+**
+**==========================================================================*/
+
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char *argv[])
+{
+ int i;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ for (i=0; i<256; i++)
+ {
+ if (isdigit(i))
+ {
+ if (i < '0' || i > '9')
+ {
+ Fail("ERROR: isdigit returned true for '%c' (%d)!\n", i, i);
+ }
+ }
+ else
+ {
+ if (i >= '0' && i <= '9')
+ {
+ Fail("ERROR: isdigit returned false for '%c' (%d)!\n", i, i);
+ }
+ }
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/isdigit/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/isdigit/test1/testinfo.dat
new file mode 100644
index 0000000000..eb23739164
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/isdigit/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 = isdigit
+Name = Test #1 for isdigit
+TYPE = DEFAULT
+EXE1 = test1
+Description
+=Checks every character against the known range of digits.
diff --git a/src/pal/tests/palsuite/c_runtime/islower/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/islower/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/islower/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/islower/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/islower/test1/CMakeLists.txt
new file mode 100644
index 0000000000..b7f5ad069f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/islower/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_islower_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_islower_test1 coreclrpal)
+
+target_link_libraries(paltest_islower_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/islower/test1/test1.c b/src/pal/tests/palsuite/c_runtime/islower/test1/test1.c
new file mode 100644
index 0000000000..c8e877b705
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/islower/test1/test1.c
@@ -0,0 +1,85 @@
+// Licensed to the .NET Foundation under one or more 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 islower function
+** Check that a number of characters return the correct
+** values for whether they are lower case or not.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+struct testCase
+{
+ int CorrectResult;
+ int character;
+};
+
+int __cdecl main(int argc, char **argv)
+{
+
+ int result;
+ int i;
+
+ struct testCase testCases[] =
+ {
+ {1, 'a'}, /* Basic cases */
+ {1, 'z'},
+ {0, 'B'}, /* Lower case */
+ {0, '?'}, /* Characters without case */
+ {0, 230},
+ {0, '5'}
+ };
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ /* Loop through each case. Check to see if each is lower case or
+ not.
+ */
+
+ for(i = 0; i < sizeof(testCases) / sizeof(struct testCase); i++)
+ {
+
+ result = islower(testCases[i].character);
+
+ /* The return value is 'non-zero' for success. This if condition
+ * will still work if that non-zero isn't just 1
+ */
+ if ( ((testCases[i].CorrectResult == 1) && (result == 0)) ||
+ ( (testCases[i].CorrectResult == 0) && (result != 0) ))
+ {
+ Fail("ERROR: islower returned %i instead of %i for "
+ "character %c.\n",
+ result, testCases[i].CorrectResult,
+ testCases[i].character);
+ }
+
+ }
+
+
+ PAL_Terminate();
+ return PASS;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/islower/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/islower/test1/testinfo.dat
new file mode 100644
index 0000000000..49a6fb761d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/islower/test1/testinfo.dat
@@ -0,0 +1,19 @@
+# Licensed to the .NET Foundation under one or more 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 = islower
+Name = Positive Test for islower
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Tests the PAL implementation of the islower function
+= Check that a number of characters return the correct values for whether
+= they are lower case or not.
+
+
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/isprint/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/isprint/CMakeLists.txt
new file mode 100644
index 0000000000..ef14ea5352
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/isprint/CMakeLists.txt
@@ -0,0 +1,5 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+add_subdirectory(test2)
+
diff --git a/src/pal/tests/palsuite/c_runtime/isprint/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/isprint/test1/CMakeLists.txt
new file mode 100644
index 0000000000..365777ab5a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/isprint/test1/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ isprint.c
+)
+
+add_executable(paltest_isprint_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_isprint_test1 coreclrpal)
+
+target_link_libraries(paltest_isprint_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/isprint/test1/isprint.c b/src/pal/tests/palsuite/c_runtime/isprint/test1/isprint.c
new file mode 100644
index 0000000000..54db666bf2
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/isprint/test1/isprint.c
@@ -0,0 +1,42 @@
+// Licensed to the .NET Foundation under one or more 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: isprint.c
+**
+** Purpose: Positive test the isprint API.
+** Call isprint to test if a character is printable
+**
+**
+**============================================================*/
+#include <palsuite.h>
+
+int __cdecl main(int argc, char *argv[])
+{
+ int err;
+ int index;
+
+ /*Initialize the PAL environment*/
+ err = PAL_Initialize(argc, argv);
+ if(0 != err)
+ {
+ return FAIL;
+ }
+
+ /*check if the character is printable*/
+ for(index = 0x20; index<=0x7E;index++)
+ {
+ err = isprint(index);
+ if(0 == err)
+ {
+ Fail("\nFailed to call isprint API to check "
+ "printable character from 0x20 to 0x7E!\n");
+ }
+ }
+
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/isprint/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/isprint/test1/testinfo.dat
new file mode 100644
index 0000000000..c9b9ec07ea
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/isprint/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 = miscellaneous
+Function = isprint
+Name = Positive test for isprint API to check if a character is printable
+TYPE = DEFAULT
+EXE1 = isprint
+Description
+=Test the isprint to check if a character is printable
diff --git a/src/pal/tests/palsuite/c_runtime/isprint/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/isprint/test2/CMakeLists.txt
new file mode 100644
index 0000000000..a7ad75cc04
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/isprint/test2/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test2.c
+)
+
+add_executable(paltest_isprint_test2
+ ${SOURCES}
+)
+
+add_dependencies(paltest_isprint_test2 coreclrpal)
+
+target_link_libraries(paltest_isprint_test2
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/isprint/test2/test2.c b/src/pal/tests/palsuite/c_runtime/isprint/test2/test2.c
new file mode 100644
index 0000000000..2170c47a14
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/isprint/test2/test2.c
@@ -0,0 +1,59 @@
+// Licensed to the .NET Foundation under one or more 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: isprint.c
+**
+** Purpose: Negative test for the isprint API. Call isprint
+** to test if out of range characters are
+** not printable.
+**
+**
+**============================================================*/
+#include <palsuite.h>
+
+int __cdecl main(int argc, char *argv[])
+{
+ int err;
+
+ /*Initialize the PAL environment*/
+ err = PAL_Initialize(argc, argv);
+ if(0 != err)
+ {
+ return FAIL;
+ }
+
+ /*check that function fails for values that are not printable*/
+ err = isprint(0x15);
+ if(err)
+ {
+ Fail("\nSucceeded when it should have failed because 0x15 "
+ "is not in the range of printable characters\n");
+ }
+
+ err = isprint(0xAA);
+ if(err)
+ {
+ Fail("\nSucceeded when it should have failed because 0xAA "
+ "is not in the range of printable characters\n");
+ }
+
+ /* check carriage return */
+ if(0 != isprint(0x0d))
+ {
+ Fail("\nSucceeded when it should have failed because 0x0d "
+ "is not in the range of printable characters\n");
+ }
+
+ /* check line feed */
+ if(0 != isprint(0x0a))
+ {
+ Fail("\nSucceeded when it should have failed because 0x0a "
+ "is not in the range of printable characters\n");
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/isprint/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/isprint/test2/testinfo.dat
new file mode 100644
index 0000000000..e115278edb
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/isprint/test2/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 = miscellaneous
+Function = isprint
+Name = Test isprint API to check if out of range characters are not printable.
+TYPE = DEFAULT
+EXE1 = test2
+Description
+=Test the isprint function to verify that out of range characters
+=are not printable.
diff --git a/src/pal/tests/palsuite/c_runtime/isspace/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/isspace/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/isspace/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/isspace/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/isspace/test1/CMakeLists.txt
new file mode 100644
index 0000000000..34ad70d328
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/isspace/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_isspace_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_isspace_test1 coreclrpal)
+
+target_link_libraries(paltest_isspace_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/isspace/test1/test1.c b/src/pal/tests/palsuite/c_runtime/isspace/test1/test1.c
new file mode 100644
index 0000000000..6cd1ce878b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/isspace/test1/test1.c
@@ -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: test1.c
+**
+** Purpose: Test #1 for the isspace function
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+
+struct testCase
+{
+ long result;
+ char avalue;
+};
+
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ int i=0;
+ long result = 0;
+
+ /*
+ * A structures of the testcases to be tested with
+ * isspace function
+ */
+ struct testCase testCases[] =
+ {
+ {1,'\n'},
+ {1,'\t'},
+ {1,'\r'},
+ {1,'\v'},
+ {1,'\f'},
+ {1,' '},
+ {0,'a'},
+ {0,'A'},
+ {0,'z'},
+ {0,'Z'},
+ {0,'r'},
+ {0,'R'},
+ {0,'0'},
+ {0,'*'},
+ {0,3}
+ };
+
+ /*
+ * Initialize the PAL
+ */
+ if ( 0 != PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ /* Loop through the testcases */
+ for (i=0; i<sizeof(testCases)/sizeof(struct testCase); i++)
+ {
+ result = isspace(testCases[i].avalue);
+ if ( ((testCases[i].result == 1) && (result==0)) ||
+ ((testCases[i].result ==0) && (result !=0)) )
+ {
+ Fail("ERROR: isspace() returned %d for %c instead of %d\n",
+ result,
+ testCases[i].avalue,
+ testCases[i].result );
+ }
+ }
+
+
+ PAL_Terminate();
+
+ return PASS;
+}
+
diff --git a/src/pal/tests/palsuite/c_runtime/isspace/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/isspace/test1/testinfo.dat
new file mode 100644
index 0000000000..fe9926e8c8
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/isspace/test1/testinfo.dat
@@ -0,0 +1,15 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = isspace
+Name = Positive Test for isspace
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Run through every possible character. For each time that isspace returns
+= >0, check through a list of the known space characters to ensure that it
+= is really a space. Also, when it returns <=0, ensure that that character
+= isn't a space.
diff --git a/src/pal/tests/palsuite/c_runtime/isupper/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/isupper/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/isupper/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/isupper/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/isupper/test1/CMakeLists.txt
new file mode 100644
index 0000000000..c7fc71c43b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/isupper/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_isupper_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_isupper_test1 coreclrpal)
+
+target_link_libraries(paltest_isupper_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/isupper/test1/test1.c b/src/pal/tests/palsuite/c_runtime/isupper/test1/test1.c
new file mode 100644
index 0000000000..b88bcc4a7e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/isupper/test1/test1.c
@@ -0,0 +1,88 @@
+// Licensed to the .NET Foundation under one or more 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 isupper function
+** Check that a number of characters return the correct
+** values for whether they are upper case or not.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+struct testCase
+{
+ int CorrectResult;
+ int character;
+};
+
+int __cdecl main(int argc, char **argv)
+{
+
+ int result;
+ int i;
+
+ /* Note: 1 iff char = A..Z
+ 0 iff char =~ A..Z
+ */
+
+ struct testCase testCases[] =
+ {
+ {1, 'A'}, /* Basic cases */
+ {1, 'Z'},
+ {0, 'b'}, /* Lower case */
+ {0, '?'}, /* Characters without case */
+ {0, 230},
+ {0, '5'}
+ };
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ /* Loop through each case. Check to see if each is upper case or
+ not.
+ */
+
+ for(i = 0; i < sizeof(testCases) / sizeof(struct testCase); i++)
+ {
+ result = isupper(testCases[i].character);
+
+ /* The return value is 'non-zero' for success. This if condition
+ * will still work if that non-zero isn't just 1
+ */
+ if ( ((testCases[i].CorrectResult == 1) && (result == 0)) ||
+ ( (testCases[i].CorrectResult == 0) && (result != 0) ))
+ {
+ Fail("ERROR: isupper returned %i instead of %i for "
+ "character %c.\n",
+ result,testCases[i].CorrectResult,
+ testCases[i].character);
+ }
+
+ }
+
+
+ PAL_Terminate();
+ return PASS;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/isupper/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/isupper/test1/testinfo.dat
new file mode 100644
index 0000000000..fb2648a526
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/isupper/test1/testinfo.dat
@@ -0,0 +1,19 @@
+# Licensed to the .NET Foundation under one or more 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 = isupper
+Name = Positive Test for isupper
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Tests the PAL implementation of the isupper function
+= Check that a number of characters return the correct values for whether
+= they are upper case or not.
+
+
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/iswdigit/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/iswdigit/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/iswdigit/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/iswdigit/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/iswdigit/test1/CMakeLists.txt
new file mode 100644
index 0000000000..b35dd5ed6d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/iswdigit/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_iswdigit_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_iswdigit_test1 coreclrpal)
+
+target_link_libraries(paltest_iswdigit_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/iswdigit/test1/test1.c b/src/pal/tests/palsuite/c_runtime/iswdigit/test1/test1.c
new file mode 100644
index 0000000000..1cf94c5d13
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/iswdigit/test1/test1.c
@@ -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: test1.c (iswdigit)
+**
+** Purpose: Tests the PAL implementation of the iswdigit function.
+** Tests the passed parameter to iswdigit for being a
+** digit ('0' - '9'). Also passes non-digits to make sure
+** iswdigit picks them up.
+** NOTE: There are three ASCII values that under Windows,
+** iswdigit will return non-zero, indicating a digit.
+** These values are quite apparently not digits:
+** 178, 179, 185.
+** These are not tested.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char **argv)
+{
+
+ int result;
+ int i;
+
+ wchar_t passTestCases[] = {'1','2','3','4','5','6','7','8','9'};
+ wchar_t failTestCases[] = {'a','b','p','$','?',234};
+
+ if ((PAL_Initialize(argc, argv)) != 0)
+ {
+ return (FAIL);
+ }
+
+ /* Loop through each case. Testing if each is a digit. */
+ for(i = 0; i < sizeof(passTestCases) / sizeof(wchar_t); i++)
+ {
+ result = iswdigit(passTestCases[i]);
+
+ /* The return value is 'non-zero' indicates digit*/
+ if (result == 0)
+ {
+ Fail("ERROR: iswdigit returned \"%d\" instead indicating"
+ " \"%c\" is not a digit\n",
+ result,
+ passTestCases[i]);
+ }
+ }
+
+ /* Loop through each case. Testing if each is a not a digit. */
+ for(i = 0; i < sizeof(failTestCases) / sizeof(wchar_t); i++)
+ {
+ result = iswdigit(failTestCases[i]);
+
+ /* The return value is 'zero' indicates non-digit*/
+ if (result != 0)
+ {
+ Fail("ERROR: iswdigit returned \"%d\", indicating"
+ " \"%c\" is a digit\n",
+ result,
+ failTestCases[i]);
+ }
+ }
+ PAL_Terminate();
+ return (PASS);
+}
diff --git a/src/pal/tests/palsuite/c_runtime/iswdigit/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/iswdigit/test1/testinfo.dat
new file mode 100644
index 0000000000..345c9d5661
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/iswdigit/test1/testinfo.dat
@@ -0,0 +1,19 @@
+# Licensed to the .NET Foundation under one or more 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 = iswdigit
+Name = Positive Test for iswdigit
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Tests the PAL implementation of the iswdigit function.
+= Tests the passed parameter to iswdigit for being a
+= digit ('0' - '9'). Also passes non-digits to make sure
+= iswdigit picks them up.
+= NOTE: There are three ASCII values that under Windows,
+= iswdigit will return non-zero, indicating a digit.
+= These values are quite apparently not digits:
+= 178, 179, 185. These are not tested.
diff --git a/src/pal/tests/palsuite/c_runtime/iswprint/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/iswprint/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/iswprint/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/iswprint/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/iswprint/test1/CMakeLists.txt
new file mode 100644
index 0000000000..5e436c3ca2
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/iswprint/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_iswprint_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_iswprint_test1 coreclrpal)
+
+target_link_libraries(paltest_iswprint_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/iswprint/test1/test1.c b/src/pal/tests/palsuite/c_runtime/iswprint/test1/test1.c
new file mode 100644
index 0000000000..08a985b2d6
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/iswprint/test1/test1.c
@@ -0,0 +1,59 @@
+// Licensed to the .NET Foundation under one or more 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 iswprint with all wide characters, ensuring they are
+** consistent with GetStringTypeExW.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char **argv)
+{
+ WORD Info;
+ int ret;
+ int i;
+ WCHAR ch;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ for (i=0; i<=0xFFFF; i++)
+ {
+ ch = i;
+ ret = GetStringTypeExW(LOCALE_USER_DEFAULT, CT_CTYPE1, &ch, 1, &Info);
+ if (!ret)
+ {
+ Fail("GetStringTypeExW failed to get information for %#X!\n", ch);
+ }
+
+ ret = iswprint(ch);
+ if (Info & (C1_BLANK|C1_PUNCT|C1_ALPHA|C1_DIGIT))
+ {
+ if (!ret)
+ {
+ Fail("iswprint returned incorrect results for %#X: "
+ "expected printable\n", ch);
+ }
+ }
+ else
+ {
+ if (ret)
+ {
+ Fail("iswprint returned incorrect results for %#X: "
+ "expected non-printable\n", ch);
+ }
+ }
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/iswprint/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/iswprint/test1/testinfo.dat
new file mode 100644
index 0000000000..c425967b97
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/iswprint/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 = iswprint
+Name = Positive Test for iswprint
+TYPE = DEFAULT
+EXE1 = test1
+Description
+=Tests iswprint with all wide characters, ensuring they are
+=consistent with GetStringTypeExW.
diff --git a/src/pal/tests/palsuite/c_runtime/iswspace/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/iswspace/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/iswspace/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/iswspace/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/iswspace/test1/CMakeLists.txt
new file mode 100644
index 0000000000..1368e55ccc
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/iswspace/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_iswspace_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_iswspace_test1 coreclrpal)
+
+target_link_libraries(paltest_iswspace_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/iswspace/test1/test1.c b/src/pal/tests/palsuite/c_runtime/iswspace/test1/test1.c
new file mode 100644
index 0000000000..c58997812e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/iswspace/test1/test1.c
@@ -0,0 +1,78 @@
+// Licensed to the .NET Foundation under one or more 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 iswspace with a range of wide characters.
+**
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char *argv[])
+{
+ int ret;
+ int i;
+
+ struct testChars
+ {
+ WCHAR charValue;
+ int result;
+ };
+
+ /* create an array of chars that test the range of possible characters */
+ struct testChars testChars1[] =
+ {
+ {0x00,0}, /* null */
+ {0x09,1}, /* open circle */
+ {0x0D,1}, /* musical note */
+ {0x20,1}, /* space */
+ {0x3F,0}, /* ? */
+ {0x5E,0}, /* ^ */
+ {0x7B,0}, /* { */
+ {0x86,0}, /* a with circle on top */
+ {0x9F,0}, /* slanted f */
+ {0xC4,0}, /* long dash */
+ {0xE5,0} /* sigma */
+ };
+
+ if (0 != PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ for (i = 0; i < (sizeof(testChars1) / sizeof(struct testChars)); i++)
+ {
+
+ ret = iswspace(testChars1[i].charValue);
+
+ if((ret==0) && (testChars1[i].result != 0))
+ {
+ Fail("ERROR: wide character %#X IS considered a space, "
+ "but iswspace did NOT indicate it was one with error %u.\n",
+ testChars1[i].charValue,
+ GetLastError());
+ }
+
+ if((ret!=0) && (testChars1[i].result == 0))
+ {
+ Fail("ERROR: wide character %#X is NOT considered a space, "
+ "but iswspace DID indicate it was a space with error %u.\n",
+ testChars1[i].charValue,
+ GetLastError());
+ }
+ }
+
+
+ PAL_Terminate();
+
+ return PASS;
+}
+
diff --git a/src/pal/tests/palsuite/c_runtime/iswspace/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/iswspace/test1/testinfo.dat
new file mode 100644
index 0000000000..0368052b91
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/iswspace/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 = iswspace
+Name = Positive Test for iswspace
+TYPE = DEFAULT
+EXE1 = test1
+Description
+=Tests iswspace with a range of wide characters.
diff --git a/src/pal/tests/palsuite/c_runtime/iswupper/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/iswupper/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/iswupper/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/iswupper/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/iswupper/test1/CMakeLists.txt
new file mode 100644
index 0000000000..8b8fae6d72
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/iswupper/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_iswupper_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_iswupper_test1 coreclrpal)
+
+target_link_libraries(paltest_iswupper_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/iswupper/test1/test1.c b/src/pal/tests/palsuite/c_runtime/iswupper/test1/test1.c
new file mode 100644
index 0000000000..a01686be44
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/iswupper/test1/test1.c
@@ -0,0 +1,91 @@
+// Licensed to the .NET Foundation under one or more 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 iswupper function
+** Check that a number of characters return the correct
+** values for whether they are upper case or not.
+**
+**
+**===================================================================*/
+
+#define UNICODE
+#include <palsuite.h>
+
+
+struct testCase
+{
+ int CorrectResult;
+ WCHAR character;
+};
+
+int __cdecl main(int argc, char **argv)
+{
+
+ int result;
+ int i;
+
+ /* Note: 1 iff char = A..Z
+ 0 iff char =~ A..Z
+ */
+
+ struct testCase testCases[] =
+ {
+ {1, 'A'}, /* Basic cases */
+ {1, 'Z'},
+ {0, 'b'}, /* Lower case */
+ {0, '?'}, /* Characters without case */
+ {0, 230}
+ };
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ /* Loop through each case. Check to see if each is upper case or
+ not.
+ */
+
+ for(i = 0; i < sizeof(testCases) / sizeof(struct testCase); i++)
+ {
+
+ result = iswupper(testCases[i].character);
+
+ /* The return value is 'non-zero' for success. This if condition
+ * will still work if that non-zero isn't just 1
+ */
+ if ( ((testCases[i].CorrectResult == 1) && (result == 0)) ||
+ ( (testCases[i].CorrectResult == 0) && (result != 0) ))
+ {
+ Fail("ERROR: iswupper returned %i instead of %i for "
+ "character %c.\n",
+ result,
+ testCases[i].CorrectResult,
+ testCases[i].character);
+ }
+
+ }
+
+
+ PAL_Terminate();
+ return PASS;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/iswupper/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/iswupper/test1/testinfo.dat
new file mode 100644
index 0000000000..22131e40ac
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/iswupper/test1/testinfo.dat
@@ -0,0 +1,19 @@
+# Licensed to the .NET Foundation under one or more 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 = isupper
+Name = Positive Test for iswupper
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Tests the PAL implementation of the iswupper function
+= Check that a number of characters return the correct values for whether
+= they are upper case or not.
+
+
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/iswxdigit/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/iswxdigit/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/iswxdigit/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/iswxdigit/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/iswxdigit/test1/CMakeLists.txt
new file mode 100644
index 0000000000..3a726eced9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/iswxdigit/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_iswxdigit_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_iswxdigit_test1 coreclrpal)
+
+target_link_libraries(paltest_iswxdigit_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/iswxdigit/test1/test1.c b/src/pal/tests/palsuite/c_runtime/iswxdigit/test1/test1.c
new file mode 100644
index 0000000000..73ad495856
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/iswxdigit/test1/test1.c
@@ -0,0 +1,61 @@
+// Licensed to the .NET Foundation under one or more 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 iswxdigit with every possible wide character, ensuring it
+** returns the correct results.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+/*
+ * These are the only wide characters Win2000 recogonizes as valid hex digits.
+ */
+WCHAR ValidHexDigits[] =
+{
+ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 97, 98, 99, 100,
+ 101, 102, 65296, 65297, 65298, 65299, 65300, 65301, 65302, 65303, 65304, 65305,
+ 65313, 65314, 65315, 65316, 65317, 65318, 65345, 65346, 65347, 65348, 65349, 65350,
+ 0
+};
+
+int __cdecl main(int argc, char **argv)
+{
+ int i;
+ WCHAR c;
+ int ret;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ for (i=0; i<=0xFFFF; i++)
+ {
+ ret = iswxdigit(i);
+ c = (WCHAR) i;
+
+ if (ret)
+ {
+ if (wcschr(ValidHexDigits, c) == NULL)
+ {
+ /* iswxdigit says its a hex digit. We know better */
+ Fail("iswxdigit incorrectly found %#x to be a hex digit!\n", c);
+ }
+ }
+ else if (wcschr(ValidHexDigits, c) != NULL && c != 0)
+ {
+ /* iswxdigit says it isn't a hex digit. We know better */
+ Fail("iswxdigit failed to find %#x to be a hex digit!\n", c);
+ }
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/iswxdigit/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/iswxdigit/test1/testinfo.dat
new file mode 100644
index 0000000000..2b683c4eb7
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/iswxdigit/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 = iswxdigit
+Name = iswxdigit test #1
+TYPE = DEFAULT
+EXE1 = test1
+Description
+=Tests iswxdigit with every possible wide character, ensuring it
+=returns the correct results.
+
diff --git a/src/pal/tests/palsuite/c_runtime/isxdigit/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/isxdigit/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/isxdigit/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/isxdigit/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/isxdigit/test1/CMakeLists.txt
new file mode 100644
index 0000000000..8919b36e42
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/isxdigit/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_isxdigit_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_isxdigit_test1 coreclrpal)
+
+target_link_libraries(paltest_isxdigit_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/isxdigit/test1/test1.c b/src/pal/tests/palsuite/c_runtime/isxdigit/test1/test1.c
new file mode 100644
index 0000000000..be25af233c
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/isxdigit/test1/test1.c
@@ -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: Run through every possible character. For each time that
+** isxdigit returns:
+** 1, check through a list of the known hex characters to ensure that it
+** is really a hex char. Also, when it returns 0, ensure that that character
+** isn't a hex character.
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ int i;
+
+ /* Initialize the PAL */
+ if ( 0 != PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ /* Loop through each character and call isxdigit for each character */
+ for (i=1; i<256; i++)
+ {
+
+ if (isxdigit(i) == 0)
+ {
+ if( ((i>=48) && (i<=57)) || ((i>=97) && (i<=102)) ||
+ ((i>=65) && (i<=70)) )
+ {
+ Fail("ERROR: isxdigit() returns true for '%c' (%d)\n", i, i);
+ }
+ }
+ else
+ {
+ if( ((i<48) && (i>58)) || ((i<97) && (i>102)) ||
+ ((i<65) && (i>70)) )
+ {
+ Fail("ERROR: isxdigit() returns false for '%c' (%d)\n", i, i);
+ }
+ }
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/isxdigit/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/isxdigit/test1/testinfo.dat
new file mode 100644
index 0000000000..fd031f0768
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/isxdigit/test1/testinfo.dat
@@ -0,0 +1,15 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = isxdigit
+Name = Positive Test for isxdigit
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Run through every possible character. For each time that isxdigit returns
+= 1, check through a list of the known hex characters to ensure that it
+= is really a hex char. Also, when it returns 0, ensure that that character
+= isn't a hex character.
diff --git a/src/pal/tests/palsuite/c_runtime/labs/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/labs/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/labs/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/labs/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/labs/test1/CMakeLists.txt
new file mode 100644
index 0000000000..cf0f0999a9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/labs/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_labs_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_labs_test1 coreclrpal)
+
+target_link_libraries(paltest_labs_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/labs/test1/test1.c b/src/pal/tests/palsuite/c_runtime/labs/test1/test1.c
new file mode 100644
index 0000000000..41f85226e1
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/labs/test1/test1.c
@@ -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: test1.c
+**
+** Purpose: Call labs on a series of values -- negative, positive, zero,
+** and the largest negative value of a LONG. Ensure that they are all
+** changed properly to their absoulte value.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+struct testCase
+{
+ LONG LongValue;
+ LONG AbsoluteLongValue;
+};
+
+int __cdecl main(int argc, char **argv)
+{
+
+ LONG result=0;
+ int i=0;
+
+ struct testCase testCases[] =
+ {
+ {1234, 1234},
+ {-1234, 1234},
+ {0, 0},
+ {-2147483647, 2147483647}, /* Max value to abs */
+ {2147483647, 2147483647}
+ };
+
+ if (0 != (PAL_Initialize(argc, argv)))
+ {
+ return FAIL;
+ }
+
+ /* Loop through each case. Call labs on each LONG and ensure that
+ the resulting value is correct.
+ */
+
+ for(i = 0; i < sizeof(testCases) / sizeof(struct testCase); i++)
+ {
+ /* Absolute value on a LONG */
+ result = labs(testCases[i].LongValue);
+
+ if (testCases[i].AbsoluteLongValue != result)
+ {
+ Fail("ERROR: labs took the absoulte value of '%d' to be '%d' "
+ "instead of %d.\n",
+ testCases[i].LongValue,
+ result,
+ testCases[i].AbsoluteLongValue);
+ }
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/labs/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/labs/test1/testinfo.dat
new file mode 100644
index 0000000000..c385aa76b6
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/labs/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 = labs
+Name = Series of tests for labs: positive, negative, zero, maximum long value.
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Call labs on a series of values -- negative, positive, zero,
+= and the largest negative value of a long. Ensure that they are all
+= changed properly to their absoulte value.
diff --git a/src/pal/tests/palsuite/c_runtime/llabs/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/llabs/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/llabs/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/llabs/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/llabs/test1/CMakeLists.txt
new file mode 100644
index 0000000000..8f5bdbe097
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/llabs/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_llabs_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_llabs_test1 coreclrpal)
+
+target_link_libraries(paltest_llabs_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/llabs/test1/test1.c b/src/pal/tests/palsuite/c_runtime/llabs/test1/test1.c
new file mode 100644
index 0000000000..044e22f134
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/llabs/test1/test1.c
@@ -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: test1.c
+**
+** Purpose: Call llabs on a series of values -- negative, positive,
+** zero, and the largest negative value of an __int64. Ensure that
+** they are all changed properly to their absoulte value.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+struct testCase
+{
+ __int64 LongLongValue;
+ __int64 AbsoluteLongLongValue;
+};
+
+int __cdecl main(int argc, char **argv)
+{
+
+ __int64 result=0;
+ int i=0;
+
+ struct testCase testCases[] =
+ {
+ {1234, 1234},
+ {-1234, 1234},
+ {0, 0},
+ {-9223372036854775807LL, 9223372036854775807LL}, /* Max value to abs */
+ {9223372036854775807LL, 9223372036854775807LL}
+ };
+
+ if (0 != (PAL_Initialize(argc, argv)))
+ {
+ return FAIL;
+ }
+
+ /* Loop through each case. Call llabs on each __int64 and ensure that
+ the resulting value is correct.
+ */
+
+ for(i = 0; i < sizeof(testCases) / sizeof(struct testCase); i++)
+ {
+ /* Absolute value on an __int64 */
+ result = llabs(testCases[i].LongLongValue);
+
+ if (testCases[i].AbsoluteLongLongValue != result)
+ {
+ Fail("ERROR: llabs took the absoulte value of '%d' to be '%d' "
+ "instead of %d.\n",
+ testCases[i].LongLongValue,
+ result,
+ testCases[i].AbsoluteLongLongValue);
+ }
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/llabs/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/llabs/test1/testinfo.dat
new file mode 100644
index 0000000000..b1b76377bf
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/llabs/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 = labs
+Name = Series of tests for labs: positive, negative, zero, maximum __int64 value.
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Call llabs on a series of values -- negative, positive, zero,
+= and the largest negative value of an __int64. Ensure that they are all
+= changed properly to their absoulte value.
diff --git a/src/pal/tests/palsuite/c_runtime/localtime/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/localtime/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/localtime/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/localtime/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/localtime/test1/CMakeLists.txt
new file mode 100644
index 0000000000..25acf48749
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/localtime/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_localtime_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_localtime_test1 coreclrpal)
+
+target_link_libraries(paltest_localtime_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/localtime/test1/test1.c b/src/pal/tests/palsuite/c_runtime/localtime/test1/test1.c
new file mode 100644
index 0000000000..a993a17f69
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/localtime/test1/test1.c
@@ -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: test1.c (localtime)
+**
+** Purpose: Tests the PAL implementation of the localtime function.
+** localtime() is passed a date in seconds, since January 01
+** 1970 midnight, UTC. localtime() converts the time to the
+** tm struct, those values are tested for validity.
+**
+**
+**===================================================================*/
+#include <palsuite.h>
+
+int __cdecl main(int argc, char **argv)
+{
+ time_t dates[] ={1003327482, // Oct 17, 2001 10:04:42 am
+ 701307301, // March 22, 1992 6:35:01 pm
+ 973620900, // Nov 07, 2000 1:15:00 pm
+ 924632589, // April 20, 1999 2:23:09 pm
+ 951934989}; // March 01, 2000 1:23:09 pm
+ struct tm * converted_date;
+ int i;
+
+ if (PAL_Initialize(argc, argv) != 0)
+
+ return (FAIL);
+
+ /*Convert from time_t to struct tm*/
+ for ( i=0; i < (sizeof(dates)/sizeof(time_t)); i++)
+ {
+ converted_date = localtime(&dates[i]);
+
+ if ((converted_date->tm_hour < 0) || (converted_date->tm_hour > 23))
+ {
+ Fail("ERROR: localtime returned %d for tm_hour\n", converted_date->tm_hour);
+ }
+ if ((converted_date->tm_mday < 1) || (converted_date->tm_mday > 31))
+ {
+ Fail("ERROR: localtime returned %d for tm_mday\n",converted_date->tm_mday);
+ }
+ if ((converted_date->tm_min < 0) || (converted_date->tm_min > 59))
+ {
+ Fail("ERROR: localtime returned %d for tm_min\n",converted_date->tm_min);
+ }
+ if ((converted_date->tm_mon < 0) || (converted_date->tm_mon > 11))
+ {
+ Fail("ERROR: localtime returned %d for tm_mon\n",converted_date->tm_mon);
+ }
+ if ((converted_date->tm_sec < 0) || (converted_date->tm_sec > 59))
+ {
+ Fail("ERROR: localtime returned %d for tm_sec\n",converted_date->tm_sec);
+ }
+ if ((converted_date->tm_wday < 0) || (converted_date->tm_wday > 6 ))
+ {
+ Fail("ERROR: localtime returned %d for tm_wday\n",converted_date->tm_wday);
+ }
+ if ((converted_date->tm_yday < 0) || (converted_date->tm_yday > 365))
+ {
+ Fail("ERROR: localtime returned %d for tm_yday\n",converted_date->tm_yday);
+ }
+ }
+
+ PAL_Terminate();
+ return (PASS);
+}
diff --git a/src/pal/tests/palsuite/c_runtime/localtime/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/localtime/test1/testinfo.dat
new file mode 100644
index 0000000000..63f7fcda93
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/localtime/test1/testinfo.dat
@@ -0,0 +1,15 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = localtime
+Name = Positive Test for localtime
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Tests the PAL implementation of the localtime function.
+= localtime() is passed a date in seconds, since January 01
+= 1970 midnight, UTC. localtime() converts the time to the
+= tm struct, those values are tested for validity.
diff --git a/src/pal/tests/palsuite/c_runtime/log/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/log/CMakeLists.txt
new file mode 100644
index 0000000000..5e1ef7f28b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/log/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/log/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/log/test1/CMakeLists.txt
new file mode 100644
index 0000000000..dd19002904
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/log/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_log_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_log_test1 coreclrpal)
+
+target_link_libraries(paltest_log_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/log/test1/test1.c b/src/pal/tests/palsuite/c_runtime/log/test1/test1.c
new file mode 100644
index 0000000000..eea592dd45
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/log/test1/test1.c
@@ -0,0 +1,140 @@
+// Licensed to the .NET Foundation under one or more 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 log with a normal set of values.
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+// binary64 (double) has a machine epsilon of 2^-52 (approx. 2.22e-16). However, this
+// is slightly too accurate when writing tests meant to run against libm implementations
+// for various platforms. 2^-50 (approx. 8.88e-16) 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 (15-17 digits).
+
+// For example, a test with an expect result in the format of 0.xxxxxxxxxxxxxxxxx will use
+// PAL_EPSILON for the variance, while an expected result in the format of 0.0xxxxxxxxxxxxxxxxx
+// will use PAL_EPSILON / 10 and and expected result in the format of x.xxxxxxxxxxxxxxxx will
+// use PAL_EPSILON * 10.
+#define PAL_EPSILON 8.8817841970012523e-16
+
+#define PAL_NAN sqrt(-1.0)
+#define PAL_POSINF -log(0.0)
+#define PAL_NEGINF log(0.0)
+
+/**
+ * Helper test structure
+ */
+struct test
+{
+ double value; /* value to test the function with */
+ double expected; /* expected result */
+ double variance; /* maximum delta between the expected and actual result */
+};
+
+/**
+ * validate
+ *
+ * test validation function
+ */
+void __cdecl validate(double value, double expected, double variance)
+{
+ double result = log(value);
+
+ /*
+ * The test is valid when the difference between result
+ * and expected is less than or equal to variance
+ */
+ double delta = fabs(result - expected);
+
+ if (delta > variance)
+ {
+ Fail("log(%g) returned %20.17g when it should have returned %20.17g",
+ value, result, expected);
+ }
+}
+
+/**
+ * validate
+ *
+ * test validation function for values returning NaN
+ */
+void __cdecl validate_isnan(double value)
+{
+ double result = log(value);
+
+ if (!_isnan(result))
+ {
+ Fail("log(%g) returned %20.17g when it should have returned %20.17g",
+ 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.043213918263772250, -3.1415926535897932, PAL_EPSILON * 10 }, // expected: -(pi)
+ { 0.065988035845312537, -2.7182818284590452, PAL_EPSILON * 10 }, // expected: -(e)
+ { 0.1, -2.3025850929940457, PAL_EPSILON * 10 }, // expected: -(ln(10))
+ { 0.20787957635076191, -1.5707963267948966, PAL_EPSILON * 10 }, // expected: -(pi / 2)
+ { 0.23629008834452270, -1.4426950408889634, PAL_EPSILON * 10 }, // expected: -(log2(e))
+ { 0.24311673443421421, -1.4142135623730950, PAL_EPSILON * 10 }, // expected: -(sqrt(2))
+ { 0.32355726390307110, -1.1283791670955126, PAL_EPSILON * 10 }, // expected: -(2 / sqrt(pi))
+ { 0.36787944117144232, -1, PAL_EPSILON * 10 }, // expected: -(1)
+ { 0.45593812776599624, -0.78539816339744831, PAL_EPSILON }, // expected: -(pi / 4)
+ { 0.49306869139523979, -0.70710678118654752, PAL_EPSILON }, // expected: -(1 / sqrt(2))
+ { 0.5, -0.69314718055994531, PAL_EPSILON }, // expected: -(ln(2))
+ { 0.52907780826773535, -0.63661977236758134, PAL_EPSILON }, // expected: -(2 / pi)
+ { 0.64772148514180065, -0.43429448190325183, PAL_EPSILON }, // expected: -(log10(e))
+ { 0.72737734929521647, -0.31830988618379067, PAL_EPSILON }, // expected: -(1 / pi)
+ { 1, 0, PAL_EPSILON },
+ { 1.3748022274393586, 0.31830988618379067, PAL_EPSILON }, // expected: 1 / pi
+ { 1.5438734439711811, 0.43429448190325183, PAL_EPSILON }, // expected: log10(e)
+ { 1.8900811645722220, 0.63661977236758134, PAL_EPSILON }, // expected: 2 / pi
+ { 2, 0.69314718055994531, PAL_EPSILON }, // expected: ln(2)
+ { 2.0281149816474725, 0.70710678118654752, PAL_EPSILON }, // expected: 1 / sqrt(2)
+ { 2.1932800507380155, 0.78539816339744831, PAL_EPSILON }, // expected: pi / 4
+ { 2.7182818284590452, 1, PAL_EPSILON * 10 }, // value: e
+ { 3.0906430223107976, 1.1283791670955126, PAL_EPSILON * 10 }, // expected: 2 / sqrt(pi)
+ { 4.1132503787829275, 1.4142135623730950, PAL_EPSILON * 10 }, // expected: sqrt(2)
+ { 4.2320861065570819, 1.4426950408889634, PAL_EPSILON * 10 }, // expected: log2(e)
+ { 4.8104773809653517, 1.5707963267948966, PAL_EPSILON * 10 }, // expected: pi / 2
+ { 10, 2.3025850929940457, PAL_EPSILON * 10 }, // expected: ln(10)
+ { 15.154262241479264, 2.7182818284590452, PAL_EPSILON * 10 }, // expected: e
+ { 23.140692632779269, 3.1415926535897932, 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/log/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/log/test1/testinfo.dat
new file mode 100644
index 0000000000..6b984f6eba
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/log/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 = log
+Name = Positive Test for log
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Passes a series of values to the log() 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/log10/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/log10/CMakeLists.txt
new file mode 100644
index 0000000000..5e1ef7f28b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/log10/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/log10/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/log10/test1/CMakeLists.txt
new file mode 100644
index 0000000000..31e750df3e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/log10/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_log10_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_log10_test1 coreclrpal)
+
+target_link_libraries(paltest_log10_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/log10/test1/test1.c b/src/pal/tests/palsuite/c_runtime/log10/test1/test1.c
new file mode 100644
index 0000000000..13711a752e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/log10/test1/test1.c
@@ -0,0 +1,146 @@
+// Licensed to the .NET Foundation under one or more 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 log10 returns correct values.
+**
+** Dependencies: PAL_Initialize
+** PAL_Terminate
+** Fail
+** fabs
+** _isnan
+**
+**===========================================================================*/
+
+#include <palsuite.h>
+
+// binary64 (double) has a machine epsilon of 2^-52 (approx. 2.22e-16). However, this
+// is slightly too accurate when writing tests meant to run against libm implementations
+// for various platforms. 2^-50 (approx. 8.88e-16) 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 (15-17 digits).
+
+// For example, a test with an expect result in the format of 0.xxxxxxxxxxxxxxxxx will use
+// PAL_EPSILON for the variance, while an expected result in the format of 0.0xxxxxxxxxxxxxxxxx
+// will use PAL_EPSILON / 10 and and expected result in the format of x.xxxxxxxxxxxxxxxx will
+// use PAL_EPSILON * 10.
+#define PAL_EPSILON 8.8817841970012523e-16
+
+#define PAL_NAN sqrt(-1.0)
+#define PAL_POSINF -log(0.0)
+#define PAL_NEGINF log(0.0)
+
+/**
+ * Helper test structure
+ */
+struct test
+{
+ double value; /* value to test the function with */
+ double expected; /* expected result */
+ double variance; /* maximum delta between the expected and actual result */
+};
+
+/**
+ * validate
+ *
+ * test validation function
+ */
+void __cdecl validate(double value, double expected, double variance)
+{
+ double result = log10(value);
+
+ /*
+ * The test is valid when the difference between result
+ * and expected is less than or equal to variance
+ */
+ double delta = fabs(result - expected);
+
+ if (delta > variance)
+ {
+ Fail("log10(%g) returned %20.17g when it should have returned %20.17g",
+ value, result, expected);
+ }
+}
+
+/**
+ * validate
+ *
+ * test validation function for values returning NaN
+ */
+void __cdecl validate_isnan(double value)
+{
+ double result = log10(value);
+
+ if (!_isnan(result))
+ {
+ Fail("log10(%g) returned %20.17g when it should have returned %20.17g",
+ 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.00072178415907472774, -3.1415926535897932, PAL_EPSILON * 10 }, // expected: -(pi)
+ { 0.0019130141022243176, -2.7182818284590452, PAL_EPSILON * 10 }, // expected: -(e)
+ { 0.0049821282964407206, -2.3025850929940457, PAL_EPSILON * 10 }, // expected: -(ln(10))
+ { 0.026866041001136132, -1.5707963267948966, PAL_EPSILON * 10 }, // expected: -(pi / 2)
+ { 0.036083192820787210, -1.4426950408889634, PAL_EPSILON * 10 }, // expected: -(log2(e))
+ { 0.038528884700322026, -1.4142135623730950, PAL_EPSILON * 10 }, // expected: -(sqrt(2))
+ { 0.074408205860642723, -1.1283791670955126, PAL_EPSILON * 10 }, // expected: -(2 / sqrt(pi))
+ { 0.1, -1, PAL_EPSILON * 10 }, // expected: -(1)
+ { 0.16390863613957665, -0.78539816339744831, PAL_EPSILON }, // expected: -(pi / 4)
+ { 0.19628775993505562, -0.70710678118654752, PAL_EPSILON }, // expected: -(1 / sqrt(2))
+ { 0.20269956628651730, -0.69314718055994531, PAL_EPSILON }, // expected: -(ln(2))
+ { 0.23087676451600055, -0.63661977236758134, PAL_EPSILON }, // expected: -(2 / pi)
+ { 0.36787944117144232, -0.43429448190325183, PAL_EPSILON }, // expected: -(log10(e))
+ { 0.48049637305186868, -0.31830988618379067, PAL_EPSILON }, // expected: -(1 / pi)
+ { 1, 0, PAL_EPSILON },
+ { 2.0811811619898573, 0.31830988618379067, PAL_EPSILON }, // expected: 1 / pi
+ { 2.7182818284590452, 0.43429448190325183, PAL_EPSILON }, // expected: log10(e) value: e
+ { 4.3313150290214525, 0.63661977236758134, PAL_EPSILON }, // expected: 2 / pi
+ { 4.9334096679145963, 0.69314718055994531, PAL_EPSILON }, // expected: ln(2)
+ { 5.0945611704512962, 0.70710678118654752, PAL_EPSILON }, // expected: 1 / sqrt(2)
+ { 6.1009598002416937, 0.78539816339744831, PAL_EPSILON }, // expected: pi / 4
+ { 10, 1, PAL_EPSILON * 10 },
+ { 13.439377934644400, 1.1283791670955126, PAL_EPSILON * 10 }, // expected: 2 / sqrt(pi)
+ { 25.954553519470081, 1.4142135623730950, PAL_EPSILON * 10 }, // expected: sqrt(2)
+ { 27.713733786437790, 1.4426950408889634, PAL_EPSILON * 10 }, // expected: log2(e)
+ { 37.221710484165167, 1.5707963267948966, PAL_EPSILON * 10 }, // expected: pi / 2
+ { 200.71743249053009, 2.3025850929940457, PAL_EPSILON * 10 }, // expected: ln(10)
+ { 522.73529967043665, 2.7182818284590452, PAL_EPSILON * 10 }, // expected: e
+ { 1385.4557313670111, 3.1415926535897932, 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/log10/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/log10/test1/testinfo.dat
new file mode 100644
index 0000000000..887bace692
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/log10/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 = log10
+Name = Positive Test for log10
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Passes a series of values to the log10() 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/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/malloc/CMakeLists.txt
new file mode 100644
index 0000000000..ef14ea5352
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/malloc/CMakeLists.txt
@@ -0,0 +1,5 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+add_subdirectory(test2)
+
diff --git a/src/pal/tests/palsuite/c_runtime/malloc/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/malloc/test1/CMakeLists.txt
new file mode 100644
index 0000000000..4a388ad3d7
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/malloc/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_malloc_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_malloc_test1 coreclrpal)
+
+target_link_libraries(paltest_malloc_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/malloc/test1/test1.c b/src/pal/tests/palsuite/c_runtime/malloc/test1/test1.c
new file mode 100644
index 0000000000..7ea4dd068f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/malloc/test1/test1.c
@@ -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: test1.c
+**
+** Purpose: Test that malloc returns useable memory
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+
+int __cdecl main(int argc, char **argv)
+{
+
+ char *testA;
+ int i;
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ /* check that malloc really gives us addressable memory */
+ testA = (char *)malloc(20 * sizeof(char));
+ if (testA == NULL)
+ {
+ Fail("Call to malloc failed.\n");
+ }
+ for (i = 0; i < 20; i++)
+ {
+ testA[i] = 'a';
+ }
+ for (i = 0; i < 20; i++)
+ {
+ if (testA[i] != 'a')
+ {
+ Fail("The memory doesn't seem to be properly allocated.\n");
+ }
+ }
+ free(testA);
+
+ PAL_Terminate();
+
+ return PASS;
+}
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/malloc/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/malloc/test1/testinfo.dat
new file mode 100644
index 0000000000..9060bc6284
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/malloc/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 = malloc
+Name = Positive Test for malloc
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Tests that malloc properly allocates memory.
diff --git a/src/pal/tests/palsuite/c_runtime/malloc/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/malloc/test2/CMakeLists.txt
new file mode 100644
index 0000000000..abbed2aa62
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/malloc/test2/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test2.c
+)
+
+add_executable(paltest_malloc_test2
+ ${SOURCES}
+)
+
+add_dependencies(paltest_malloc_test2 coreclrpal)
+
+target_link_libraries(paltest_malloc_test2
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/malloc/test2/test2.c b/src/pal/tests/palsuite/c_runtime/malloc/test2/test2.c
new file mode 100644
index 0000000000..5deee0eddb
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/malloc/test2/test2.c
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more 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 that malloc(0) returns non-zero value
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+
+int __cdecl main(int argc, char **argv)
+{
+
+ char *testA;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ /* check that malloc(0) returns non-zero value */
+ testA = (char *)malloc(0);
+ if (testA == NULL)
+ {
+ Fail("Call to malloc(0) failed.\n");
+ }
+
+ free(testA);
+
+ PAL_Terminate();
+
+ return PASS;
+}
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/malloc/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/malloc/test2/testinfo.dat
new file mode 100644
index 0000000000..1212a8f8f9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/malloc/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 = malloc
+Name = Positive Test for malloc
+TYPE = DEFAULT
+EXE1 = test2
+Description
+= Test that malloc(0) returns non-zero value
diff --git a/src/pal/tests/palsuite/c_runtime/memchr/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/memchr/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/memchr/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/memchr/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/memchr/test1/CMakeLists.txt
new file mode 100644
index 0000000000..4e33a8fc04
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/memchr/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_memchr_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_memchr_test1 coreclrpal)
+
+target_link_libraries(paltest_memchr_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/memchr/test1/test1.c b/src/pal/tests/palsuite/c_runtime/memchr/test1/test1.c
new file mode 100644
index 0000000000..043a6789d8
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/memchr/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: Tests the PAL implementation of the memchr function.
+** Create a string buffer, and check for a number of
+** characters in it. Test to ensure it returns NULL if
+** it can't find the character, and that the size argument
+** works properly.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+struct testCase
+{
+ char *result;
+ char string[50];
+ int character;
+ int length;
+};
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ int i = 0;
+ char *result = NULL;
+
+ /*
+ * this structure includes several strings to be tested with
+ * memchr function and the expected results
+ */
+
+ struct testCase testCases[]=
+ {
+ {"st","corn cup cat cream coast",'s',23},
+ /* single instance of char */
+ {"st","corn cup cat cream coast",'s',24},
+ /* single inst, inst< exact length */
+ {"q","corn cup cat cream coastq",'q',25},
+ /* single inst at end, inst=exact length */
+ {"q","corn cup cat cream coastq",'q',26},
+ /* single inst at end, inst<length,
+ length>len(string) */
+ {"st","corn cup cat cream coast",115,24},
+ /* single int inst, inst<exact length */
+ {"corn cup cat cream coast","corn cup cat cream coast",'c',24},
+ /* multi-inst, inst=1, exact length */
+ {"corn cup cat cream coast","corn cup cat cream coast",'c',1},
+ /* multi-inst, inst = length, length=1 */
+ {"is is a test","This is a test",105,14},
+ /* single int inst, exact length */
+ {"is is a test","This is a test",'i',14},
+ /* double inst, exact length */
+ {"a test","This is a test",'a',9},
+ /* single instance instance = length */
+ {NULL,"This is a test",'b',14},
+ /* no instance exact length */
+ {NULL,"This is a test",'a',8},
+ /* single instance - < length */
+ {NULL,"This is a test",121,14},
+ /* single instance - exact length */
+ {" is a test of the function","This is a test of the function",
+ ' ',17} /* single inst<length, len(string)>length */
+ };
+
+
+ /* Initialize the PAL */
+ if ( 0 != PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ /* Loop through the testcases in the structure */
+ for (i=0; i< sizeof(testCases)/sizeof(struct testCase); i++)
+ {
+ /* Need to type cast function in order to compare the result */
+ result = (char *)memchr(testCases[i].string,
+ testCases[i].character,testCases[i].length);
+
+ if (result==NULL)
+ {
+ if (testCases[i].result != NULL)
+ {
+ Fail("ERROR: Expected memcmp to return \"%s\" instead of"
+ " NULL\n", testCases[i].result);
+ }
+ }
+ else
+ {
+ if (strcmp(result,testCases[i].result)!=0 )
+
+ {
+ Fail("ERROR: Expected memcmp to return \"%s\" instead of"
+ " \"%s\"\n", testCases[i].result, result);
+ }
+
+ }
+ }
+
+ PAL_Terminate();
+
+ return PASS;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/memchr/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/memchr/test1/testinfo.dat
new file mode 100644
index 0000000000..fc2a8e95dc
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/memchr/test1/testinfo.dat
@@ -0,0 +1,19 @@
+# Licensed to the .NET Foundation under one or more 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 = memchr
+Name = Positive Test for memchr
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Create a string buffer, and check for a number of characters in it.
+= Test to ensure it returns NULL if it can't find the character, and that
+= the size argument works properly.
+
+
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/memcmp/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/memcmp/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/memcmp/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/memcmp/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/memcmp/test1/CMakeLists.txt
new file mode 100644
index 0000000000..b61f208f34
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/memcmp/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_memcmp_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_memcmp_test1 coreclrpal)
+
+target_link_libraries(paltest_memcmp_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/memcmp/test1/test1.c b/src/pal/tests/palsuite/c_runtime/memcmp/test1/test1.c
new file mode 100644
index 0000000000..7b63173e22
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/memcmp/test1/test1.c
@@ -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: test1.c
+**
+** Purpose: Check that memcmp find identical buffers to be identical,
+** and that it correctly orders different buffers.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char **argv)
+{
+
+ char testA[] = "aaaaaaaaaaaaaaaaaaaa";
+ char testB[] = "aaaaaaaaaaaaaaaaaaaa";
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ if (!(memcmp(testA, testB, 20) == 0))
+ {
+ Fail("memcmp compared two identical buffers and found them to "
+ "differ.\n");
+ }
+ testB[3] = 'b';
+
+ if (!(memcmp(testA, testB, 20) < 0)
+ || !(memcmp(testB, testA, 20) >0 ))
+ {
+ Fail("memcmp compared two buffers with different contents, and"
+ " did not order them correctly.\n");
+ }
+
+ if (memcmp(testA, testB, 0) != 0)
+ {
+ Fail("memcmp didn't return 0 when comparing buffers of length 0.\n");
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
+
+
+
+
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/memcmp/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/memcmp/test1/testinfo.dat
new file mode 100644
index 0000000000..2de36b2dd6
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/memcmp/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 = memcmp
+Name = Positive Test for memcmp
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Check that memcmp find identical buffers to be identical,
+= and that it correctly orders different buffers.
diff --git a/src/pal/tests/palsuite/c_runtime/memcpy/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/memcpy/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/memcpy/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/memcpy/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/memcpy/test1/CMakeLists.txt
new file mode 100644
index 0000000000..d846bfc62d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/memcpy/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_memcpy_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_memcpy_test1 coreclrpal)
+
+target_link_libraries(paltest_memcpy_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/memcpy/test1/test1.c b/src/pal/tests/palsuite/c_runtime/memcpy/test1/test1.c
new file mode 100644
index 0000000000..9da98d6573
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/memcpy/test1/test1.c
@@ -0,0 +1,87 @@
+// Licensed to the .NET Foundation under one or more 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 memcpy and verifies that the buffer was copied correctly.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char **argv)
+{
+ char testA[20];
+ char testB[20];
+ void *retVal;
+ long i;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ memset(testA, 'a', 20);
+ memset(testB, 'b', 20);
+
+ retVal = (char *)memcpy(testB, testA, 0);
+ if (retVal != testB)
+ {
+ Fail("memcpy should return a pointer to the destination buffer, "
+ "but doesn't.\n");
+ }
+ for(i = 0; i<20; i++)
+ {
+ if (testB[i]!= 'b')
+ {
+ Fail("The destination buffer overflowed by memcpy.\n");
+ }
+ }
+
+ retVal = (char *)memcpy(testB+1, testA, 18);
+ if (retVal != testB+1)
+ {
+ Fail("memcpy should return a pointer to the destination buffer, "
+ "but doesn't.\n");
+ }
+
+ if (testB[0] != 'b' || testB[19] != 'b')
+ {
+ Fail("The destination buffer was written out of bounds by memcpy!\n");
+ }
+
+ for(i = 1; i<19; i++)
+ {
+ if (testB[i]!= 'a')
+ {
+ Fail("The destination buffer copied to by memcpy doesn't match "
+ "the source buffer.\n");
+ }
+ }
+
+ PAL_Terminate();
+
+ return PASS;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/memcpy/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/memcpy/test1/testinfo.dat
new file mode 100644
index 0000000000..157da6cf87
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/memcpy/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 = memcpy
+Name = Positive Test for memcpy
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Calls memcpy and verifies that the buffer was copied correctly.
diff --git a/src/pal/tests/palsuite/c_runtime/memmove/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/memmove/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/memmove/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/memmove/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/memmove/test1/CMakeLists.txt
new file mode 100644
index 0000000000..cf50ec01b7
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/memmove/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_memmove_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_memmove_test1 coreclrpal)
+
+target_link_libraries(paltest_memmove_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/memmove/test1/test1.c b/src/pal/tests/palsuite/c_runtime/memmove/test1/test1.c
new file mode 100644
index 0000000000..c1af871f4a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/memmove/test1/test1.c
@@ -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[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/testinfo.dat b/src/pal/tests/palsuite/c_runtime/memmove/test1/testinfo.dat
new file mode 100644
index 0000000000..d8d4c0ead9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/memmove/test1/testinfo.dat
@@ -0,0 +1,19 @@
+# Licensed to the .NET Foundation under one or more 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 = memmove
+Name = Positive Test for memmove
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Test that memmove correctly copies text from one buffer to another
+= even when the buffers overlap.
+
+
+
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/memset/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/memset/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/memset/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/memset/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/memset/test1/CMakeLists.txt
new file mode 100644
index 0000000000..78b5a6bc00
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/memset/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_memset_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_memset_test1 coreclrpal)
+
+target_link_libraries(paltest_memset_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/memset/test1/test1.c b/src/pal/tests/palsuite/c_runtime/memset/test1/test1.c
new file mode 100644
index 0000000000..67cde8756b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/memset/test1/test1.c
@@ -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: Check that memset correctly fills a destination buffer
+** without overflowing it.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char **argv)
+{
+
+ char testA[22] = "bbbbbbbbbbbbbbbbbbbbb";
+ char *retVal;
+
+ int i;
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ retVal = (char *)memset(testA, 'a', 20);
+ if (retVal != testA)
+ {
+ Fail("memset should have returned the value of the destination"
+ "pointer, but didn't");
+ }
+
+ for(i = 0; i<20; i++)
+ {
+ if (testA[i]!= 'a')
+ {
+ Fail("memset didn't set the destination bytes.\n");
+ }
+ }
+ if (testA[20] == 'a')
+ {
+ Fail("memset overfilled the destination buffer.\n");
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/memset/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/memset/test1/testinfo.dat
new file mode 100644
index 0000000000..cab02fb4b7
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/memset/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 = memset
+Name = Positive Test for memset
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Check that memset correctly fills a destination buffer without overflowing it.
+
diff --git a/src/pal/tests/palsuite/c_runtime/modf/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/modf/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/modf/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/modf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/modf/test1/CMakeLists.txt
new file mode 100644
index 0000000000..4b65ba7a6f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/modf/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_modf_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_modf_test1 coreclrpal)
+
+target_link_libraries(paltest_modf_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/modf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/modf/test1/test1.c
new file mode 100644
index 0000000000..389d079253
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/modf/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 (modf)
+**
+** Purpose: Test to ensure that modf return the correct values
+**
+** Dependencies: PAL_Initialize
+** PAL_Terminate
+** Fail
+** fabs
+**
+**===========================================================================*/
+
+#include <palsuite.h>
+
+// binary64 (double) has a machine epsilon of 2^-52 (approx. 2.22e-16). However, this
+// is slightly too accurate when writing tests meant to run against libm implementations
+// for various platforms. 2^-50 (approx. 8.88e-16) 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 (15-17 digits).
+
+// For example, a test with an expect result in the format of 0.xxxxxxxxxxxxxxxxx will use
+// PAL_EPSILON for the variance, while an expected result in the format of 0.0xxxxxxxxxxxxxxxxx
+// will use PAL_EPSILON / 10 and and expected result in the format of x.xxxxxxxxxxxxxxxx will
+// use PAL_EPSILON * 10.
+#define PAL_EPSILON 8.8817841970012523e-16
+
+#define PAL_NAN sqrt(-1.0)
+#define PAL_POSINF -log(0.0)
+#define PAL_NEGINF log(0.0)
+
+/**
+ * Helper test structure
+ */
+struct test
+{
+ double value; /* value to test the function with */
+ double expected; /* expected result */
+ double variance; /* maximum delta between the expected and actual result */
+ double expected_intpart; /* expected result */
+ double variance_intpart; /* maximum delta between the expected and actual result */
+};
+
+/**
+ * validate
+ *
+ * test validation function
+ */
+void __cdecl validate(double value, double expected, double variance, double expected_intpart, double variance_intpart)
+{
+ double result_intpart;
+ double result = modf(value, &result_intpart);
+
+ /*
+ * The test is valid when the difference between result
+ * and expected is less than or equal to variance
+ */
+ double delta = fabs(result - expected);
+ double delta_intpart = fabs(result_intpart - expected_intpart);
+
+ if ((delta > variance) || (delta_intpart > variance_intpart))
+ {
+ Fail("modf(%g) returned %20.17g with an intpart of %20.17g when it should have returned %20.17g with an intpart of %20.17g",
+ value, result, result_intpart, expected, expected_intpart);
+ }
+}
+
+/**
+ * validate
+ *
+ * test validation function for values returning NaN
+ */
+void __cdecl validate_isnan(double value)
+{
+ double result_intpart;
+ double result = modf(value, &result_intpart);
+
+ if (!_isnan(result) || !_isnan(result_intpart))
+ {
+ Fail("modf(%g) returned %20.17g with an intpart of %20.17g when it should have returned %20.17g with an intpart of %20.17g",
+ value, result, result_intpart, PAL_NAN, PAL_NAN);
+ }
+}
+
+/**
+ * main
+ *
+ * executable entry point
+ */
+int __cdecl main(int argc, char **argv)
+{
+ struct test tests[] =
+ {
+ /* value expected variance expected_intpart variance_intpart */
+ { 0, 0, PAL_EPSILON, 0, PAL_EPSILON },
+ { 0.31830988618379067, 0.31830988618379067, PAL_EPSILON, 0, PAL_EPSILON }, // value: 1 / pi
+ { 0.43429448190325183, 0.43429448190325183, PAL_EPSILON, 0, PAL_EPSILON }, // value: log10(e)
+ { 0.63661977236758134, 0.63661977236758134, PAL_EPSILON, 0, PAL_EPSILON }, // value: 2 / pi
+ { 0.69314718055994531, 0.69314718055994531, PAL_EPSILON, 0, PAL_EPSILON }, // value: ln(2)
+ { 0.70710678118654752, 0.70710678118654752, PAL_EPSILON, 0, PAL_EPSILON }, // value: 1 / sqrt(2)
+ { 0.78539816339744831, 0.78539816339744831, PAL_EPSILON, 0, PAL_EPSILON }, // value: pi / 4
+ { 1, 0, PAL_EPSILON, 1, PAL_EPSILON * 10 },
+ { 1.1283791670955126, 0.1283791670955126, PAL_EPSILON, 1, PAL_EPSILON * 10 }, // value: 2 / sqrt(pi)
+ { 1.4142135623730950, 0.4142135623730950, PAL_EPSILON, 1, PAL_EPSILON * 10 }, // value: sqrt(2)
+ { 1.4426950408889634, 0.4426950408889634, PAL_EPSILON, 1, PAL_EPSILON * 10 }, // value: log2(e)
+ { 1.5707963267948966, 0.5707963267948966, PAL_EPSILON, 1, PAL_EPSILON * 10 }, // value: pi / 2
+ { 2.3025850929940457, 0.3025850929940457, PAL_EPSILON, 2, PAL_EPSILON * 10 }, // value: ln(10)
+ { 2.7182818284590452, 0.7182818284590452, PAL_EPSILON, 2, PAL_EPSILON * 10 }, // value: e
+ { 3.1415926535897932, 0.1415926535897932, PAL_EPSILON, 3, PAL_EPSILON * 10 }, // value: pi
+ { PAL_POSINF, 0, PAL_EPSILON, 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, tests[i].expected_intpart, tests[i].variance_intpart);
+ validate(-tests[i].value, -tests[i].expected, tests[i].variance, -tests[i].expected_intpart, tests[i].variance_intpart);
+ }
+
+ validate_isnan(PAL_NAN);
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/modf/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/modf/test1/testinfo.dat
new file mode 100644
index 0000000000..203b553e20
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/modf/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 = modf
+Name = Positive Test for modf
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Passes to modf() a series of values, checking that
+= each one return to correct value.
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/modff/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/modff/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/modff/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/modff/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/modff/test1/CMakeLists.txt
new file mode 100644
index 0000000000..812cd1c47b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/modff/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_modff_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_modff_test1 coreclrpal)
+
+target_link_libraries(paltest_modff_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/modff/test1/test1.c b/src/pal/tests/palsuite/c_runtime/modff/test1/test1.c
new file mode 100644
index 0000000000..6b7a50be39
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/modff/test1/test1.c
@@ -0,0 +1,135 @@
+// Licensed to the .NET Foundation under one or more 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 (modf)
+**
+** Purpose: Test to ensure that modf 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 sqrt(-1.0)
+#define PAL_POSINF -log(0.0)
+#define PAL_NEGINF log(0.0)
+
+/**
+ * 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 */
+ float expected_intpart; /* expected result */
+ float variance_intpart; /* maximum delta between the expected and actual result */
+};
+
+/**
+ * validate
+ *
+ * test validation function
+ */
+void __cdecl validate(float value, float expected, float variance, float expected_intpart, float variance_intpart)
+{
+ float result_intpart;
+ float result = modff(value, &result_intpart);
+
+ /*
+ * The test is valid when the difference between result
+ * and expected is less than or equal to variance
+ */
+ float delta = fabsf(result - expected);
+ float delta_intpart = fabsf(result_intpart - expected_intpart);
+
+ if ((delta > variance) || (delta_intpart > variance_intpart))
+ {
+ Fail("modff(%g) returned %10.9g with an intpart of %10.9g when it should have returned %10.9g with an intpart of %10.9g",
+ value, result, result_intpart, expected, expected_intpart);
+ }
+}
+
+/**
+ * validate
+ *
+ * test validation function for values returning NaN
+ */
+void __cdecl validate_isnan(float value)
+{
+ float result_intpart;
+ float result = modff(value, &result_intpart);
+
+ if (!_isnan(result) || !_isnan(result_intpart))
+ {
+ Fail("modff(%g) returned %10.9g with an intpart of %10.9g when it should have returned %10.9g with an intpart of %10.9g",
+ value, result, result_intpart, PAL_NAN, PAL_NAN);
+ }
+}
+
+/**
+ * main
+ *
+ * executable entry point
+ */
+int __cdecl main(int argc, char **argv)
+{
+ struct test tests[] =
+ {
+ /* value expected variance expected_intpart variance_intpart */
+ { 0, 0, PAL_EPSILON, 0, PAL_EPSILON },
+ { 0.318309886f, 0.318309886f, PAL_EPSILON, 0, PAL_EPSILON }, // value: 1 / pi
+ { 0.434294482f, 0.434294482f, PAL_EPSILON, 0, PAL_EPSILON }, // value: log10(e)
+ { 0.636619772f, 0.636619772f, PAL_EPSILON, 0, PAL_EPSILON }, // value: 2 / pi
+ { 0.693147181f, 0.693147181f, PAL_EPSILON, 0, PAL_EPSILON }, // value: ln(2)
+ { 0.707106781f, 0.707106781f, PAL_EPSILON, 0, PAL_EPSILON }, // value: 1 / sqrt(2)
+ { 0.785398163f, 0.785398163f, PAL_EPSILON, 0, PAL_EPSILON }, // value: pi / 4
+ { 1, 0, PAL_EPSILON, 1, PAL_EPSILON * 10 },
+ { 1.12837917f, 0.128379167f, PAL_EPSILON, 1, PAL_EPSILON * 10 }, // value: 2 / sqrt(pi)
+ { 1.41421356f, 0.414213562f, PAL_EPSILON, 1, PAL_EPSILON * 10 }, // value: sqrt(2)
+ { 1.44269504f, 0.442695041f, PAL_EPSILON, 1, PAL_EPSILON * 10 }, // value: log2(e)
+ { 1.57079633f, 0.570796327f, PAL_EPSILON, 1, PAL_EPSILON * 10 }, // value: pi / 2
+ { 2.30258509f, 0.302585093f, PAL_EPSILON, 2, PAL_EPSILON * 10 }, // value: ln(10)
+ { 2.71828183f, 0.718281828f, PAL_EPSILON, 2, PAL_EPSILON * 10 }, // value: e
+ { 3.14159265f, 0.141592654f, PAL_EPSILON, 3, PAL_EPSILON * 10 }, // value: pi
+ { PAL_POSINF, 0, PAL_EPSILON, 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, tests[i].expected_intpart, tests[i].variance_intpart);
+ validate(-tests[i].value, -tests[i].expected, tests[i].variance, -tests[i].expected_intpart, tests[i].variance_intpart);
+ }
+
+ validate_isnan(PAL_NAN);
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/modff/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/modff/test1/testinfo.dat
new file mode 100644
index 0000000000..392491e3be
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/modff/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 = modff
+Name = Positive Test for modff
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Passes to modff() a series of values, checking that
+= each one return to correct value.
diff --git a/src/pal/tests/palsuite/c_runtime/pow/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/pow/CMakeLists.txt
new file mode 100644
index 0000000000..5e1ef7f28b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/pow/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/pow/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/pow/test1/CMakeLists.txt
new file mode 100644
index 0000000000..69ba02af17
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/pow/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_pow_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_pow_test1 coreclrpal)
+
+target_link_libraries(paltest_pow_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/pow/test1/test1.c b/src/pal/tests/palsuite/c_runtime/pow/test1/test1.c
new file mode 100644
index 0000000000..0a05cd5a47
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/pow/test1/test1.c
@@ -0,0 +1,230 @@
+// Licensed to the .NET Foundation under one or more 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 atan2 returns correct values for a subset of values.
+** Tests with positive and negative values of x and y to ensure
+** atan2 is returning results from the correct quadrant.
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+// binary64 (double) has a machine epsilon of 2^-52 (approx. 2.22e-16). However, this
+// is slightly too accurate when writing tests meant to run against libm implementations
+// for various platforms. 2^-50 (approx. 8.88e-16) 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 (15-17 digits).
+
+// For example, a test with an expect result in the format of 0.xxxxxxxxxxxxxxxxx will use
+// PAL_EPSILON for the variance, while an expected result in the format of 0.0xxxxxxxxxxxxxxxxx
+// will use PAL_EPSILON / 10 and and expected result in the format of x.xxxxxxxxxxxxxxxx will
+// use PAL_EPSILON * 10.
+#define PAL_EPSILON 8.8817841970012523e-16
+
+#define PAL_NAN sqrt(-1.0)
+#define PAL_POSINF -log(0.0)
+#define PAL_NEGINF log(0.0)
+
+/**
+ * Helper test structure
+ */
+struct test
+{
+ double x; /* first component of the value to test the function with */
+ double y; /* second component of the value to test the function with */
+ double expected; /* expected result */
+ double variance; /* maximum delta between the expected and actual result */
+};
+
+/**
+ * validate
+ *
+ * test validation function
+ */
+void __cdecl validate(double x, double y, double expected, double variance)
+{
+ double result = pow(x, y);
+
+ /*
+ * The test is valid when the difference between result
+ * and expected is less than or equal to variance
+ */
+ double delta = fabs(result - expected);
+
+ if (delta > variance)
+ {
+ Fail("pow(%g, %g) returned %20.17g when it should have returned %20.17g",
+ x, y, result, expected);
+ }
+}
+
+/**
+ * validate
+ *
+ * test validation function for values returning NaN
+ */
+void __cdecl validate_isnan(double x, double y)
+{
+ double result = pow(x, y);
+
+ if (!_isnan(result))
+ {
+ Fail("pow(%g, %g) returned %20.17g when it should have returned %20.17g",
+ 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.1, PAL_EPSILON },
+ { -10, 0, 1, PAL_EPSILON * 10 },
+ { -10, 1, -10, PAL_EPSILON * 100 },
+ { -10, PAL_POSINF, PAL_POSINF, 0 },
+
+ { -2.7182818284590452, PAL_NEGINF, 0, PAL_EPSILON }, // x: -(e)
+ { -2.7182818284590452, -1, -0.36787944117144232, PAL_EPSILON }, // x: -(e)
+ { -2.7182818284590452, 0, 1, PAL_EPSILON * 10 }, // x: -(e)
+ { -2.7182818284590452, 1, -2.7182818284590452, PAL_EPSILON * 10 }, // x: -(e) expected: e
+ { -2.7182818284590452, PAL_POSINF, PAL_POSINF, 0 }, // x: -(e)
+
+ { -0.0, PAL_NEGINF, PAL_POSINF, 0 },
+ { -0.0, -1, PAL_NEGINF, 0 },
+ { -0.0, -0.0, 1, PAL_EPSILON * 10 },
+ { -0.0, 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.0, 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.7182818284590452, PAL_NEGINF, 0, PAL_EPSILON },
+ { 2.7182818284590452, -3.1415926535897932, 0.043213918263772250, PAL_EPSILON / 10 }, // x: e y: -(pi)
+ { 2.7182818284590452, -2.7182818284590452, 0.065988035845312537, PAL_EPSILON / 10 }, // x: e y: -(e)
+ { 2.7182818284590452, -2.3025850929940457, 0.1, PAL_EPSILON }, // x: e y: -(ln(10))
+ { 2.7182818284590452, -1.5707963267948966, 0.20787957635076191, PAL_EPSILON }, // x: e y: -(pi / 2)
+ { 2.7182818284590452, -1.4426950408889634, 0.23629008834452270, PAL_EPSILON }, // x: e y: -(log2(e))
+ { 2.7182818284590452, -1.4142135623730950, 0.24311673443421421, PAL_EPSILON }, // x: e y: -(sqrt(2))
+ { 2.7182818284590452, -1.1283791670955126, 0.32355726390307110, PAL_EPSILON }, // x: e y: -(2 / sqrt(pi))
+ { 2.7182818284590452, -1, 0.36787944117144232, PAL_EPSILON }, // x: e y: -(1)
+ { 2.7182818284590452, -0.78539816339744831, 0.45593812776599624, PAL_EPSILON }, // x: e y: -(pi / 4)
+ { 2.7182818284590452, -0.70710678118654752, 0.49306869139523979, PAL_EPSILON }, // x: e y: -(1 / sqrt(2))
+ { 2.7182818284590452, -0.69314718055994531, 0.5, PAL_EPSILON }, // x: e y: -(ln(2))
+ { 2.7182818284590452, -0.63661977236758134, 0.52907780826773535, PAL_EPSILON }, // x: e y: -(2 / pi)
+ { 2.7182818284590452, -0.43429448190325183, 0.64772148514180065, PAL_EPSILON }, // x: e y: -(log10(e))
+ { 2.7182818284590452, -0.31830988618379067, 0.72737734929521647, PAL_EPSILON }, // x: e y: -(1 / pi)
+ { 2.7182818284590452, 0, 1, PAL_EPSILON * 10 }, // x: e
+ { 2.7182818284590452, 0.31830988618379067, 1.3748022274393586, PAL_EPSILON * 10 }, // x: e y: 1 / pi
+ { 2.7182818284590452, 0.43429448190325183, 1.5438734439711811, PAL_EPSILON * 10 }, // x: e y: log10(e)
+ { 2.7182818284590452, 0.63661977236758134, 1.8900811645722220, PAL_EPSILON * 10 }, // x: e y: 2 / pi
+ { 2.7182818284590452, 0.69314718055994531, 2, PAL_EPSILON * 10 }, // x: e y: ln(2)
+ { 2.7182818284590452, 0.70710678118654752, 2.0281149816474725, PAL_EPSILON * 10 }, // x: e y: 1 / sqrt(2)
+ { 2.7182818284590452, 0.78539816339744831, 2.1932800507380155, PAL_EPSILON * 10 }, // x: e y: pi / 4
+ { 2.7182818284590452, 1, 2.7182818284590452, PAL_EPSILON * 10 }, // x: e expected: e
+ { 2.7182818284590452, 1.1283791670955126, 3.0906430223107976, PAL_EPSILON * 10 }, // x: e y: 2 / sqrt(pi)
+ { 2.7182818284590452, 1.4142135623730950, 4.1132503787829275, PAL_EPSILON * 10 }, // x: e y: sqrt(2)
+ { 2.7182818284590452, 1.4426950408889634, 4.2320861065570819, PAL_EPSILON * 10 }, // x: e y: log2(e)
+ { 2.7182818284590452, 1.5707963267948966, 4.8104773809653517, PAL_EPSILON * 10 }, // x: e y: pi / 2
+ { 2.7182818284590452, 2.3025850929940457, 10, PAL_EPSILON * 100 }, // x: e y: ln(10)
+ { 2.7182818284590452, 2.7182818284590452, 15.154262241479264, PAL_EPSILON * 100 }, // x: e y: e
+ { 2.7182818284590452, 3.1415926535897932, 23.140692632779269, PAL_EPSILON * 100 }, // x: e y: pi
+ { 2.7182818284590452, PAL_POSINF, PAL_POSINF, 0 }, // x: e
+
+ { 10, PAL_NEGINF, 0, 0 },
+ { 10, -3.1415926535897932, 0.00072178415907472774, PAL_EPSILON / 1000 }, // y: -(pi)
+ { 10, -2.7182818284590452, 0.0019130141022243176, PAL_EPSILON / 100 }, // y: -(e)
+ { 10, -2.3025850929940457, 0.0049821282964407206, PAL_EPSILON / 100 }, // y: -(ln(10))
+ { 10, -1.5707963267948966, 0.026866041001136132, PAL_EPSILON / 10 }, // y: -(pi / 2)
+ { 10, -1.4426950408889634, 0.036083192820787210, PAL_EPSILON / 10 }, // y: -(log2(e))
+ { 10, -1.4142135623730950, 0.038528884700322026, PAL_EPSILON / 10 }, // y: -(sqrt(2))
+ { 10, -1.1283791670955126, 0.074408205860642723, PAL_EPSILON / 10 }, // y: -(2 / sqrt(pi))
+ { 10, -1, 0.1, PAL_EPSILON }, // y: -(1)
+ { 10, -0.78539816339744831, 0.16390863613957665, PAL_EPSILON }, // y: -(pi / 4)
+ { 10, -0.70710678118654752, 0.19628775993505562, PAL_EPSILON }, // y: -(1 / sqrt(2))
+ { 10, -0.69314718055994531, 0.20269956628651730, PAL_EPSILON }, // y: -(ln(2))
+ { 10, -0.63661977236758134, 0.23087676451600055, PAL_EPSILON }, // y: -(2 / pi)
+ { 10, -0.43429448190325183, 0.36787944117144232, PAL_EPSILON }, // y: -(log10(e))
+ { 10, -0.31830988618379067, 0.48049637305186868, PAL_EPSILON }, // y: -(1 / pi)
+ { 10, 0, 1, PAL_EPSILON * 10 },
+ { 10, 0.31830988618379067, 2.0811811619898573, PAL_EPSILON * 10 }, // y: 1 / pi
+ { 10, 0.43429448190325183, 2.7182818284590452, PAL_EPSILON * 10 }, // y: log10(e) expected: e
+ { 10, 0.63661977236758134, 4.3313150290214525, PAL_EPSILON * 10 }, // y: 2 / pi
+ { 10, 0.69314718055994531, 4.9334096679145963, PAL_EPSILON * 10 }, // y: ln(2)
+ { 10, 0.70710678118654752, 5.0945611704512962, PAL_EPSILON * 10 }, // y: 1 / sqrt(2)
+ { 10, 0.78539816339744831, 6.1009598002416937, PAL_EPSILON * 10 }, // y: pi / 4
+ { 10, 1, 10, PAL_EPSILON * 100 },
+ { 10, 1.1283791670955126, 13.439377934644400, PAL_EPSILON * 100 }, // y: 2 / sqrt(pi)
+ { 10, 1.4142135623730950, 25.954553519470081, PAL_EPSILON * 100 }, // y: sqrt(2)
+ { 10, 1.4426950408889634, 27.713733786437790, PAL_EPSILON * 100 }, // y: log2(e)
+ { 10, 1.5707963267948966, 37.221710484165167, PAL_EPSILON * 100 }, // y: pi / 2
+ { 10, 2.3025850929940457, 200.71743249053009, PAL_EPSILON * 1000 }, // y: ln(10)
+ { 10, 2.7182818284590452, 522.73529967043665, PAL_EPSILON * 1000 }, // y: e
+ { 10, 3.1415926535897932, 1385.4557313670111, 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.5707963267948966); // y: -(pi / 2)
+ validate_isnan(-10, -0.78539816339744828); // y: -(pi / 4)
+ validate_isnan(-10, 0.78539816339744828); // y: pi / 4
+ validate_isnan(-10, 1.5707963267948966); // y: pi / 2
+
+ validate_isnan(-2.7182818284590452, -1.5707963267948966); // x: -(e) y: -(pi / 2)
+ validate_isnan(-2.7182818284590452, -0.78539816339744828); // x: -(e) y: -(pi / 4)
+ validate_isnan(-2.7182818284590452, 0.78539816339744828); // x: -(e) y: pi / 4
+ validate_isnan(-2.7182818284590452, 1.5707963267948966); // 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/pow/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/pow/test1/testinfo.dat
new file mode 100644
index 0000000000..cf106d90ed
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/pow/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 = pow
+Name = Call pow with some std input/output.
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Call the pow function with various num/exponent pairs
+= that should produce std answers.
+
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/printf/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/printf/CMakeLists.txt
new file mode 100644
index 0000000000..cafb9536b0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/CMakeLists.txt
@@ -0,0 +1,22 @@
+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/printf/printf.h b/src/pal/tests/palsuite/c_runtime/printf/printf.h
new file mode 100644
index 0000000000..2eaa984bad
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/printf.h
@@ -0,0 +1,182 @@
+// Licensed to the .NET Foundation under one or more 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: printf.h
+**
+** Purpose: Containts common testing functions for printf
+**
+**
+**==========================================================================*/
+
+#ifndef __printf_H__
+#define __printf_H__
+
+void DoStrTest(char *formatstr, char* param, char *checkstr)
+{
+ int ret;
+
+ ret = printf(formatstr, param);
+ if (ret != strlen(checkstr))
+ {
+ Fail("Expected printf to return %d, got %d.\n",
+ strlen(checkstr), ret);
+ }
+}
+
+void DoWStrTest(char *formatstr, WCHAR* param, char *checkstr)
+{
+ int ret;
+
+ ret = printf(formatstr, param);
+ if (ret != strlen(checkstr))
+ {
+ Fail("Expected printf to return %d, got %d.\n",
+ strlen(checkstr), ret);
+ }
+}
+
+void DoPointerTest(char *formatstr, void* param, char* paramstr,
+ char *checkstr1)
+{
+ int ret;
+
+ ret = printf(formatstr, param);
+ if (ret != strlen(checkstr1))
+ {
+ Fail("Expected printf to return %d, got %d.\n",
+ strlen(checkstr1), ret);
+ }
+}
+
+void DoCountTest(char *formatstr, int param, char *checkstr)
+{
+ int ret;
+ int n = -1;
+
+ ret = printf(formatstr, &n);
+
+ if (n != param)
+ {
+ Fail("Expected count parameter to resolve to %d, got %d\n", param, n);
+ }
+
+ if (ret != strlen(checkstr))
+ {
+ Fail("Expected printf to return %d, got %d.\n",
+ strlen(checkstr), ret);
+ }
+}
+
+void DoShortCountTest(char *formatstr, int param, char *checkstr)
+{
+ int ret;
+ short int n = -1;
+
+ ret = printf(formatstr, &n);
+
+ if (n != param)
+ {
+ Fail("Expected count parameter to resolve to %d, got %d\n", param, n);
+ }
+
+ if (ret != strlen(checkstr))
+ {
+ Fail("Expected printf to return %d, got %d.\n",
+ strlen(checkstr), ret);
+ }
+}
+
+
+void DoCharTest(char *formatstr, char param, char *checkstr)
+{
+ int ret;
+
+ ret = printf(formatstr, param);
+ if (ret != strlen(checkstr))
+ {
+ Fail("Expected printf to return %d, got %d.\n",
+ strlen(checkstr), ret);
+ }
+}
+
+void DoWCharTest(char *formatstr, WCHAR param, char *checkstr)
+{
+ int ret;
+
+ ret = printf(formatstr, param);
+ if (ret != strlen(checkstr))
+ {
+ Fail("Expected printf to return %d, got %d.\n",
+ strlen(checkstr), ret);
+ }
+}
+
+void DoNumTest(char *formatstr, int param, char *checkstr)
+{
+ int ret;
+
+ ret = printf(formatstr, param);
+ if (ret != strlen(checkstr))
+ {
+ Fail("Expected printf to return %d, got %d.\n",
+ strlen(checkstr), ret);
+ }
+}
+
+void DoI64Test(char *formatstr, INT64 param, char *valuestr,
+ char *checkstr1)
+{
+ int ret;
+
+ ret = printf(formatstr, param);
+ if (ret != strlen(checkstr1))
+ {
+ Fail("Expected printf to return %d, got %d.\n",
+ strlen(checkstr1), ret);
+ }
+}
+
+void DoDoubleTest(char *formatstr, double param,
+ char *checkstr1, char *checkstr2)
+{
+ int ret;
+
+ ret = printf(formatstr, param);
+ if (ret != strlen(checkstr1) && ret != strlen(checkstr2))
+ {
+ Fail("Expected printf to return %d or %d, got %d.\n",
+ strlen(checkstr1), strlen(checkstr2), ret);
+ }
+}
+
+void DoArgumentPrecTest(char *formatstr, int precision, void *param,
+ char *paramstr, char *checkstr1, char *checkstr2)
+{
+ int ret;
+
+ ret = printf(formatstr, precision, param);
+ if (ret != strlen(checkstr1) && ret != strlen(checkstr2))
+ {
+ Fail("Expected printf to return %d or %d, got %d.\n",
+ strlen(checkstr1), strlen(checkstr2), ret);
+ }
+}
+
+void DoArgumentPrecDoubleTest(char *formatstr, int precision, double param,
+ char *checkstr1, char *checkstr2)
+{
+ int ret;
+
+ ret = printf(formatstr, precision, param);
+ if (ret != strlen(checkstr1) && ret != strlen(checkstr2))
+ {
+ Fail("Expected printf to return %d or %d, got %d.\n",
+ strlen(checkstr1), strlen(checkstr2), ret);
+ }
+}
+
+#endif
+
diff --git a/src/pal/tests/palsuite/c_runtime/printf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/printf/test1/CMakeLists.txt
new file mode 100644
index 0000000000..bea9151ed7
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/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_printf_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_printf_test1 coreclrpal)
+
+target_link_libraries(paltest_printf_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/printf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/printf/test1/test1.c
new file mode 100644
index 0000000000..31b7014343
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/test1/test1.c
@@ -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: test1.c
+**
+** Purpose: Test #1 for the printf function. A single, basic, test
+** case with no formatting.
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../printf.h"
+
+int __cdecl main(int argc, char *argv[])
+{
+ char checkstr[] = "hello world";
+ int ret;
+
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ ret = printf("hello world");
+
+ if (ret != strlen(checkstr))
+ {
+ Fail("Expected printf to return %d, got %d.\n",
+ strlen(checkstr), ret);
+
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
+
diff --git a/src/pal/tests/palsuite/c_runtime/printf/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/printf/test1/testinfo.dat
new file mode 100644
index 0000000000..fe8bee680e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/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 = printf
+Name = Positive Test for printf
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= General test to see if printf works correctly
diff --git a/src/pal/tests/palsuite/c_runtime/printf/test10/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/printf/test10/CMakeLists.txt
new file mode 100644
index 0000000000..89ff2e0190
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/test10/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test10.c
+)
+
+add_executable(paltest_printf_test10
+ ${SOURCES}
+)
+
+add_dependencies(paltest_printf_test10 coreclrpal)
+
+target_link_libraries(paltest_printf_test10
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/printf/test10/test10.c b/src/pal/tests/palsuite/c_runtime/printf/test10/test10.c
new file mode 100644
index 0000000000..5e69175b07
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/test10/test10.c
@@ -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: test10.c
+**
+** Purpose: Test #10 for the printf function. Tests the octal specifier
+** (%o).
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../printf.h"
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ int neg = -42;
+ int pos = 42;
+ INT64 l = 42;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ 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/printf/test10/testinfo.dat b/src/pal/tests/palsuite/c_runtime/printf/test10/testinfo.dat
new file mode 100644
index 0000000000..7667a0f461
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/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 = printf
+Name = Positive Test for printf
+TYPE = DEFAULT
+EXE1 = test10
+Description
+= Tests printf with octal numbers
diff --git a/src/pal/tests/palsuite/c_runtime/printf/test11/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/printf/test11/CMakeLists.txt
new file mode 100644
index 0000000000..349f154a8d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/test11/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test11.c
+)
+
+add_executable(paltest_printf_test11
+ ${SOURCES}
+)
+
+add_dependencies(paltest_printf_test11 coreclrpal)
+
+target_link_libraries(paltest_printf_test11
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/printf/test11/test11.c b/src/pal/tests/palsuite/c_runtime/printf/test11/test11.c
new file mode 100644
index 0000000000..788be8b2db
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/test11/test11.c
@@ -0,0 +1,51 @@
+// Licensed to the .NET Foundation under one or more 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 printf function. Test the unsigned int
+** specifier (%u).
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../printf.h"
+
+int __cdecl main(int argc, char *argv[])
+{
+ int neg = -42;
+ int pos = 42;
+ INT64 l = 42;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ 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/printf/test11/testinfo.dat b/src/pal/tests/palsuite/c_runtime/printf/test11/testinfo.dat
new file mode 100644
index 0000000000..a88e0d8fcb
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/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 = printf
+Name = Positive Test for printf
+TYPE = DEFAULT
+EXE1 = test11
+Description
+= Tests printf with unsigned numbers
diff --git a/src/pal/tests/palsuite/c_runtime/printf/test12/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/printf/test12/CMakeLists.txt
new file mode 100644
index 0000000000..0d32ee1690
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/test12/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test12.c
+)
+
+add_executable(paltest_printf_test12
+ ${SOURCES}
+)
+
+add_dependencies(paltest_printf_test12 coreclrpal)
+
+target_link_libraries(paltest_printf_test12
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/printf/test12/test12.c b/src/pal/tests/palsuite/c_runtime/printf/test12/test12.c
new file mode 100644
index 0000000000..b4006f2405
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/test12/test12.c
@@ -0,0 +1,53 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*============================================================================
+**
+** Source: test12.c
+**
+** Purpose: Test #12 for the printf function. Tests the (lowercase)
+** hexadecimal specifier (%x)
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../printf.h"
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ int neg = -42;
+ int pos = 0x1234ab;
+ INT64 l = I64(0x1234567887654321);
+
+ if (PAL_Initialize(argc, argv))
+ {
+ 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/printf/test12/testinfo.dat b/src/pal/tests/palsuite/c_runtime/printf/test12/testinfo.dat
new file mode 100644
index 0000000000..a6e317f905
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/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 = printf
+Name = Positive Test for printf
+TYPE = DEFAULT
+EXE1 = test12
+Description
+= Tests printf with hex numbers (lowercase)
diff --git a/src/pal/tests/palsuite/c_runtime/printf/test13/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/printf/test13/CMakeLists.txt
new file mode 100644
index 0000000000..348d25b22d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/test13/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test13.c
+)
+
+add_executable(paltest_printf_test13
+ ${SOURCES}
+)
+
+add_dependencies(paltest_printf_test13 coreclrpal)
+
+target_link_libraries(paltest_printf_test13
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/printf/test13/test13.c b/src/pal/tests/palsuite/c_runtime/printf/test13/test13.c
new file mode 100644
index 0000000000..ccd16b50d2
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/test13/test13.c
@@ -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: Test #13 for the printf function. Tests the (uppercase)
+** hexadecimal specifier (%X)
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../printf.h"
+
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ int neg = -42;
+ int pos = 0x1234AB;
+ INT64 l = I64(0x1234567887654321);
+
+ if (PAL_Initialize(argc, argv))
+ {
+ 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/printf/test13/testinfo.dat b/src/pal/tests/palsuite/c_runtime/printf/test13/testinfo.dat
new file mode 100644
index 0000000000..e814040b37
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/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 = printf
+Name = Positive Test for printf
+TYPE = DEFAULT
+EXE1 = test13
+Description
+= Tests printf with hex numbers (uppercase)
diff --git a/src/pal/tests/palsuite/c_runtime/printf/test14/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/printf/test14/CMakeLists.txt
new file mode 100644
index 0000000000..659ea78cc6
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/test14/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test14.c
+)
+
+add_executable(paltest_printf_test14
+ ${SOURCES}
+)
+
+add_dependencies(paltest_printf_test14 coreclrpal)
+
+target_link_libraries(paltest_printf_test14
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/printf/test14/test14.c b/src/pal/tests/palsuite/c_runtime/printf/test14/test14.c
new file mode 100644
index 0000000000..10577db67d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/test14/test14.c
@@ -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: test14.c
+**
+** Purpose: Test #14 for the printf function. Tests the lowercase
+** exponential notation double specifier (%e)
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../printf.h"
+
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ double val = 256.0;
+ double neg = -256.0;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ 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/printf/test14/testinfo.dat b/src/pal/tests/palsuite/c_runtime/printf/test14/testinfo.dat
new file mode 100644
index 0000000000..5cb22c1fcc
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/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 = printf
+Name = Positive Test for printf
+TYPE = DEFAULT
+EXE1 = test14
+Description
+= Tests printf with exponential format doubles (lowercase)
diff --git a/src/pal/tests/palsuite/c_runtime/printf/test15/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/printf/test15/CMakeLists.txt
new file mode 100644
index 0000000000..9e4e310304
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/test15/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test15.c
+)
+
+add_executable(paltest_printf_test15
+ ${SOURCES}
+)
+
+add_dependencies(paltest_printf_test15 coreclrpal)
+
+target_link_libraries(paltest_printf_test15
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/printf/test15/test15.c b/src/pal/tests/palsuite/c_runtime/printf/test15/test15.c
new file mode 100644
index 0000000000..2acfc436a3
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/test15/test15.c
@@ -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: test15.c
+**
+** Purpose: Test #15 for the printf function. Tests the uppercase
+** exponential notation double specifier (%E)
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../printf.h"
+
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ double val = 256.0;
+ double neg = -256.0;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ 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/printf/test15/testinfo.dat b/src/pal/tests/palsuite/c_runtime/printf/test15/testinfo.dat
new file mode 100644
index 0000000000..bdfa2cc3b5
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/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 = printf
+Name = Positive Test for printf
+TYPE = DEFAULT
+EXE1 = test15
+Description
+= Tests printf with exponential format doubles (uppercase)
diff --git a/src/pal/tests/palsuite/c_runtime/printf/test16/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/printf/test16/CMakeLists.txt
new file mode 100644
index 0000000000..7e477a3059
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/test16/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test16.c
+)
+
+add_executable(paltest_printf_test16
+ ${SOURCES}
+)
+
+add_dependencies(paltest_printf_test16 coreclrpal)
+
+target_link_libraries(paltest_printf_test16
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/printf/test16/test16.c b/src/pal/tests/palsuite/c_runtime/printf/test16/test16.c
new file mode 100644
index 0000000000..50c952f959
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/test16/test16.c
@@ -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: test16.c
+**
+** Purpose: Test #16 for the printf function. Tests the decimal notation
+** double specifier (%f)
+**
+**
+**==========================================================================*/
+
+
+#include <palsuite.h>
+#include "../printf.h"
+
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ double val = 2560.001;
+ double neg = -2560.001;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ 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/printf/test16/testinfo.dat b/src/pal/tests/palsuite/c_runtime/printf/test16/testinfo.dat
new file mode 100644
index 0000000000..afb9a21b3b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/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 = printf
+Name = Positive Test for printf
+TYPE = DEFAULT
+EXE1 = test16
+Description
+= Tests printf with decimal point format doubles
diff --git a/src/pal/tests/palsuite/c_runtime/printf/test17/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/printf/test17/CMakeLists.txt
new file mode 100644
index 0000000000..c18450c2aa
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/test17/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test17.c
+)
+
+add_executable(paltest_printf_test17
+ ${SOURCES}
+)
+
+add_dependencies(paltest_printf_test17 coreclrpal)
+
+target_link_libraries(paltest_printf_test17
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/printf/test17/test17.c b/src/pal/tests/palsuite/c_runtime/printf/test17/test17.c
new file mode 100644
index 0000000000..96ddd5c1e4
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/test17/test17.c
@@ -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: test17.c
+**
+** Purpose: Test #17 for the printf function. Tests the lowercase
+** shorthand notation double specifier (%g)
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../printf.h"
+
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ double val = 2560.001;
+ double neg = -2560.001;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ 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/printf/test17/testinfo.dat b/src/pal/tests/palsuite/c_runtime/printf/test17/testinfo.dat
new file mode 100644
index 0000000000..a8545d9542
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/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 = printf
+Name = Positive Test for printf
+TYPE = DEFAULT
+EXE1 = test17
+Description
+= Tests printf with compact format doubles (lowercase)
diff --git a/src/pal/tests/palsuite/c_runtime/printf/test18/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/printf/test18/CMakeLists.txt
new file mode 100644
index 0000000000..b0468314a3
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/test18/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test18.c
+)
+
+add_executable(paltest_printf_test18
+ ${SOURCES}
+)
+
+add_dependencies(paltest_printf_test18 coreclrpal)
+
+target_link_libraries(paltest_printf_test18
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/printf/test18/test18.c b/src/pal/tests/palsuite/c_runtime/printf/test18/test18.c
new file mode 100644
index 0000000000..6c05e40f42
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/test18/test18.c
@@ -0,0 +1,51 @@
+// Licensed to the .NET Foundation under one or more 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 printf function. Tests the uppercase
+** shorthand notation double specifier (%G)
+**
+**
+**==========================================================================*/
+
+
+#include <palsuite.h>
+#include "../printf.h"
+
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ double val = 2560.001;
+ double neg = -2560.001;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ 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/printf/test18/testinfo.dat b/src/pal/tests/palsuite/c_runtime/printf/test18/testinfo.dat
new file mode 100644
index 0000000000..bd5c90b0c3
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/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 = printf
+Name = Positive Test for printf
+TYPE = DEFAULT
+EXE1 = test18
+Description
+= Tests printf with compact format doubles (uppercase)
diff --git a/src/pal/tests/palsuite/c_runtime/printf/test19/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/printf/test19/CMakeLists.txt
new file mode 100644
index 0000000000..efd47563d4
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/test19/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test19.c
+)
+
+add_executable(paltest_printf_test19
+ ${SOURCES}
+)
+
+add_dependencies(paltest_printf_test19 coreclrpal)
+
+target_link_libraries(paltest_printf_test19
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/printf/test19/test19.c b/src/pal/tests/palsuite/c_runtime/printf/test19/test19.c
new file mode 100644
index 0000000000..1e09398f7c
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/test19/test19.c
@@ -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, "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/testinfo.dat b/src/pal/tests/palsuite/c_runtime/printf/test19/testinfo.dat
new file mode 100644
index 0000000000..6ad18f7591
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/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 = printf
+Name = Positive Test for printf
+TYPE = DEFAULT
+EXE1 = test19
+Description
+= Tests printf with argument specified precision
diff --git a/src/pal/tests/palsuite/c_runtime/printf/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/printf/test2/CMakeLists.txt
new file mode 100644
index 0000000000..c303a69134
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/test2/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test2.c
+)
+
+add_executable(paltest_printf_test2
+ ${SOURCES}
+)
+
+add_dependencies(paltest_printf_test2 coreclrpal)
+
+target_link_libraries(paltest_printf_test2
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/printf/test2/test2.c b/src/pal/tests/palsuite/c_runtime/printf/test2/test2.c
new file mode 100644
index 0000000000..e766ef4a90
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/test2/test2.c
@@ -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: test2.c
+**
+** Purpose: Test #2 for the printf function. Tests the string specifier
+** (%s).
+**
+**
+**==========================================================================*/
+
+
+#include <palsuite.h>
+#include "../printf.h"
+
+
+
+int __cdecl main(int argc, char *argv[])
+{
+
+ if (PAL_Initialize(argc, argv))
+ {
+ 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/printf/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/printf/test2/testinfo.dat
new file mode 100644
index 0000000000..3ff71c7496
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/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 = printf
+Name = Positive Test for printf
+TYPE = DEFAULT
+EXE1 = test2
+Description
+= Tests printf with strings
diff --git a/src/pal/tests/palsuite/c_runtime/printf/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/printf/test3/CMakeLists.txt
new file mode 100644
index 0000000000..8bc7479797
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/test3/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test3.c
+)
+
+add_executable(paltest_printf_test3
+ ${SOURCES}
+)
+
+add_dependencies(paltest_printf_test3 coreclrpal)
+
+target_link_libraries(paltest_printf_test3
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/printf/test3/test3.c b/src/pal/tests/palsuite/c_runtime/printf/test3/test3.c
new file mode 100644
index 0000000000..5cc530948c
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/test3/test3.c
@@ -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: Test #3 for the printf function. Tests the wide string
+** specifier (%S).
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../printf.h"
+
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ if (PAL_Initialize(argc, argv))
+ {
+ 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/printf/test3/testinfo.dat b/src/pal/tests/palsuite/c_runtime/printf/test3/testinfo.dat
new file mode 100644
index 0000000000..295c172f09
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/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 = printf
+Name = Positive Test for printf
+TYPE = DEFAULT
+EXE1 = test3
+Description
+= Tests printf with wide strings
diff --git a/src/pal/tests/palsuite/c_runtime/printf/test4/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/printf/test4/CMakeLists.txt
new file mode 100644
index 0000000000..55e5700fe3
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/test4/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test4.c
+)
+
+add_executable(paltest_printf_test4
+ ${SOURCES}
+)
+
+add_dependencies(paltest_printf_test4 coreclrpal)
+
+target_link_libraries(paltest_printf_test4
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/printf/test4/test4.c b/src/pal/tests/palsuite/c_runtime/printf/test4/test4.c
new file mode 100644
index 0000000000..bcdc201d4f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/test4/test4.c
@@ -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: test4.c
+**
+** Purpose: Test #4 for the printf function. Tests the pointer
+** specifier (%p).
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../printf.h"
+
+int __cdecl main(int argc, char *argv[])
+{
+ void *ptr = (void*) 0x123456;
+ INT64 lptr = I64(0x1234567887654321);
+
+ if (PAL_Initialize(argc, argv))
+ {
+ 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/printf/test4/testinfo.dat b/src/pal/tests/palsuite/c_runtime/printf/test4/testinfo.dat
new file mode 100644
index 0000000000..0c55e0ed39
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/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 = printf
+Name = Positive Test for printf
+TYPE = DEFAULT
+EXE1 = test4
+Description
+= Tests printf with pointers
diff --git a/src/pal/tests/palsuite/c_runtime/printf/test5/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/printf/test5/CMakeLists.txt
new file mode 100644
index 0000000000..d091bca2dc
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/test5/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test5.c
+)
+
+add_executable(paltest_printf_test5
+ ${SOURCES}
+)
+
+add_dependencies(paltest_printf_test5 coreclrpal)
+
+target_link_libraries(paltest_printf_test5
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/printf/test5/test5.c b/src/pal/tests/palsuite/c_runtime/printf/test5/test5.c
new file mode 100644
index 0000000000..9f8baa74da
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/test5/test5.c
@@ -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: test5.c
+**
+** Purpose: Test #5 for the printf function. Tests the count specifier (%n).
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../printf.h"
+
+
+
+
+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))
+ {
+ 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/printf/test5/testinfo.dat b/src/pal/tests/palsuite/c_runtime/printf/test5/testinfo.dat
new file mode 100644
index 0000000000..a7c7400f58
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/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 = printf
+Name = Positive Test for printf
+TYPE = DEFAULT
+EXE1 = test5
+Description
+= Tests printf with the count specifier
diff --git a/src/pal/tests/palsuite/c_runtime/printf/test6/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/printf/test6/CMakeLists.txt
new file mode 100644
index 0000000000..c004e353e9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/test6/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test6.c
+)
+
+add_executable(paltest_printf_test6
+ ${SOURCES}
+)
+
+add_dependencies(paltest_printf_test6 coreclrpal)
+
+target_link_libraries(paltest_printf_test6
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/printf/test6/test6.c b/src/pal/tests/palsuite/c_runtime/printf/test6/test6.c
new file mode 100644
index 0000000000..edc65b6b9b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/test6/test6.c
@@ -0,0 +1,48 @@
+// Licensed to the .NET Foundation under one or more 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 printf function. Tests the char specifier (%c).
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../printf.h"
+
+
+
+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/printf/test6/testinfo.dat b/src/pal/tests/palsuite/c_runtime/printf/test6/testinfo.dat
new file mode 100644
index 0000000000..fd8a985291
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/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 = printf
+Name = Positive Test for printf
+TYPE = DEFAULT
+EXE1 = test6
+Description
+= Tests printf with characters
diff --git a/src/pal/tests/palsuite/c_runtime/printf/test7/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/printf/test7/CMakeLists.txt
new file mode 100644
index 0000000000..ff6b647ccd
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/test7/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test7.c
+)
+
+add_executable(paltest_printf_test7
+ ${SOURCES}
+)
+
+add_dependencies(paltest_printf_test7 coreclrpal)
+
+target_link_libraries(paltest_printf_test7
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/printf/test7/test7.c b/src/pal/tests/palsuite/c_runtime/printf/test7/test7.c
new file mode 100644
index 0000000000..3aeb58f7dc
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/test7/test7.c
@@ -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: Test #7 for the printf function. Tests the wide char
+** specifier (%C).
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../printf.h"
+
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ WCHAR wb = (WCHAR) 'b';
+
+ if (PAL_Initialize(argc, argv))
+ {
+ 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/printf/test7/testinfo.dat b/src/pal/tests/palsuite/c_runtime/printf/test7/testinfo.dat
new file mode 100644
index 0000000000..6d2b1cf84e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/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 = printf
+Name = Positive Test for printf
+TYPE = DEFAULT
+EXE1 = test7
+Description
+= Tests printf with wide characters
diff --git a/src/pal/tests/palsuite/c_runtime/printf/test8/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/printf/test8/CMakeLists.txt
new file mode 100644
index 0000000000..5ee387f5b8
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/test8/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test8.c
+)
+
+add_executable(paltest_printf_test8
+ ${SOURCES}
+)
+
+add_dependencies(paltest_printf_test8 coreclrpal)
+
+target_link_libraries(paltest_printf_test8
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/printf/test8/test8.c b/src/pal/tests/palsuite/c_runtime/printf/test8/test8.c
new file mode 100644
index 0000000000..daa4674b92
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/test8/test8.c
@@ -0,0 +1,53 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*============================================================================
+**
+** Source: test8.c
+**
+** Purpose: Test #8 for the printf function. Tests the decimal
+** specifier (%d).
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../printf.h"
+
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ int neg = -42;
+ int pos = 42;
+ INT64 l = 42;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ 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/printf/test8/testinfo.dat b/src/pal/tests/palsuite/c_runtime/printf/test8/testinfo.dat
new file mode 100644
index 0000000000..6367235aa5
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/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 = printf
+Name = Positive Test for printf
+TYPE = DEFAULT
+EXE1 = test8
+Description
+= Tests printf with decimal numbers
diff --git a/src/pal/tests/palsuite/c_runtime/printf/test9/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/printf/test9/CMakeLists.txt
new file mode 100644
index 0000000000..baf46c1065
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/test9/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test9.c
+)
+
+add_executable(paltest_printf_test9
+ ${SOURCES}
+)
+
+add_dependencies(paltest_printf_test9 coreclrpal)
+
+target_link_libraries(paltest_printf_test9
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/printf/test9/test9.c b/src/pal/tests/palsuite/c_runtime/printf/test9/test9.c
new file mode 100644
index 0000000000..22c60d04f2
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/test9/test9.c
@@ -0,0 +1,53 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*============================================================================
+**
+** Source: test9.c
+**
+** Purpose: Test #9 for the printf function. Tests the integer
+** specifier (%i).
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../printf.h"
+
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ int neg = -42;
+ int pos = 42;
+ INT64 l = 42;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ 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/printf/test9/testinfo.dat b/src/pal/tests/palsuite/c_runtime/printf/test9/testinfo.dat
new file mode 100644
index 0000000000..3208cb44a5
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/printf/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 = printf
+Name = Positive Test for printf
+TYPE = DEFAULT
+EXE1 = test9
+Description
+= Tests printf with integer numbers
diff --git a/src/pal/tests/palsuite/c_runtime/qsort/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/qsort/CMakeLists.txt
new file mode 100644
index 0000000000..ef14ea5352
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/qsort/CMakeLists.txt
@@ -0,0 +1,5 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+add_subdirectory(test2)
+
diff --git a/src/pal/tests/palsuite/c_runtime/qsort/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/qsort/test1/CMakeLists.txt
new file mode 100644
index 0000000000..105a727e91
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/qsort/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_qsort_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_qsort_test1 coreclrpal)
+
+target_link_libraries(paltest_qsort_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/qsort/test1/test1.c b/src/pal/tests/palsuite/c_runtime/qsort/test1/test1.c
new file mode 100644
index 0000000000..c65fb18e68
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/qsort/test1/test1.c
@@ -0,0 +1,48 @@
+// Licensed to the .NET Foundation under one or more 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 qsort to sort a buffer, and verifies that it has done
+** the job correctly.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+int __cdecl charcmp(const void *pa, const void *pb)
+{
+ return memcmp(pa, pb, 1);
+}
+
+int __cdecl main(int argc, char **argv)
+{
+ char before[] = "cgaiehdbjf";
+ const char after[] = "abcdefghij";
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ qsort(before, sizeof(before) - 1, sizeof(char), charcmp);
+
+ if (memcmp(before, after, sizeof(before)) != 0)
+ {
+ Fail("qsort did not correctly sort an array of characters.\n");
+ }
+
+ PAL_Terminate();
+ return PASS;
+
+}
+
+
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/qsort/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/qsort/test1/testinfo.dat
new file mode 100644
index 0000000000..7e3b4b87c3
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/qsort/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 = qsort
+Name = Positive Test for qsort
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Calls qsort to sort a buffer, and verifies that it has done the job correctly.
diff --git a/src/pal/tests/palsuite/c_runtime/qsort/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/qsort/test2/CMakeLists.txt
new file mode 100644
index 0000000000..09e3f6db1e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/qsort/test2/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test2.c
+)
+
+add_executable(paltest_qsort_test2
+ ${SOURCES}
+)
+
+add_dependencies(paltest_qsort_test2 coreclrpal)
+
+target_link_libraries(paltest_qsort_test2
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/qsort/test2/test2.c b/src/pal/tests/palsuite/c_runtime/qsort/test2/test2.c
new file mode 100644
index 0000000000..8110dcd2c2
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/qsort/test2/test2.c
@@ -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: test2.c
+**
+** Purpose: Calls qsort to sort a buffer, and verifies that it has done
+** the job correctly.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+int __cdecl twocharcmp(const void *pa, const void *pb)
+{
+ return memcmp(pa, pb, 2);
+}
+
+int __cdecl main(int argc, char **argv)
+{
+ char before[] = "ccggaaiieehhddbbjjff";
+ const char after[] = "aabbccddeeffgghhiijj";
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ qsort(before, (sizeof(before) - 1) / 2, 2 * sizeof(char), twocharcmp);
+
+ if (memcmp(before, after, sizeof(before)) != 0)
+ {
+ Fail("qsort did not correctly sort an array of 2-character "
+ "buffers.\n");
+ }
+
+ PAL_Terminate();
+ return PASS;
+
+}
+
+
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/qsort/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/qsort/test2/testinfo.dat
new file mode 100644
index 0000000000..35f5f06076
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/qsort/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 = qsort
+Name = Positive Test for qsort
+TYPE = DEFAULT
+EXE1 = test2
+Description
+= Calls qsort to sort a buffer, and verifies that it has done the job correctly.
diff --git a/src/pal/tests/palsuite/c_runtime/rand_srand/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/rand_srand/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/rand_srand/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
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
new file mode 100644
index 0000000000..939914662a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/rand_srand/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_rand_srand_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_rand_srand_test1 coreclrpal)
+
+target_link_libraries(paltest_rand_srand_test1
+ pthread
+ m
+ coreclrpal
+)
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.c
new file mode 100644
index 0000000000..34154cb6d2
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/rand_srand/test1/test1.c
@@ -0,0 +1,100 @@
+// Licensed to the .NET Foundation under one or more 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 srand provide random
+** number to rand. Also make sure that rand result from a
+** srand with seed 1 and no call to srand are the same.
+**
+** Dependencies: PAL_Initialize
+** PAL_Terminate
+** Fail
+** srand()
+**
+
+**
+**===========================================================================*/
+
+#include <palsuite.h>
+
+
+int __cdecl main(int argc, char **argv)
+{
+ int RandNumber[10];
+ int TempRandNumber;
+ int i;
+ int SRAND_SEED;
+ int SRAND_REINIT = 1;
+
+ /*
+ * Initialize the PAL and return FAILURE if this fails
+ */
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ SRAND_SEED = time(NULL);
+
+ /* does not initialize srand and call rand. */
+ for (i=0; i<10; i++)
+ {
+ /* keep the value in a array */
+ RandNumber[i]=rand();
+ if (RandNumber[i] < 0 || RandNumber[i] > RAND_MAX)
+ {
+ Fail("1) ERROR: random generated an invalid value: %d", RandNumber[i]);
+ }
+ }
+
+
+ /* initialize random generator */
+ srand(SRAND_SEED);
+
+
+ /* choose 10 numbers with a different seed.
+ the numbers should be different than
+ those the previously generated one */
+ for(i = 0; i < 10; i++)
+ {
+ TempRandNumber=rand();
+ if (TempRandNumber < 0 || TempRandNumber > RAND_MAX)
+ {
+ Fail("2) ERROR: random generated an invalid value: %d", TempRandNumber);
+ }
+ }
+
+
+
+ /* renitialize the srand with 1 */
+ srand(SRAND_REINIT);
+
+
+
+ /* choose 10 numbers with seed 1,
+ the number should be the same as those we kept in the array. */
+ for( i = 0; i < 10;i++ )
+ {
+ /* pick the random number*/
+ TempRandNumber=rand();
+ /* test if it is the same number generated in the first sequences*/
+ if(RandNumber[i]!=TempRandNumber)
+ {
+ Fail ("ERROR: rand should return the same value when srand "
+ "is initialized with 1 or not initialized at all");
+ }
+ if (TempRandNumber < 0 || TempRandNumber > RAND_MAX)
+ {
+ Fail("3) ERROR: random generated an invalid value: %d", TempRandNumber);
+ }
+ }
+
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/rand_srand/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/rand_srand/test1/testinfo.dat
new file mode 100644
index 0000000000..cf1b42dbf0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/rand_srand/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 = rand and srand
+Name = Positive Test for rand and srand
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Call rand without srand and get 10 random number batch 1.
+= call srand with seed 2, get 10 other random number and verify
+= that numbers are different from the batch 1.
+= Set the seed to 1, get 10 other random number and verify
+= that the generated number are the same as batch 1.
diff --git a/src/pal/tests/palsuite/c_runtime/realloc/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/realloc/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/realloc/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/realloc/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/realloc/test1/CMakeLists.txt
new file mode 100644
index 0000000000..0a9f34fc3b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/realloc/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_realloc_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_realloc_test1 coreclrpal)
+
+target_link_libraries(paltest_realloc_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/realloc/test1/test1.c b/src/pal/tests/palsuite/c_runtime/realloc/test1/test1.c
new file mode 100644
index 0000000000..d0dd128cc1
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/realloc/test1/test1.c
@@ -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 = 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/testinfo.dat b/src/pal/tests/palsuite/c_runtime/realloc/test1/testinfo.dat
new file mode 100644
index 0000000000..5d2a32224e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/realloc/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 = realloc
+Name = Positive Test for realloc
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Uses realloc to allocate and realloate memory, checking that memory
+= contents are copied when the memory is reallocated.
+
diff --git a/src/pal/tests/palsuite/c_runtime/sin/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sin/CMakeLists.txt
new file mode 100644
index 0000000000..5e1ef7f28b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sin/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/sin/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sin/test1/CMakeLists.txt
new file mode 100644
index 0000000000..e074337452
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sin/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_sin_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_sin_test1 coreclrpal)
+
+target_link_libraries(paltest_sin_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/sin/test1/test1.c b/src/pal/tests/palsuite/c_runtime/sin/test1/test1.c
new file mode 100644
index 0000000000..bec58d4dd9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sin/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: Test to ensure that sin return the correct values
+**
+** Dependencies: PAL_Initialize
+** PAL_Terminate
+** Fail
+** fabs
+**
+**===========================================================================*/
+
+#include <palsuite.h>
+
+// binary64 (double) has a machine epsilon of 2^-52 (approx. 2.22e-16). However, this
+// is slightly too accurate when writing tests meant to run against libm implementations
+// for various platforms. 2^-50 (approx. 8.88e-16) 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 (15-17 digits).
+
+// For example, a test with an expect result in the format of 0.xxxxxxxxxxxxxxxxx will use
+// PAL_EPSILON for the variance, while an expected result in the format of 0.0xxxxxxxxxxxxxxxxx
+// will use PAL_EPSILON / 10 and and expected result in the format of x.xxxxxxxxxxxxxxxx will
+// use PAL_EPSILON * 10.
+#define PAL_EPSILON 8.8817841970012523e-16
+
+#define PAL_NAN sqrt(-1.0)
+#define PAL_POSINF -log(0.0)
+#define PAL_NEGINF log(0.0)
+
+/**
+ * Helper test structure
+ */
+struct test
+{
+ double value; /* value to test the function with */
+ double expected; /* expected result */
+ double variance; /* maximum delta between the expected and actual result */
+};
+
+/**
+ * validate
+ *
+ * test validation function
+ */
+void __cdecl validate(double value, double expected, double variance)
+{
+ double result = sin(value);
+
+ /*
+ * The test is valid when the difference between result
+ * and expected is less than or equal to variance
+ */
+ double delta = fabs(result - expected);
+
+ if (delta > variance)
+ {
+ Fail("sin(%g) returned %20.17g when it should have returned %20.17g",
+ value, result, expected);
+ }
+}
+
+/**
+ * validate
+ *
+ * test validation function for values returning NaN
+ */
+void __cdecl validate_isnan(double value)
+{
+ double result = sin(value);
+
+ if (!_isnan(result))
+ {
+ Fail("sin(%g) returned %20.17g when it should have returned %20.17g",
+ 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.31830988618379067, 0.31296179620778659, PAL_EPSILON }, // value: 1 / pi
+ { 0.43429448190325183, 0.42077048331375735, PAL_EPSILON }, // value: log10(e)
+ { 0.63661977236758134, 0.59448076852482208, PAL_EPSILON }, // value: 2 / pi
+ { 0.69314718055994531, 0.63896127631363480, PAL_EPSILON }, // value: ln(2)
+ { 0.70710678118654752, 0.64963693908006244, PAL_EPSILON }, // value: 1 / sqrt(2)
+ { 0.78539816339744831, 0.70710678118654752, PAL_EPSILON }, // value: pi / 4, expected: 1 / sqrt(2)
+ { 1, 0.84147098480789651, PAL_EPSILON },
+ { 1.1283791670955126, 0.90371945743584630, PAL_EPSILON }, // value: 2 / sqrt(pi)
+ { 1.4142135623730950, 0.98776594599273553, PAL_EPSILON }, // value: sqrt(2)
+ { 1.4426950408889634, 0.99180624439366372, PAL_EPSILON }, // value: log2(e)
+ { 1.5707963267948966, 1, PAL_EPSILON * 10 }, // value: pi / 2
+ { 2.3025850929940457, 0.74398033695749319, PAL_EPSILON }, // value: ln(10)
+ { 2.7182818284590452, 0.41078129050290870, PAL_EPSILON }, // value: e
+ { 3.1415926535897932, 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/sin/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sin/test1/testinfo.dat
new file mode 100644
index 0000000000..57eae6bfd1
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sin/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 = sin
+Name = Positive Test for sin
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Passes to sin() a series of angle value, checking that
+= each one return to correct value.
diff --git a/src/pal/tests/palsuite/c_runtime/sinh/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sinh/CMakeLists.txt
new file mode 100644
index 0000000000..5e1ef7f28b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sinh/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/sinh/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sinh/test1/CMakeLists.txt
new file mode 100644
index 0000000000..66cc691d92
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sinh/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_sinh_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_sinh_test1 coreclrpal)
+
+target_link_libraries(paltest_sinh_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/sinh/test1/test1.c b/src/pal/tests/palsuite/c_runtime/sinh/test1/test1.c
new file mode 100644
index 0000000000..e790b16fb4
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sinh/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 sinh return the correct values
+**
+** Dependencies: PAL_Initialize
+** PAL_Terminate
+** Fail
+** fabs
+**
+**===========================================================================*/
+
+#include <palsuite.h>
+
+// binary64 (double) has a machine epsilon of 2^-52 (approx. 2.22e-16). However, this
+// is slightly too accurate when writing tests meant to run against libm implementations
+// for various platforms. 2^-50 (approx. 8.88e-16) 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 (15-17 digits).
+
+// For example, a test with an expect result in the format of 0.xxxxxxxxxxxxxxxxx will use
+// PAL_EPSILON for the variance, while an expected result in the format of 0.0xxxxxxxxxxxxxxxxx
+// will use PAL_EPSILON / 10 and and expected result in the format of x.xxxxxxxxxxxxxxxx will
+// use PAL_EPSILON * 10.
+#define PAL_EPSILON 8.8817841970012523e-16
+
+#define PAL_NAN sqrt(-1.0)
+#define PAL_POSINF -log(0.0)
+#define PAL_NEGINF log(0.0)
+
+/**
+ * Helper test structure
+ */
+struct test
+{
+ double value; /* value to test the function with */
+ double expected; /* expected result */
+ double variance; /* maximum delta between the expected and actual result */
+};
+
+/**
+ * validate
+ *
+ * test validation function
+ */
+void __cdecl validate(double value, double expected, double variance)
+{
+ double result = sinh(value);
+
+ /*
+ * The test is valid when the difference between result
+ * and expected is less than or equal to variance
+ */
+ double delta = fabs(result - expected);
+
+ if (delta > variance)
+ {
+ Fail("sinh(%g) returned %20.17g when it should have returned %20.17g",
+ value, result, expected);
+ }
+}
+
+/**
+ * validate
+ *
+ * test validation function for values returning NaN
+ */
+void __cdecl validate_isnan(double value)
+{
+ double result = sinh(value);
+
+ if (!_isnan(result))
+ {
+ Fail("sinh(%g) returned %20.17g when it should have returned %20.17g",
+ 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.31830988618379067, 0.32371243907207108, PAL_EPSILON }, // value: 1 / pi
+ { 0.43429448190325183, 0.44807597941469025, PAL_EPSILON }, // value: log10(e)
+ { 0.63661977236758134, 0.68050167815224332, PAL_EPSILON }, // value: 2 / pi
+ { 0.69314718055994531, 0.75, PAL_EPSILON }, // value: ln(2)
+ { 0.70710678118654752, 0.76752314512611633, PAL_EPSILON }, // value: 1 / sqrt(2)
+ { 0.78539816339744831, 0.86867096148600961, PAL_EPSILON }, // value: pi / 4
+ { 1, 1.1752011936438015, PAL_EPSILON * 10 },
+ { 1.1283791670955126, 1.3835428792038633, PAL_EPSILON * 10 }, // value: 2 / sqrt(pi)
+ { 1.4142135623730950, 1.9350668221743567, PAL_EPSILON * 10 }, // value: sqrt(2)
+ { 1.4426950408889634, 1.9978980091062796, PAL_EPSILON * 10 }, // value: log2(e)
+ { 1.5707963267948966, 2.3012989023072949, PAL_EPSILON * 10 }, // value: pi / 2
+ { 2.3025850929940457, 4.95, PAL_EPSILON * 10 }, // value: ln(10)
+ { 2.7182818284590452, 7.5441371028169758, PAL_EPSILON * 10 }, // value: e
+ { 3.1415926535897932, 11.548739357257748, 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/sinh/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sinh/test1/testinfo.dat
new file mode 100644
index 0000000000..f7aee40201
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sinh/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 = sinh
+Name = Positive Test for sinh
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Passes to sinh() 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
new file mode 100644
index 0000000000..cafb9536b0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/CMakeLists.txt
@@ -0,0 +1,22 @@
+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
new file mode 100644
index 0000000000..411ae66d54
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/sprintf.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.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
new file mode 100644
index 0000000000..bdec045af9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/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_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
new file mode 100644
index 0000000000..42e27f263b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/test1/test1.c
@@ -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 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
new file mode 100644
index 0000000000..abe07445cc
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/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
+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
new file mode 100644
index 0000000000..91e9db8ccc
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/test10/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..ae7dbfb177
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/test10/test10.c
@@ -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 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
new file mode 100644
index 0000000000..70b7f3ab75
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/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
+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
new file mode 100644
index 0000000000..b14c8be04d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/test11/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..0b5b5ab93d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/test11/test11.c
@@ -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 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
new file mode 100644
index 0000000000..852bd3e7b6
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/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
+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
new file mode 100644
index 0000000000..1e517495bd
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/test12/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..c2e778e494
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/test12/test12.c
@@ -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 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
new file mode 100644
index 0000000000..5df91d0e6a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/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
+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
new file mode 100644
index 0000000000..25b033fe82
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/test13/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..0b4b7ed9ae
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/test13/test13.c
@@ -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 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
new file mode 100644
index 0000000000..634817a791
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/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
+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
new file mode 100644
index 0000000000..5eae306e16
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/test14/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..20e986a9c3
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/test14/test14.c
@@ -0,0 +1,53 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*============================================================================
+**
+** Source: 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
new file mode 100644
index 0000000000..c7086efdbc
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/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
+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
new file mode 100644
index 0000000000..1fff23fc89
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/test15/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..34199b2eb3
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/test15/test15.c
@@ -0,0 +1,53 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*============================================================================
+**
+** Source: 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
new file mode 100644
index 0000000000..0a47c5321a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/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
+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
new file mode 100644
index 0000000000..2065c576d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/test16/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..c93b68bc2d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/test16/test16.c
@@ -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 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
new file mode 100644
index 0000000000..e18fab1ad8
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/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
+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
new file mode 100644
index 0000000000..ce3a8ad048
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/test17/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..643215b8f5
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/test17/test17.c
@@ -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 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
new file mode 100644
index 0000000000..a723103e02
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/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
+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
new file mode 100644
index 0000000000..6f69e1c7c2
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/test18/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..fa88152479
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/test18/test18.c
@@ -0,0 +1,53 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*============================================================================
+**
+** Source: 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
new file mode 100644
index 0000000000..dfafa4bcf4
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/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
+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
new file mode 100644
index 0000000000..a2917b27dc
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/test19/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..aee731cb74
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/test19/test19.c
@@ -0,0 +1,78 @@
+// Licensed to the .NET Foundation under one or more 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
new file mode 100644
index 0000000000..ebd13025f6
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/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
+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
new file mode 100644
index 0000000000..8af1c53a30
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/test2/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..d50679a5a3
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/test2/test2.c
@@ -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 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
new file mode 100644
index 0000000000..e8d0f53ff3
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/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
+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
new file mode 100644
index 0000000000..b7b7e0a579
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/test3/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..ae52dbed08
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/test3/test3.c
@@ -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 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
new file mode 100644
index 0000000000..12e0a9cfb0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/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
+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
new file mode 100644
index 0000000000..3478867b7c
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/test4/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..9660ffaa3a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/test4/test4.c
@@ -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 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
new file mode 100644
index 0000000000..bf7236dc32
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/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
+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
new file mode 100644
index 0000000000..dfa7583766
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/test5/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..1b52da77b6
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/test5/test5.c
@@ -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: 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
new file mode 100644
index 0000000000..31e0537bd0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/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 = 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
new file mode 100644
index 0000000000..7a9a5fc856
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/test6/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..c14e075475
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/test6/test6.c
@@ -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 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
new file mode 100644
index 0000000000..037e4106ff
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/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
+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
new file mode 100644
index 0000000000..a539a59ab9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/test7/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..082bd20e6d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/test7/test7.c
@@ -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 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
new file mode 100644
index 0000000000..a2730bc97c
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/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
+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
new file mode 100644
index 0000000000..7a92c5072a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/test8/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..9587c82c94
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/test8/test8.c
@@ -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 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
new file mode 100644
index 0000000000..adc0b66f06
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/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
+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
new file mode 100644
index 0000000000..2a91658bd4
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/test9/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..98f5db6ec1
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/test9/test9.c
@@ -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 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
new file mode 100644
index 0000000000..e569e789cd
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sprintf/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
+Name = Positive Test for sprintf
+TYPE = DEFAULT
+EXE1 = test9
+Description
+= Tests sprintf with integer numbers
diff --git a/src/pal/tests/palsuite/c_runtime/sqrt/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sqrt/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sqrt/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/sqrt/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sqrt/test1/CMakeLists.txt
new file mode 100644
index 0000000000..4347c44e46
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sqrt/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_sqrt_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_sqrt_test1 coreclrpal)
+
+target_link_libraries(paltest_sqrt_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/sqrt/test1/test1.c b/src/pal/tests/palsuite/c_runtime/sqrt/test1/test1.c
new file mode 100644
index 0000000000..62d2251d61
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sqrt/test1/test1.c
@@ -0,0 +1,123 @@
+// Licensed to the .NET Foundation under one or more 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 sqrt function on a positive value, a positive value
+** with a decimal and on the maxium possible double value.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+// binary64 (double) has a machine epsilon of 2^-52 (approx. 2.22e-16). However, this
+// is slightly too accurate when writing tests meant to run against libm implementations
+// for various platforms. 2^-50 (approx. 8.88e-16) 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 (15-17 digits).
+
+// For example, a test with an expect result in the format of 0.xxxxxxxxxxxxxxxxx will use
+// PAL_EPSILON for the variance, while an expected result in the format of 0.0xxxxxxxxxxxxxxxxx
+// will use PAL_EPSILON / 10 and and expected result in the format of x.xxxxxxxxxxxxxxxx will
+// use PAL_EPSILON * 10.
+#define PAL_EPSILON 8.8817841970012523e-16
+
+#define PAL_NAN sqrt(-1.0)
+#define PAL_POSINF -log(0.0)
+#define PAL_NEGINF log(0.0)
+
+/**
+ * Helper test structure
+ */
+struct test
+{
+ double value; /* value to test the function with */
+ double expected; /* expected result */
+ double variance; /* maximum delta between the expected and actual result */
+};
+
+/**
+ * validate
+ *
+ * test validation function
+ */
+void __cdecl validate(double value, double expected, double variance)
+{
+ double result = sqrt(value);
+
+ /*
+ * The test is valid when the difference between result
+ * and expected is less than or equal to variance
+ */
+ double delta = fabs(result - expected);
+
+ if (delta > variance)
+ {
+ Fail("sqrt(%g) returned %20.17g when it should have returned %20.17g",
+ value, result, expected);
+ }
+}
+
+/**
+ * validate
+ *
+ * test validation function for values returning NaN
+ */
+void __cdecl validate_isnan(double value)
+{
+ double result = sqrt(value);
+
+ if (!_isnan(result))
+ {
+ Fail("sqrt(%g) returned %20.17g when it should have returned %20.17g",
+ value, result, PAL_NAN);
+ }
+}
+
+int __cdecl main(int argc, char **argv)
+{
+ struct test tests[] =
+ {
+ /* value expected variance */
+ { 0.31830988618379067, 0.56418958354775629, PAL_EPSILON }, // value: 1 / pi
+ { 0.43429448190325183, 0.65901022898226081, PAL_EPSILON }, // value: log10(e)
+ { 0.63661977236758134, 0.79788456080286536, PAL_EPSILON }, // value: 2 / pi
+ { 0.69314718055994531, 0.83255461115769776, PAL_EPSILON }, // value: ln(2)
+ { 0.70710678118654752, 0.84089641525371454, PAL_EPSILON }, // value: 1 / sqrt(2)
+ { 0.78539816339744831, 0.88622692545275801, PAL_EPSILON }, // value: pi / 4
+ { 1, 1, PAL_EPSILON * 10 },
+ { 1.1283791670955126, 1.0622519320271969, PAL_EPSILON * 10 }, // value: 2 / sqrt(pi)
+ { 1.4142135623730950, 1.1892071150027211, PAL_EPSILON * 10 }, // value: sqrt(2)
+ { 1.4426950408889634, 1.2011224087864498, PAL_EPSILON * 10 }, // value: log2(e)
+ { 1.5707963267948966, 1.2533141373155003, PAL_EPSILON * 10 }, // value: pi / 2
+ { 2.3025850929940457, 1.5174271293851464, PAL_EPSILON * 10 }, // value: ln(10)
+ { 2.7182818284590452, 1.6487212707001281, PAL_EPSILON * 10 }, // value: e
+ { 3.1415926535897932, 1.7724538509055160, PAL_EPSILON * 10 }, // value: pi
+ };
+
+ /* PAL initialization */
+ if (PAL_Initialize(argc, argv) != 0)
+ {
+ return FAIL;
+ }
+
+ validate(-0.0, -0.0, PAL_EPSILON);
+ validate( 0.0, 0.0, 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/sqrt/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sqrt/test1/testinfo.dat
new file mode 100644
index 0000000000..804fef088c
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sqrt/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 = sqrt
+Name = Call sqrt on positive values and zero.
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Call the sqrt function on a positive value, a positive value
+= with a decimal and on the maxium possible double value.
+
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf/CMakeLists.txt
new file mode 100644
index 0000000000..59f39a5f58
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/CMakeLists.txt
@@ -0,0 +1,20 @@
+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(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/sscanf/sscanf.h b/src/pal/tests/palsuite/c_runtime/sscanf/sscanf.h
new file mode 100644
index 0000000000..675a67aed2
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/sscanf.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.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
new file mode 100644
index 0000000000..dce6d1de87
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/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_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
new file mode 100644
index 0000000000..c6f66a1d20
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/test1/test1.c
@@ -0,0 +1,53 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*============================================================================
+**
+** Source: 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
new file mode 100644
index 0000000000..ef33ba9e13
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/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
+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
new file mode 100644
index 0000000000..c27e4ce33a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/test10/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..aac5be43ae
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/test10/test10.c
@@ -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 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
new file mode 100644
index 0000000000..7e854ed235
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/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
+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
new file mode 100644
index 0000000000..7570e990bf
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/test11/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..0e3db6cca0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/test11/test11.c
@@ -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 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
new file mode 100644
index 0000000000..60f5cc46a4
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/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
+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
new file mode 100644
index 0000000000..b6509e46d4
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/test12/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..f800e452c0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/test12/test12.c
@@ -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 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
new file mode 100644
index 0000000000..3c453bf53a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/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
+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
new file mode 100644
index 0000000000..6fb4094f00
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/test13/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..314604e3ac
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/test13/test13.c
@@ -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 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
new file mode 100644
index 0000000000..1c4c2fc26e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/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
+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
new file mode 100644
index 0000000000..373a75fbda
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/test14/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..d1291a3b65
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/test14/test14.c
@@ -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 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
new file mode 100644
index 0000000000..97db6e4ffd
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/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
+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
new file mode 100644
index 0000000000..d500901782
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/test15/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..fa51467d85
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/test15/test15.c
@@ -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 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
new file mode 100644
index 0000000000..30c2cf4b30
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/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
+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
new file mode 100644
index 0000000000..c5e18ec061
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/test16/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..787b72ed0a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/test16/test16.c
@@ -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 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
new file mode 100644
index 0000000000..2c1dd42b70
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/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
+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
new file mode 100644
index 0000000000..7d908ab832
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/test17/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..c0dfd1699c
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/test17/test17.c
@@ -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 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
new file mode 100644
index 0000000000..e23be8541e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/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
+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
new file mode 100644
index 0000000000..571d773a88
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/test2/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..1221124e3a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/test2/test2.c
@@ -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 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
new file mode 100644
index 0000000000..f5ee4b52d4
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/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
+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
new file mode 100644
index 0000000000..ced8d5f8da
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/test3/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..9d18991070
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/test3/test3.c
@@ -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 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
new file mode 100644
index 0000000000..c38a498225
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/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
+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
new file mode 100644
index 0000000000..3e70d6dae2
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/test4/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..dd0538bcfe
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/test4/test4.c
@@ -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 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
new file mode 100644
index 0000000000..868056a6a5
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/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
+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
new file mode 100644
index 0000000000..391e51baa2
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/test5/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..0d45248af3
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/test5/test5.c
@@ -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 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
new file mode 100644
index 0000000000..8678dc8f5a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/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
+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
new file mode 100644
index 0000000000..c0b21bfd0d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/test6/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..c45ea31b04
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/test6/test6.c
@@ -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 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
new file mode 100644
index 0000000000..b2547a776a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/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
+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
new file mode 100644
index 0000000000..bcbd268011
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/test7/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..0899671d64
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/test7/test7.c
@@ -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 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
new file mode 100644
index 0000000000..614333e650
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/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
+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
new file mode 100644
index 0000000000..211e9e4df6
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/test8/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..53252f8929
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/test8/test8.c
@@ -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 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
new file mode 100644
index 0000000000..2cbc31ad2a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/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
+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
new file mode 100644
index 0000000000..77c269aeaa
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/test9/CMakeLists.txt
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..c5a2e0de5d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/test9/test9.c
@@ -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 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
new file mode 100644
index 0000000000..c0ccc8a4c9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/sscanf/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
+Name = Positive Test for sscanf
+TYPE = DEFAULT
+EXE1 = test9
+Description
+= Tests sscanf with characters
diff --git a/src/pal/tests/palsuite/c_runtime/strcat/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/strcat/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strcat/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/strcat/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/strcat/test1/CMakeLists.txt
new file mode 100644
index 0000000000..4a0f0be32d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strcat/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_strcat_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_strcat_test1 coreclrpal)
+
+target_link_libraries(paltest_strcat_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/strcat/test1/test1.c b/src/pal/tests/palsuite/c_runtime/strcat/test1/test1.c
new file mode 100644
index 0000000000..532d84621e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strcat/test1/test1.c
@@ -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:
+** Concatenate three strings into one string. Each time, check to ensure
+** the pointer returned was what we expected. When finished, compare the
+** newly formed string to what it should be to ensure no characters were
+** lost.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ char dest[80];
+ char *test = "foo bar baz";
+ char *str1 = "foo ";
+ char *str2 = "bar ";
+ char *str3 = "baz";
+ char *ptr;
+
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ dest[0] = 0;
+
+ ptr = strcat(dest, str1);
+ if (ptr != dest)
+ {
+ Fail("ERROR: Expected strcat to return ptr to %p, got %p", dest, ptr);
+ }
+
+ ptr = strcat(dest, str2);
+ if (ptr != dest)
+ {
+ Fail("ERROR: Expected strcat to return ptr to %p, got %p", dest, ptr);
+ }
+
+ ptr = strcat(dest, str3);
+ if (ptr != dest)
+ {
+ Fail("ERROR: Expected strcat to return ptr to %p, got %p", dest, ptr);
+ }
+
+ if (strcmp(dest, test) != 0)
+ {
+ Fail("ERROR: Expected strcat to give \"%s\", got \"%s\"\n",
+ test, dest);
+ }
+
+ PAL_Terminate();
+
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/strcat/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/strcat/test1/testinfo.dat
new file mode 100644
index 0000000000..6d67ffa180
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strcat/test1/testinfo.dat
@@ -0,0 +1,15 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = strcat
+Name = Test #1 for strcat
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Concatenate three strings into one string. Each time, check to ensure
+= the pointer returned was what we expected. When finished, compare the
+= newly formed string to what it should be to ensure no characters were
+= lost.
diff --git a/src/pal/tests/palsuite/c_runtime/strchr/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/strchr/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strchr/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/strchr/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/strchr/test1/CMakeLists.txt
new file mode 100644
index 0000000000..1d248f3f56
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strchr/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_strchr_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_strchr_test1 coreclrpal)
+
+target_link_libraries(paltest_strchr_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/strchr/test1/test1.c b/src/pal/tests/palsuite/c_runtime/strchr/test1/test1.c
new file mode 100644
index 0000000000..9190c4f7ce
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strchr/test1/test1.c
@@ -0,0 +1,86 @@
+// Licensed to the .NET Foundation under one or more 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 this on a character which is in a string, and ensure the pointer
+** points to that character. Then check the string for the null character,
+** which the return pointer should point to. Then search for a character not
+** in the string and check that the return value is NULL.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+struct testCase
+{
+ int result;
+ char string[50];
+ int character;
+};
+
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ int i = 0;
+ char *result;
+
+ /*
+ * this structure includes several strings to be tested with
+ * strchr function and the expected results
+ */
+
+ struct testCase testCases[]=
+ {
+ {22,"corn cup cat cream coast",'s'},
+ {10,"corn cup cat cream coast",'a'},
+ {2,"This is a test",'i'},
+ {10,"This is a test",'t'},
+ {'\0',"This is a test",'b'},/* zero used instead of NULL */
+ {'\0',"This is a test",121},/* zero used instead of NULL */
+ {4,"This is a test of the function",' '},
+ {25,"This is a test of the function",'c'},
+ {'\0',"This is a test of the function",'C'},
+ {24,"corn cup cat cream coast", '\0'}/* zero used instead of NULL */
+ };
+
+ if (0 != PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ /* Loop through the structure and test each case */
+
+ for (i=0; i< sizeof(testCases)/sizeof(struct testCase); i++)
+ {
+ result = strchr(testCases[i].string,testCases[i].character);
+ if (result==NULL)
+ {
+ if (testCases[i].result != (int) NULL)
+ {
+ Fail("Expected strchr() to return \"%s\" instead of NULL!\n",
+ testCases[i].string + testCases[i].result);
+ }
+ }
+ else
+ {
+ if (result != testCases[i].string + testCases[i].result)
+ {
+ Fail("Expected strchr() to return \"%s\" instead of \"%s\"!\n",
+ testCases[i].string + testCases[i].result, result);
+ }
+ }
+
+ }
+
+ PAL_Terminate();
+
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/strchr/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/strchr/test1/testinfo.dat
new file mode 100644
index 0000000000..4985c47541
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strchr/test1/testinfo.dat
@@ -0,0 +1,15 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = strchr
+Name = Test #1 for strchr
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Test this on a character which is in a string, and ensure the pointer
+= points to that character. Then check the string for the null character,
+= which the return pointer should point to. Then search for a character not
+= in the string and check that the return value is NULL.
diff --git a/src/pal/tests/palsuite/c_runtime/strcmp/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/strcmp/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strcmp/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/strcmp/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/strcmp/test1/CMakeLists.txt
new file mode 100644
index 0000000000..b953dfa034
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strcmp/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_strcmp_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_strcmp_test1 coreclrpal)
+
+target_link_libraries(paltest_strcmp_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/strcmp/test1/test1.c b/src/pal/tests/palsuite/c_runtime/strcmp/test1/test1.c
new file mode 100644
index 0000000000..49428fd624
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strcmp/test1/test1.c
@@ -0,0 +1,73 @@
+// Licensed to the .NET Foundation under one or more 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:
+** Compare a number of different strings against each other, ensure that the
+** three return values are given at the appropriate times.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+typedef struct
+{
+ int result;
+ char string1[50];
+ char string2[50];
+} testCase;
+
+testCase testCases[]=
+{
+ {0,"Hello","Hello"},
+ {1,"hello","Hello"},
+ {-1,"Hello","hello"},
+ {0,"0Test","0Test"},
+ {0,"***???","***???"},
+ {0,"Testing the string for string comparison","Testing the string for "
+ "string comparison"},
+ {-1,"Testing the string for string comparison","Testing the string for "
+ "string comparsioa"},
+ {1,"Testing the string for string comparison","Testing the string for "
+ "comparison"},
+ {-1,"aaaabbbbb","aabcdefeccg"}
+};
+
+int __cdecl main(int argc, char *argv[])
+{
+ int i = 0;
+ int result = 0;
+
+ /*
+ * Initialize the PAL
+ */
+ if (0 != PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ /* Loop through structure and test each case */
+ for (i=0; i < sizeof(testCases)/sizeof(testCase); i++)
+ {
+ result = strcmp(testCases[i].string1,testCases[i].string2);
+
+ /* Compare returned value */
+ if( ((result == 0) && (testCases[i].result !=0)) ||
+ ((result <0) && (testCases[i].result !=-1)) ||
+ ((result >0) && (testCases[i].result !=1)) )
+ {
+ Fail("ERROR: strcmp returned %d instead of %d\n",
+ result, testCases[i].result);
+ }
+
+ }
+
+ PAL_Terminate();
+
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/strcmp/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/strcmp/test1/testinfo.dat
new file mode 100644
index 0000000000..174cb4be85
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strcmp/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 = strcmp
+Name = Test #1 for strcmp
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Compare a number of different strings against each other, ensure that the
+= three return values are given at the appropriate times.
diff --git a/src/pal/tests/palsuite/c_runtime/strcpy/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/strcpy/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strcpy/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/strcpy/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/strcpy/test1/CMakeLists.txt
new file mode 100644
index 0000000000..043ec57d98
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strcpy/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_strcpy_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_strcpy_test1 coreclrpal)
+
+target_link_libraries(paltest_strcpy_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/strcpy/test1/test1.c b/src/pal/tests/palsuite/c_runtime/strcpy/test1/test1.c
new file mode 100644
index 0000000000..43069e59a6
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strcpy/test1/test1.c
@@ -0,0 +1,51 @@
+// Licensed to the .NET Foundation under one or more 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 function to copy into an empty buffer. Check that the return value
+** is pointing at the destination buffer. Also compare the string copied to
+** the origional string, to ensure they are the same.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ char dest[80];
+ char *result = "foo";
+ char str[] = {'f','o','o',0,'b','a','r',0};
+ char *ret;
+
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ ret = strcpy(dest, str);
+
+ if (ret != dest)
+ {
+ Fail("Expected strcpy to return %p, got %p!\n", dest, ret);
+
+ }
+
+ if (strcmp(dest, result) != 0)
+ {
+ Fail("Expected strcpy to give \"%s\", got \"%s\"!\n", result, dest);
+ }
+
+
+ PAL_Terminate();
+
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/strcpy/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/strcpy/test1/testinfo.dat
new file mode 100644
index 0000000000..700b124926
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strcpy/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 = strcpy
+Name = Test #1 for strcpy
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Call the function to copy into an empty buffer. Check that the return value
+= is pointing at the destination buffer. Also compare the string copied to
+= the origional string, to ensure they are the same.
diff --git a/src/pal/tests/palsuite/c_runtime/strcspn/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/strcspn/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strcspn/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/strcspn/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/strcspn/test1/CMakeLists.txt
new file mode 100644
index 0000000000..a38761c335
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strcspn/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_strcspn_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_strcspn_test1 coreclrpal)
+
+target_link_libraries(paltest_strcspn_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/strcspn/test1/test1.c b/src/pal/tests/palsuite/c_runtime/strcspn/test1/test1.c
new file mode 100644
index 0000000000..ddc5667570
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strcspn/test1/test1.c
@@ -0,0 +1,59 @@
+// Licensed to the .NET Foundation under one or more 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 strcspn with a character set that should give an index into
+** the middle of the original string. Also tests with character sets
+** that are not in the string at all, and character sets that match
+** with the very first character.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+struct testCase
+{
+ long result;
+ char *string1;
+ char *string2;
+};
+
+int __cdecl main(int argc, char *argv[])
+{
+ int i=0;
+ long TheResult = 0;
+
+ struct testCase testCases[]=
+ {
+ {4,"abcdefg12345678hijklmnopqrst","t8m1sBe"},
+ {23,"This is a test, testing", "X\tylM"},
+ {0,"foobar","tzkfb"},
+ };
+
+ /*
+ * Initialize the PAL
+ */
+ if (0 != PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ for (i=0; i<sizeof(testCases)/sizeof(struct testCase); i++)
+ {
+ TheResult = strcspn(testCases[i].string1,testCases[i].string2);
+ if (TheResult != testCases[i].result)
+ {
+ Fail("Expected strcspn to return %d, got %d!\n",
+ testCases[i].result,TheResult);
+ }
+
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/strcspn/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/strcspn/test1/testinfo.dat
new file mode 100644
index 0000000000..a302eb1fb7
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strcspn/test1/testinfo.dat
@@ -0,0 +1,15 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = strcspn
+Name = Test #1 for strcspn
+TYPE = DEFAULT
+EXE1 = test1
+Description
+=Tests strcspn with a character set that should give an index into
+=the middle of the original string. Also tests with character sets
+=that are not in the string at all, and character sets that match
+=with the very first character.
diff --git a/src/pal/tests/palsuite/c_runtime/strlen/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/strlen/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strlen/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/strlen/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/strlen/test1/CMakeLists.txt
new file mode 100644
index 0000000000..c61828a97b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strlen/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_strlen_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_strlen_test1 coreclrpal)
+
+target_link_libraries(paltest_strlen_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/strlen/test1/test1.c b/src/pal/tests/palsuite/c_runtime/strlen/test1/test1.c
new file mode 100644
index 0000000000..40f8e151c7
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strlen/test1/test1.c
@@ -0,0 +1,33 @@
+// Licensed to the .NET Foundation under one or more 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 string and the length of a 0 character string to
+** see that this function returns the correct values for each.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char *argv[])
+{
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ if (strlen("foo") != 3)
+ Fail("ERROR: strlen(\"foo\") != 3\n");
+
+ if (strlen("") != 0)
+ Fail("ERROR: strlen(\"\") != 0\n");
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/strlen/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/strlen/test1/testinfo.dat
new file mode 100644
index 0000000000..ac5c3aec0f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strlen/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 = strlen
+Name = Positive Test for strlen
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Check the length of a string and the length of a 0 character string to
+= see that this function returns the correct values for each.
diff --git a/src/pal/tests/palsuite/c_runtime/strncat/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/strncat/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strncat/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/strncat/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/strncat/test1/CMakeLists.txt
new file mode 100644
index 0000000000..7595f66939
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strncat/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_strncat_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_strncat_test1 coreclrpal)
+
+target_link_libraries(paltest_strncat_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/strncat/test1/test1.c b/src/pal/tests/palsuite/c_runtime/strncat/test1/test1.c
new file mode 100644
index 0000000000..000d1685b9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strncat/test1/test1.c
@@ -0,0 +1,77 @@
+// Licensed to the .NET Foundation under one or more 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:
+** Concatenate a few strings together, setting different lengths to be
+** used for each one. Check to ensure the pointers which are returned are
+** correct, and that the final string is what was expected.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ char dest[80];
+ char *test = "foo barbaz";
+ char *str1 = "foo ";
+ char *str2 = "bar ";
+ char *str3 = "baz";
+ char *ptr;
+ int i;
+
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ dest[0] = 0;
+ for (i=1; i<80; i++)
+ {
+ dest[i] = 'x';
+ }
+
+ ptr = strncat(dest, str1, strlen(str1));
+ if (ptr != dest)
+ {
+ Fail("ERROR: Expected strncat to return ptr to %p, got %p", dest, ptr);
+ }
+
+ ptr = strncat(dest, str2, 3);
+ if (ptr != dest)
+ {
+ Fail("ERROR: Expected strncat to return ptr to %p, got %p", dest, ptr);
+ }
+ if (dest[7] != 0)
+ {
+ Fail("ERROR: strncat did not place a terminating NULL!");
+ }
+
+ ptr = strncat(dest, str3, 20);
+ if (ptr != dest)
+ {
+ Fail("ERROR: Expected strncat to return ptr to %p, got %p", dest, ptr);
+ }
+ if (strcmp(dest, test) != 0)
+ {
+ Fail("ERROR: Expected strncat to give \"%s\", got \"%s\"\n",
+ test, dest);
+ }
+ if (dest[strlen(test)+1] != 'x')
+ {
+ Fail("strncat went out of bounds!\n");
+ }
+
+ PAL_Terminate();
+
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/strncat/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/strncat/test1/testinfo.dat
new file mode 100644
index 0000000000..4aaedbf404
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strncat/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 = strncat
+Name = Test #1 for strncat
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Concatenate a few strings together, setting different lengths to be
+= used for each one. Check to ensure the pointers which are returned are
+= correct, and that the final string is what was expected.
diff --git a/src/pal/tests/palsuite/c_runtime/strncmp/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/strncmp/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strncmp/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/strncmp/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/strncmp/test1/CMakeLists.txt
new file mode 100644
index 0000000000..4a0337a3dc
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strncmp/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_strncmp_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_strncmp_test1 coreclrpal)
+
+target_link_libraries(paltest_strncmp_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/strncmp/test1/test1.c b/src/pal/tests/palsuite/c_runtime/strncmp/test1/test1.c
new file mode 100644
index 0000000000..7326c3b61e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strncmp/test1/test1.c
@@ -0,0 +1,80 @@
+// Licensed to the .NET Foundation under one or more 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 all three possible return values are given under the
+** appropriate circumstance. Also, uses different sizes, to only compare
+** portions of strings, checking to make sure these return the correct value.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+typedef struct
+{
+ int result;
+ char string1[50];
+ char string2[50];
+ int number;
+} testCase;
+
+testCase testCases[]=
+{
+ {0,"Hello","Hello",5},
+ {1,"hello","Hello",3},
+ {-1,"Hello","hello",5},
+ {0,"heLLo","heLLo",5},
+ {1,"hello","heLlo",5},
+ {-1,"heLlo","hello",5},
+ {0,"0Test","0Test",5},
+ {0,"***???","***???",6},
+ {0,"Testing the string for string comparison","Testing the string for "
+ "string comparison",40},
+ {-1,"Testing the string for string comparison","Testing the string for "
+ "string comparsioa",40},
+ {1,"Testing the string for string comparison","Testing the string for "
+ "comparison",34},
+ {0,"aaaabbbbb","aabcdefeccg",2},
+ {0,"abcd","abcd",10}
+};
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ int i=0;
+ int iresult=0;
+
+ /*
+ * Initialize the PAL
+ */
+ if (0 != PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ for (i=0; i< sizeof(testCases)/sizeof(testCase); i++)
+ {
+ iresult = strncmp(testCases[i].string1,testCases[i].string2,
+ testCases[i].number);
+
+ if( ((iresult == 0) && (testCases[i].result !=0)) ||
+ ((iresult <0) && (testCases[i].result !=-1)) ||
+ ((iresult >0) && (testCases[i].result !=1)) )
+
+ {
+ Fail("ERROR: strncmp returned %d instead of %d\n",
+ iresult, testCases[i].result);
+ }
+
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/strncmp/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/strncmp/test1/testinfo.dat
new file mode 100644
index 0000000000..8e95311f36
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strncmp/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 = strncmp
+Name = Test #1 for strncmp
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Test to ensure all three possible return values are given under the
+= appropriate circumstance. Also, uses different sizes, to only compare
+= portions of strings, checking to make sure these return the correct value.
diff --git a/src/pal/tests/palsuite/c_runtime/strncpy/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/strncpy/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strncpy/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/strncpy/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/strncpy/test1/CMakeLists.txt
new file mode 100644
index 0000000000..6e0250bce3
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strncpy/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_strncpy_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_strncpy_test1 coreclrpal)
+
+target_link_libraries(paltest_strncpy_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/strncpy/test1/test1.c b/src/pal/tests/palsuite/c_runtime/strncpy/test1/test1.c
new file mode 100644
index 0000000000..62baf61ba2
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strncpy/test1/test1.c
@@ -0,0 +1,85 @@
+// Licensed to the .NET Foundation under one or more 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 see that you can copy a portion of a string into a new buffer.
+** Also check that the strncpy function doesn't overflow when it is used.
+** Finally check that if the number of characters given is greater than the
+** amount to copy, that the destination buffer is padded with NULLs.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ char dest[80];
+ char *result = "foobar";
+ char *str = "foobar\0baz";
+ char *ret;
+ int i;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ for (i=0; i<80; i++)
+ {
+ dest[i] = 'x';
+ }
+
+ ret = strncpy(dest, str, 3);
+ if (ret != dest)
+ {
+ Fail("Expected strncpy to return %p, got %p!\n", dest, ret);
+ }
+
+ if (strncmp(dest, result, 3) != 0)
+ {
+ Fail("Expected strncpy to give \"%s\", got \"%s\"!\n", result, dest);
+ }
+
+ if (dest[3] != 'x')
+ {
+ Fail("strncpy overflowed!\n");
+ }
+
+ ret = strncpy(dest, str, 40);
+ if (ret != dest)
+ {
+ Fail("Expected strncpy to return %p, got %p!\n", dest, ret);
+ }
+
+ if (strcmp(dest, result) != 0)
+ {
+ Fail("Expected strncpy to give \"%s\", got \"%s\"!\n", result, dest);
+ }
+
+ for (i=strlen(str); i<40; i++)
+ {
+ if (dest[i] != 0)
+ {
+ Fail("strncpy failed to pad the destination with NULLs!\n");
+ }
+ }
+
+ if (dest[40] != 'x')
+ {
+ Fail("strncpy overflowed!\n");
+ }
+
+
+
+ PAL_Terminate();
+
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/strncpy/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/strncpy/test1/testinfo.dat
new file mode 100644
index 0000000000..c402adb1c1
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strncpy/test1/testinfo.dat
@@ -0,0 +1,15 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = strncpy
+Name = Test #1 for strncpy
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Test to see that you can copy a portion of a string into a new buffer.
+= Also check that the strncpy function doesn't overflow when it is used.
+= Finally check that if the number of characters given is greater than the
+= amount to copy, that the destination buffer is padded with NULLs.
diff --git a/src/pal/tests/palsuite/c_runtime/strpbrk/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/strpbrk/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strpbrk/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/strpbrk/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/strpbrk/test1/CMakeLists.txt
new file mode 100644
index 0000000000..eac9ac9169
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strpbrk/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_strpbrk_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_strpbrk_test1 coreclrpal)
+
+target_link_libraries(paltest_strpbrk_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/strpbrk/test1/test1.c b/src/pal/tests/palsuite/c_runtime/strpbrk/test1/test1.c
new file mode 100644
index 0000000000..a42b80f313
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strpbrk/test1/test1.c
@@ -0,0 +1,85 @@
+// Licensed to the .NET Foundation under one or more 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:
+** Search a string for characters in a given character set and ensure the
+** pointer returned points to the first occurance. Check to see that the
+** function returns NULL if the character is not found.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+struct testCase
+{
+ char *result;
+ char *string1;
+ char *string2;
+};
+
+int __cdecl main(int argc, char *argv[])
+{
+ char *ptr = NULL;
+ int i = 0;
+
+ /*
+ * this structure includes several strings to be tested with
+ * strpbk function and the expected results
+ */
+
+ struct testCase testCases[] =
+ {
+ {"t cream coast","corn cup cat cream coast","sit"},
+ {"eam coast","corn cup cat cream coast","like"},
+ {"is is a test","This is a test","circle"},
+ {"a test","This is a test","way"},
+ {NULL,"This is a test","boo"},
+ {NULL,"This is a test","123"},
+ {" is a test of the function","This is a test of the function",
+ "zzz xx"}
+ };
+
+
+ if (0 != PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ /* A loop to go through the testcases in the structure */
+
+ for (i=0; i< sizeof(testCases)/sizeof(struct testCase); i++)
+ {
+ ptr = strpbrk(testCases[i].string1,testCases[i].string2);
+ if (ptr==NULL)
+ {
+ if (testCases[i].result != NULL)
+ {
+ Fail("Expected strpbrk() to return %s, got NULL!\n",
+ testCases[i].result);
+ }
+ }
+ else
+ {
+ if (strcmp(ptr,testCases[i].result)!=0 )
+
+ {
+ Fail("Expected strpbrk() to return %s, got %s!\n",
+ testCases[i].result,ptr);
+ }
+
+ }
+
+ }
+
+
+ PAL_Terminate();
+
+ return PASS;
+}
+
diff --git a/src/pal/tests/palsuite/c_runtime/strpbrk/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/strpbrk/test1/testinfo.dat
new file mode 100644
index 0000000000..1bef6a7b9d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strpbrk/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 = strpbrk
+Name = Test #1 for strpbrk
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Search a string for characters in a given character set and ensure the
+= pointer returned points to the first occurance. Check to see that the
+= function returns NULL if the character is not found.
diff --git a/src/pal/tests/palsuite/c_runtime/strrchr/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/strrchr/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strrchr/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/strrchr/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/strrchr/test1/CMakeLists.txt
new file mode 100644
index 0000000000..5c099b0cd2
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strrchr/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_strrchr_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_strrchr_test1 coreclrpal)
+
+target_link_libraries(paltest_strrchr_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/strrchr/test1/test1.c b/src/pal/tests/palsuite/c_runtime/strrchr/test1/test1.c
new file mode 100644
index 0000000000..a5c147eece
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strrchr/test1/test1.c
@@ -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: test1.c
+**
+** Purpose: \
+** Search a string for a given character. Search for a character contained
+** in the string, and ensure the pointer returned points to it. Then search
+** for the null character, and ensure the pointer points to that. Finally
+** search for a character which is not in the string and ensure that it
+** returns NULL.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ char *str = "foo bar baz";
+ char *ptr;
+
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ ptr = strrchr(str, 'b');
+ if (ptr != str + 8)
+ {
+ Fail("Expected strrchr() to return %p, got %p!\n", str + 8, ptr);
+ }
+
+ ptr = strrchr(str, 0);
+ if (ptr != str + 11)
+ {
+ Fail("Expected strrchr() to return %p, got %p!\n", str + 11, ptr);
+ }
+
+ ptr = strrchr(str, 'x');
+ if (ptr != NULL)
+ {
+ Fail("Expected strrchr() to return NULL, got %p!\n", ptr);
+ }
+
+ PAL_Terminate();
+
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/strrchr/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/strrchr/test1/testinfo.dat
new file mode 100644
index 0000000000..45b27aecf9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strrchr/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 = strrchr
+Name = Test #1 for strrchr
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Search a string for a given character. Search for a character contained
+= in the string, and ensure the pointer returned points to it. Then search
+= for the null character, and ensure the pointer points to that. Finally
+= search for a character which is not in the string and ensure that it
+= returns NULL.
diff --git a/src/pal/tests/palsuite/c_runtime/strspn/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/strspn/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strspn/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/strspn/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/strspn/test1/CMakeLists.txt
new file mode 100644
index 0000000000..45caaf1bf8
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strspn/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_strspn_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_strspn_test1 coreclrpal)
+
+target_link_libraries(paltest_strspn_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/strspn/test1/test1.c b/src/pal/tests/palsuite/c_runtime/strspn/test1/test1.c
new file mode 100644
index 0000000000..78d2488438
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strspn/test1/test1.c
@@ -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:
+** Check a character set against a string to see that the function returns
+** the length of the substring which consists of all characters in the string.
+** Also check that if the character set doesn't match the string at all, that
+** the value is 0.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+struct testCase
+{
+ long result;
+ char *string1;
+ char *string2;
+};
+
+int __cdecl main(int argc, char *argv[])
+{
+ int i=0;
+ long TheResult = 0;
+
+ struct testCase testCases[]=
+ {
+ {4,"abcdefg12345678hijklmnopqrst","a2bjk341cd"},
+ {14,"This is a test, testing", "aeioTts rh"},
+ {0,"foobar","kpzt"}
+ };
+
+ /*
+ * Initialize the PAL
+ */
+ if (0 != PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ for (i=0; i<sizeof(testCases)/sizeof(struct testCase);i++)
+ {
+ TheResult = strspn(testCases[i].string1,testCases[i].string2);
+ if (TheResult != testCases[i].result)
+ {
+ Fail("Expected strspn to return %d, got %d!\n",
+ testCases[i].result,TheResult);
+ }
+
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/strspn/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/strspn/test1/testinfo.dat
new file mode 100644
index 0000000000..b56bd1574e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strspn/test1/testinfo.dat
@@ -0,0 +1,15 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = strspn
+Name = Test #1 for strspn
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Check a character set against a string to see that the function returns
+= the length of the substring which consists of all characters in the string.
+= Also check that if the character set doesn't match the string at all, that
+= the value is 0.
diff --git a/src/pal/tests/palsuite/c_runtime/strstr/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/strstr/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strstr/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/strstr/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/strstr/test1/CMakeLists.txt
new file mode 100644
index 0000000000..17e6ae8457
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strstr/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_strstr_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_strstr_test1 coreclrpal)
+
+target_link_libraries(paltest_strstr_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/strstr/test1/test1.c b/src/pal/tests/palsuite/c_runtime/strstr/test1/test1.c
new file mode 100644
index 0000000000..db01e8b32a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strstr/test1/test1.c
@@ -0,0 +1,83 @@
+// Licensed to the .NET Foundation under one or more 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 three cases of searching for a string within a string. First when
+** the string is contained, check that the pointer returned points to it.
+** Then when it isn't contained, ensure it returns null. And when the string
+** we're searching for is empty, it should return a pointer to the string
+** we're searching through.Test #1 for the strstr function
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+
+
+struct testCase
+{
+ char *result;
+ char *string1;
+ char *string2;
+
+};
+
+int __cdecl main(int argc, char *argv[])
+{
+ int i=0;
+ char *ptr=NULL;
+
+ struct testCase testCases[]=
+ {
+ {"is is a test", "This is a test","is"},
+ {"fghijkl","abcdefghijkl","fgh"},
+ {NULL,"aabbccddeeffgg","h"},
+ {NULL,"aabb", "eeeeeee"},
+ {"AAA", "BBddfdaaaaAAA","A"},
+ {"fdaaaaAAA", "BBddfdaaaaAAA","f"},
+ {"aadfsadfas","aadfsadfas",""},
+ {NULL,"","ccc"}
+ };
+
+ /*
+ * Initialize the PAL
+ */
+ if (0 != PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ for (i=0; i<sizeof(testCases)/sizeof(struct testCase); i++)
+ {
+ ptr = strstr(testCases[i].string1,testCases[i].string2);
+ if (ptr==NULL)
+ {
+ if (testCases[i].result != NULL)
+ {
+ Fail("ERROR: strstr returned incorrect value\n"
+ "Expected a pointer to \"%s\" , got a pointer to NULL\n",
+ testCases[i].result);
+ }
+ }
+ else
+ {
+ if (strcmp(testCases[i].result,ptr) != 0)
+ {
+ Fail("ERROR: strstr returned incorrect value\n"
+ "Expected a pointer to \"%s\" , got a pointer to \"%s\"\n",
+ testCases[i].result, ptr);
+ }
+ }
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
+
diff --git a/src/pal/tests/palsuite/c_runtime/strstr/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/strstr/test1/testinfo.dat
new file mode 100644
index 0000000000..cf13170af5
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strstr/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 = strstr
+Name = Positive Test for strstr
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Check three cases of searching for a string within a string. First when
+= the string is contained, check that the pointer returned points to it.
+= Then when it isn't contained, ensure it returns null. And when the string
+= we're searching for is empty, it should return a pointer to the string
+= we're searching through.
diff --git a/src/pal/tests/palsuite/c_runtime/strtod/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/strtod/CMakeLists.txt
new file mode 100644
index 0000000000..ef14ea5352
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strtod/CMakeLists.txt
@@ -0,0 +1,5 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+add_subdirectory(test2)
+
diff --git a/src/pal/tests/palsuite/c_runtime/strtod/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/strtod/test1/CMakeLists.txt
new file mode 100644
index 0000000000..d3a9d61a4d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strtod/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_strtod_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_strtod_test1 coreclrpal)
+
+target_link_libraries(paltest_strtod_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/strtod/test1/test1.c b/src/pal/tests/palsuite/c_runtime/strtod/test1/test1.c
new file mode 100644
index 0000000000..e312d98f58
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strtod/test1/test1.c
@@ -0,0 +1,93 @@
+// Licensed to the .NET Foundation under one or more 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 strtod function.
+** Convert a number of strings to doubles. Ensure they
+** convert correctly.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+
+struct testCase
+{
+ double CorrectResult; /* The returned double value */
+ char ResultString[20]; /* The remainder string */
+ char string[20]; /* The test string */
+};
+
+
+int __cdecl main(int argc, char **argv)
+{
+
+ char * endptr;
+ double result;
+ int i;
+
+ struct testCase testCases[] =
+ {
+ {1234,"","1234"},
+ {-1234,"","-1234"},
+ {1234.44,"","1234.44"},
+ {1234e-5,"","1234e-5"},
+ {1234e+5,"","1234e+5"},
+ {12345E5,"","12345e5"},
+ {1234.657e-8,"","1234.657e-8"},
+ {1234567e-8,"foo","1234567e-8foo"},
+ {999,"foo","999 foo"},
+ {7,"foo"," 7foo"},
+ {0,"a7","a7"},
+ {-777777,"z zz","-777777z zz"}
+ };
+
+ /*
+ * Initialize the PAL
+ */
+ if (0 != PAL_Initialize(argc,argv))
+ {
+ return FAIL;
+ }
+
+ /* Loop through the structure to test each case */
+ for(i = 0; i < sizeof(testCases) / sizeof(struct testCase); i++)
+ {
+ result = strtod(testCases[i].string,&endptr);
+
+ /* need to check the result and the endptr result */
+ if ((testCases[i].CorrectResult != result) &&
+ (strcmp(testCases[i].ResultString,endptr)!=0))
+ {
+ Fail("ERROR: strtod returned %f instead of %f and "
+ "\"%s\" instead of \"%s\" for the test of \"%s\"\n",
+ result,
+ testCases[i].CorrectResult,
+ endptr,
+ testCases[i].ResultString,
+ testCases[i].string);
+ }
+
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/strtod/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/strtod/test1/testinfo.dat
new file mode 100644
index 0000000000..2c98d2eaf6
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strtod/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 = strtod
+Name = Positive Test for strtod
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Purpose: Tests the PAL implementation of the strtod function.
+= Convert a number of strings to doubles. Ensure they convert correctly.
+
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/strtod/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/strtod/test2/CMakeLists.txt
new file mode 100644
index 0000000000..6f407c5914
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strtod/test2/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test2.c
+)
+
+add_executable(paltest_strtod_test2
+ ${SOURCES}
+)
+
+add_dependencies(paltest_strtod_test2 coreclrpal)
+
+target_link_libraries(paltest_strtod_test2
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/strtod/test2/test2.c b/src/pal/tests/palsuite/c_runtime/strtod/test2/test2.c
new file mode 100644
index 0000000000..0eaf4f53b6
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strtod/test2/test2.c
@@ -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: test2.c
+**
+** Purpose: Tests strtod with overflows
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char **argv)
+{
+ /* Representation of positive infinty for a IEEE 64-bit double */
+ INT64 PosInifity = (INT64)(0x7ff00000) << 32;
+ double HugeVal = *(double*) &PosInifity;
+ char *PosStr = "1E+10000";
+ char *NegStr = "-1E+10000";
+ double result;
+
+
+ if (PAL_Initialize(argc,argv))
+ {
+ return FAIL;
+ }
+
+ result = strtod(PosStr, NULL);
+
+ if (result != HugeVal)
+ {
+ Fail("ERROR: wcstod interpreted \"%s\" as %g instead of %g\n",
+ PosStr, result, HugeVal);
+ }
+
+ result = strtod(NegStr, NULL);
+
+ if (result != -HugeVal)
+ {
+ Fail("ERROR: wcstod interpreted \"%s\" as %g instead of %g\n",
+ NegStr, result, -HugeVal);
+ }
+
+ PAL_Terminate();
+
+ return PASS;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/strtod/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/strtod/test2/testinfo.dat
new file mode 100644
index 0000000000..a50c07b8b5
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strtod/test2/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 = strtod
+Name = Negative test for strtod with overflows
+TYPE = DEFAULT
+EXE1 = test2
+Description
+= Test strtod with overflows.
+
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/strtok/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/strtok/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strtok/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/strtok/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/strtok/test1/CMakeLists.txt
new file mode 100644
index 0000000000..1d5fc04cca
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strtok/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_strtok_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_strtok_test1 coreclrpal)
+
+target_link_libraries(paltest_strtok_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/strtok/test1/test1.c b/src/pal/tests/palsuite/c_runtime/strtok/test1/test1.c
new file mode 100644
index 0000000000..f1dec70380
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strtok/test1/test1.c
@@ -0,0 +1,78 @@
+// Licensed to the .NET Foundation under one or more 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:
+** Search for a number of tokens within strings. Check that the return values
+** are what is expect, and also that the strings match up with our expected
+** results.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ char str[] = "foo bar baz";
+ char *result1= "foo \0ar baz";
+ char *result2= "foo \0a\0 baz";
+ int len = strlen(str) + 1;
+ char *ptr;
+
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ ptr = strtok(str, "bz");
+ if (ptr != str)
+ {
+ Fail("Expected strtok() to return %p, got %p!\n", str, ptr);
+ }
+ if (memcmp(str, result1, len) != 0)
+ {
+ Fail("strtok altered the string in an unexpeced way!\n");
+ }
+
+ ptr = strtok(NULL, "r ");
+ if (ptr != str + 5)
+ {
+ Fail("Expected strtok() to return %p, got %p!\n", str+5, ptr);
+ }
+ if (memcmp(str, result2, len) != 0)
+ {
+ Fail("strtok altered the string in an unexpeced way!\n");
+ }
+
+
+ ptr = strtok(NULL, "X");
+ if (ptr != str + 7)
+ {
+ Fail("Expected strtok() to return %p, got %p!\n", str + 7, ptr);
+ }
+ if (memcmp(str, result2, len) != 0)
+ {
+ Fail("strtok altered the string in an unexpeced way!\n");
+ }
+
+ ptr = strtok(NULL, "X");
+ if (ptr != NULL)
+ {
+ Fail("Expected strtok() to return %p, got %p!\n", NULL, ptr);
+ }
+ if (memcmp(str, result2, len) != 0)
+ {
+ Fail("strtok altered the string in an unexpeced way!\n");
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/strtok/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/strtok/test1/testinfo.dat
new file mode 100644
index 0000000000..f3773514c2
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strtok/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 = strtok
+Name = Test #1 for strtok
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Search for a number of tokens within strings. Check that the return values
+= are what is expect, and also that the strings match up with our expected
+= results.
diff --git a/src/pal/tests/palsuite/c_runtime/strtoul/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/strtoul/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strtoul/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/strtoul/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/strtoul/test1/CMakeLists.txt
new file mode 100644
index 0000000000..61dbd4f9a3
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strtoul/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_strtoul_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_strtoul_test1 coreclrpal)
+
+target_link_libraries(paltest_strtoul_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/strtoul/test1/test1.c b/src/pal/tests/palsuite/c_runtime/strtoul/test1/test1.c
new file mode 100644
index 0000000000..344671b5cc
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strtoul/test1/test1.c
@@ -0,0 +1,73 @@
+// Licensed to the .NET Foundation under one or more 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 stroul with different bases and overflows, as well as valid input.
+** Makes sure that the end pointer is correct.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+char teststr1[] = "12345";
+char teststr2[] = "Z";
+char teststr3[] = "4294967295";
+char teststr4[] = "4294967296";
+
+typedef struct
+{
+ char *str;
+ char *end;
+ int base;
+ ULONG result;
+} TestCase;
+
+TestCase TestCases[] =
+{
+ { teststr1, teststr1 + 3, 4, 27},
+ { teststr1, teststr1 + 5, 10, 12345},
+ { teststr2, teststr2, 10, 0},
+ { teststr3, teststr3+10, 10, 4294967295ul},
+ { teststr4, teststr4+10, 10, 4294967295ul}
+};
+
+int NumCases = sizeof(TestCases) / sizeof(TestCases[0]);
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ char *end;
+ ULONG l;
+ int i;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ for (i=0; i<NumCases; i++)
+ {
+ l = strtoul(TestCases[i].str, &end, TestCases[i].base);
+
+ if (l != TestCases[i].result)
+ {
+ Fail("ERROR: Expected strtoul to return %u, got %u\n",
+ TestCases[i].result, l);
+ }
+
+ if (end != TestCases[i].end)
+ {
+ Fail("ERROR: Expected strtoul to give an end value of %p, got %p\n",
+ TestCases[i].end, end);
+ }
+ }
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/strtoul/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/strtoul/test1/testinfo.dat
new file mode 100644
index 0000000000..c7fc2c0c4d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/strtoul/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 = strtoul
+Name = Test #1 for strtoul
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Tests stroul with different bases and overflows, as well as valid input.
+= Makes sure that the end pointer is correct.
diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swprintf/CMakeLists.txt
new file mode 100644
index 0000000000..cafb9536b0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/CMakeLists.txt
@@ -0,0 +1,22 @@
+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/swprintf/swprintf.h b/src/pal/tests/palsuite/c_runtime/swprintf/swprintf.h
new file mode 100644
index 0000000000..5229506064
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/swprintf.h
@@ -0,0 +1,202 @@
+// Licensed to the .NET Foundation under one or more 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.h
+**
+** Purpose: Containts common testing functions for swprintf.h
+**
+**
+**==========================================================================*/
+
+#ifndef __SWPRINTF_H__
+#define __SWPRINTF_H__
+
+void DoWStrTest(WCHAR *formatstr, WCHAR *param, WCHAR *checkstr)
+{
+ WCHAR buf[256] = { 0 };
+
+ swprintf(buf, 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 };
+
+ swprintf(buf, 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 };
+
+ swprintf(buf, 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;
+
+ swprintf(buf, 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;
+
+ swprintf(buf, 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 };
+
+ swprintf(buf, 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 };
+
+ swprintf(buf, 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 };
+
+ swprintf(buf, 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 };
+
+ swprintf(buf, 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 };
+
+ swprintf(buf, 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];
+
+ swprintf(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];
+
+ swprintf(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));
+ }
+}
+
+#endif
+
diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swprintf/test1/CMakeLists.txt
new file mode 100644
index 0000000000..fcf816029e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/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_swprintf_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_swprintf_test1 coreclrpal)
+
+target_link_libraries(paltest_swprintf_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/swprintf/test1/test1.c
new file mode 100644
index 0000000000..626040d9f7
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/test1/test1.c
@@ -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: test1.c
+**
+** Purpose: General test to see if swprintf works correctly
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../swprintf.h"
+
+/*
+ * Uses memcmp & wcslen
+ */
+
+int __cdecl main(int argc, char *argv[])
+{
+ WCHAR *checkstr;
+ WCHAR buf[256];
+
+ if (PAL_Initialize(argc, argv) != 0)
+ {
+ return FAIL;
+ }
+
+ checkstr = convert("hello world");
+ swprintf(buf, convert("hello world"));
+
+ if (memcmp(checkstr, buf, wcslen(checkstr)*2+2) != 0)
+ {
+ Fail("ERROR: Expected \"%s\", got \"%s\".\n", "hello world",
+ convertC(buf));
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/swprintf/test1/testinfo.dat
new file mode 100644
index 0000000000..f43d462daf
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/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
+Name = Positive Test for swprintf
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= General test to see if swprintf works correctly
diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test10/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swprintf/test10/CMakeLists.txt
new file mode 100644
index 0000000000..302c5e5923
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/test10/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test10.c
+)
+
+add_executable(paltest_swprintf_test10
+ ${SOURCES}
+)
+
+add_dependencies(paltest_swprintf_test10 coreclrpal)
+
+target_link_libraries(paltest_swprintf_test10
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test10/test10.c b/src/pal/tests/palsuite/c_runtime/swprintf/test10/test10.c
new file mode 100644
index 0000000000..61aef593a0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/test10/test10.c
@@ -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 swprintf with octal numbers
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../swprintf.h"
+
+/*
+ * Uses memcmp & 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, "0x0000000000000042",
+ 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/swprintf/test10/testinfo.dat b/src/pal/tests/palsuite/c_runtime/swprintf/test10/testinfo.dat
new file mode 100644
index 0000000000..e860bb26e7
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/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
+Name = Positive Test for swprintf
+TYPE = DEFAULT
+EXE1 = test10
+Description
+= Tests swprintf with octal numbers
diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test11/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swprintf/test11/CMakeLists.txt
new file mode 100644
index 0000000000..484d57ef58
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/test11/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test11.c
+)
+
+add_executable(paltest_swprintf_test11
+ ${SOURCES}
+)
+
+add_dependencies(paltest_swprintf_test11 coreclrpal)
+
+target_link_libraries(paltest_swprintf_test11
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test11/test11.c b/src/pal/tests/palsuite/c_runtime/swprintf/test11/test11.c
new file mode 100644
index 0000000000..216f9acdbb
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/test11/test11.c
@@ -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: Tests swprintf with unsigned numbers
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../swprintf.h"
+
+/*
+ * Uses memcmp & 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, "0x0000000000000042",
+ 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/swprintf/test11/testinfo.dat b/src/pal/tests/palsuite/c_runtime/swprintf/test11/testinfo.dat
new file mode 100644
index 0000000000..430a777e7a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/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
+Name = Positive Test for swprintf
+TYPE = DEFAULT
+EXE1 = test11
+Description
+= Tests swprintf with unsigned numbers
diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test12/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swprintf/test12/CMakeLists.txt
new file mode 100644
index 0000000000..6d45ee4646
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/test12/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test12.c
+)
+
+add_executable(paltest_swprintf_test12
+ ${SOURCES}
+)
+
+add_dependencies(paltest_swprintf_test12 coreclrpal)
+
+target_link_libraries(paltest_swprintf_test12
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test12/test12.c b/src/pal/tests/palsuite/c_runtime/swprintf/test12/test12.c
new file mode 100644
index 0000000000..a41b0ddbd3
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/test12/test12.c
@@ -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: Tests swprintf with hex numbers (lowercase)
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../swprintf.h"
+
+/*
+ * Uses memcmp & 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/swprintf/test12/testinfo.dat b/src/pal/tests/palsuite/c_runtime/swprintf/test12/testinfo.dat
new file mode 100644
index 0000000000..d53582644f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/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
+Name = Positive Test for swprintf
+TYPE = DEFAULT
+EXE1 = test12
+Description
+= Tests swprintf with hex numbers (lowercase)
diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test13/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swprintf/test13/CMakeLists.txt
new file mode 100644
index 0000000000..20f6f0df7b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/test13/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test13.c
+)
+
+add_executable(paltest_swprintf_test13
+ ${SOURCES}
+)
+
+add_dependencies(paltest_swprintf_test13 coreclrpal)
+
+target_link_libraries(paltest_swprintf_test13
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test13/test13.c b/src/pal/tests/palsuite/c_runtime/swprintf/test13/test13.c
new file mode 100644
index 0000000000..b99232f7ea
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/test13/test13.c
@@ -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 swprintf with hex numbers (uppercase)
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../swprintf.h"
+
+/*
+ * Uses memcmp & 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/swprintf/test13/testinfo.dat b/src/pal/tests/palsuite/c_runtime/swprintf/test13/testinfo.dat
new file mode 100644
index 0000000000..1ce172414c
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/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
+Name = Positive Test for swprintf
+TYPE = DEFAULT
+EXE1 = test13
+Description
+= Tests swprintf with hex numbers (uppercase)
diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test14/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swprintf/test14/CMakeLists.txt
new file mode 100644
index 0000000000..a052f60116
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/test14/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test14.c
+)
+
+add_executable(paltest_swprintf_test14
+ ${SOURCES}
+)
+
+add_dependencies(paltest_swprintf_test14 coreclrpal)
+
+target_link_libraries(paltest_swprintf_test14
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test14/test14.c b/src/pal/tests/palsuite/c_runtime/swprintf/test14/test14.c
new file mode 100644
index 0000000000..bcfd6a7c24
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/test14/test14.c
@@ -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: test14.c
+**
+** Purpose: Tests swprintf with exponential format doubles (lowercase)
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../swprintf.h"
+
+/*
+ * Uses memcmp & 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/swprintf/test14/testinfo.dat b/src/pal/tests/palsuite/c_runtime/swprintf/test14/testinfo.dat
new file mode 100644
index 0000000000..7f3451820b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/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
+Name = Positive Test for swprintf
+TYPE = DEFAULT
+EXE1 = test14
+Description
+= Tests swprintf with exponential format doubles (lowercase)
diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test15/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swprintf/test15/CMakeLists.txt
new file mode 100644
index 0000000000..7bc2da122f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/test15/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test15.c
+)
+
+add_executable(paltest_swprintf_test15
+ ${SOURCES}
+)
+
+add_dependencies(paltest_swprintf_test15 coreclrpal)
+
+target_link_libraries(paltest_swprintf_test15
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test15/test15.c b/src/pal/tests/palsuite/c_runtime/swprintf/test15/test15.c
new file mode 100644
index 0000000000..215afbe093
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/test15/test15.c
@@ -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 with exponential format doubles (uppercase)
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../swprintf.h"
+
+/*
+ * Uses memcmp & 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/swprintf/test15/testinfo.dat b/src/pal/tests/palsuite/c_runtime/swprintf/test15/testinfo.dat
new file mode 100644
index 0000000000..a6044e7bcc
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/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
+Name = Positive Test for swprintf
+TYPE = DEFAULT
+EXE1 = test15
+Description
+= Tests swprintf with exponential format doubles (uppercase)
diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test16/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swprintf/test16/CMakeLists.txt
new file mode 100644
index 0000000000..e6ad3abd3f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/test16/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test16.c
+)
+
+add_executable(paltest_swprintf_test16
+ ${SOURCES}
+)
+
+add_dependencies(paltest_swprintf_test16 coreclrpal)
+
+target_link_libraries(paltest_swprintf_test16
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test16/test16.c b/src/pal/tests/palsuite/c_runtime/swprintf/test16/test16.c
new file mode 100644
index 0000000000..859afed8dd
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/test16/test16.c
@@ -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: test16.c
+**
+** Purpose:Tests swprintf with decimal point format doubles
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../swprintf.h"
+
+/*
+ * Uses memcmp & 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/swprintf/test16/testinfo.dat b/src/pal/tests/palsuite/c_runtime/swprintf/test16/testinfo.dat
new file mode 100644
index 0000000000..d2f9a125c4
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/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
+Name = Positive Test for swprintf
+TYPE = DEFAULT
+EXE1 = test16
+Description
+= Tests swprintf with decimal point format doubles
diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test17/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swprintf/test17/CMakeLists.txt
new file mode 100644
index 0000000000..401285b740
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/test17/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test17.c
+)
+
+add_executable(paltest_swprintf_test17
+ ${SOURCES}
+)
+
+add_dependencies(paltest_swprintf_test17 coreclrpal)
+
+target_link_libraries(paltest_swprintf_test17
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test17/test17.c b/src/pal/tests/palsuite/c_runtime/swprintf/test17/test17.c
new file mode 100644
index 0000000000..480f2b2fe1
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/test17/test17.c
@@ -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: test17.c
+**
+** Purpose:Tests swprintf with compact format doubles (lowercase)
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../swprintf.h"
+
+/*
+ * Uses memcmp & 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/swprintf/test17/testinfo.dat b/src/pal/tests/palsuite/c_runtime/swprintf/test17/testinfo.dat
new file mode 100644
index 0000000000..f26029c659
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/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
+Name = Positive Test for swprintf
+TYPE = DEFAULT
+EXE1 = test17
+Description
+= Tests swprintf with compact format doubles (lowercase)
diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test18/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swprintf/test18/CMakeLists.txt
new file mode 100644
index 0000000000..210ab2c7ec
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/test18/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test18.c
+)
+
+add_executable(paltest_swprintf_test18
+ ${SOURCES}
+)
+
+add_dependencies(paltest_swprintf_test18 coreclrpal)
+
+target_link_libraries(paltest_swprintf_test18
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test18/test18.c b/src/pal/tests/palsuite/c_runtime/swprintf/test18/test18.c
new file mode 100644
index 0000000000..1ed8cd00d8
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/test18/test18.c
@@ -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 with compact format doubles (uppercase)
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../swprintf.h"
+
+/*
+ * Uses memcmp & 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/swprintf/test18/testinfo.dat b/src/pal/tests/palsuite/c_runtime/swprintf/test18/testinfo.dat
new file mode 100644
index 0000000000..6a8ca702ff
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/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
+Name = Positive Test for swprintf
+TYPE = DEFAULT
+EXE1 = test18
+Description
+= Tests swprintf with compact format doubles (uppercase)
diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test19/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swprintf/test19/CMakeLists.txt
new file mode 100644
index 0000000000..b9d44a3031
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/test19/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test19.c
+)
+
+add_executable(paltest_swprintf_test19
+ ${SOURCES}
+)
+
+add_dependencies(paltest_swprintf_test19 coreclrpal)
+
+target_link_libraries(paltest_swprintf_test19
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test19/test19.c b/src/pal/tests/palsuite/c_runtime/swprintf/test19/test19.c
new file mode 100644
index 0000000000..5199cc3cd9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/test19/test19.c
@@ -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, 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/testinfo.dat b/src/pal/tests/palsuite/c_runtime/swprintf/test19/testinfo.dat
new file mode 100644
index 0000000000..cbd572a35c
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/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
+Name = Positive Test for swprintf
+TYPE = DEFAULT
+EXE1 = test19
+Description
+= Tests swprintf with argument specified precision
diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swprintf/test2/CMakeLists.txt
new file mode 100644
index 0000000000..84446d5f6d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/test2/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test2.c
+)
+
+add_executable(paltest_swprintf_test2
+ ${SOURCES}
+)
+
+add_dependencies(paltest_swprintf_test2 coreclrpal)
+
+target_link_libraries(paltest_swprintf_test2
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test2/test2.c b/src/pal/tests/palsuite/c_runtime/swprintf/test2/test2.c
new file mode 100644
index 0000000000..deffd3edd7
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/test2/test2.c
@@ -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: test2.c
+**
+** Purpose: Tests swprintf with strings
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../swprintf.h"
+
+/*
+ * Uses memcmp & 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 %ws"), convert("bar"), convert("foo bar"));
+ DoWStrTest(convert("foo %ls"), 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/swprintf/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/swprintf/test2/testinfo.dat
new file mode 100644
index 0000000000..d93fa7b400
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/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
+Name = Positive Test for swprintf
+TYPE = DEFAULT
+EXE1 = test2
+Description
+= Tests swprintf with strings
diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swprintf/test3/CMakeLists.txt
new file mode 100644
index 0000000000..6dbd8a3c36
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/test3/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test3.c
+)
+
+add_executable(paltest_swprintf_test3
+ ${SOURCES}
+)
+
+add_dependencies(paltest_swprintf_test3 coreclrpal)
+
+target_link_libraries(paltest_swprintf_test3
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test3/test3.c b/src/pal/tests/palsuite/c_runtime/swprintf/test3/test3.c
new file mode 100644
index 0000000000..42875c0640
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/test3/test3.c
@@ -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: test3.c
+**
+** Purpose: Tests swprintf with wide strings
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../swprintf.h"
+
+/*
+ * Uses memcmp & 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/swprintf/test3/testinfo.dat b/src/pal/tests/palsuite/c_runtime/swprintf/test3/testinfo.dat
new file mode 100644
index 0000000000..923a8f0efd
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/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
+Name = Positive Test for swprintf
+TYPE = DEFAULT
+EXE1 = test3
+Description
+= Tests swprintf with wide strings
diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test4/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swprintf/test4/CMakeLists.txt
new file mode 100644
index 0000000000..a665948c47
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/test4/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test4.c
+)
+
+add_executable(paltest_swprintf_test4
+ ${SOURCES}
+)
+
+add_dependencies(paltest_swprintf_test4 coreclrpal)
+
+target_link_libraries(paltest_swprintf_test4
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test4/test4.c b/src/pal/tests/palsuite/c_runtime/swprintf/test4/test4.c
new file mode 100644
index 0000000000..02cc3f9005
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/test4/test4.c
@@ -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 with pointers
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../swprintf.h"
+
+/*
+ * Uses memcmp & 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, "pointer to 0X1234567887654321",
+ 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, "pointer to 0X1234567887654321",
+ convert("1234567887654321"));
+#endif
+
+ PAL_Terminate();
+ return PASS;
+}
+
diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test4/testinfo.dat b/src/pal/tests/palsuite/c_runtime/swprintf/test4/testinfo.dat
new file mode 100644
index 0000000000..dc481d32f1
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/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
+Name = Positive Test for swprintf
+TYPE = DEFAULT
+EXE1 = test4
+Description
+= Tests swprintf with pointers
diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test5/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swprintf/test5/CMakeLists.txt
new file mode 100644
index 0000000000..8268ec2963
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/test5/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test5.c
+)
+
+add_executable(paltest_swprintf_test5
+ ${SOURCES}
+)
+
+add_dependencies(paltest_swprintf_test5 coreclrpal)
+
+target_link_libraries(paltest_swprintf_test5
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test5/test5.c b/src/pal/tests/palsuite/c_runtime/swprintf/test5/test5.c
new file mode 100644
index 0000000000..e85adc120e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/test5/test5.c
@@ -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: test5.c
+**
+** Purpose:Tests swprintf with the count specifier
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../swprintf.h"
+
+/*
+ * Uses memcmp & 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"));
+
+ PAL_Terminate();
+
+ free(longStr);
+ free(longResult);
+
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test5/testinfo.dat b/src/pal/tests/palsuite/c_runtime/swprintf/test5/testinfo.dat
new file mode 100644
index 0000000000..ef1f1ffc5a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/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 = swprintf
+Name = Positive Test for swprintf
+TYPE = DEFAULT
+EXE1 = test5
+Description
+= Tests swprintf with the count specifier
diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test6/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swprintf/test6/CMakeLists.txt
new file mode 100644
index 0000000000..6a90c0b88e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/test6/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test6.c
+)
+
+add_executable(paltest_swprintf_test6
+ ${SOURCES}
+)
+
+add_dependencies(paltest_swprintf_test6 coreclrpal)
+
+target_link_libraries(paltest_swprintf_test6
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test6/test6.c b/src/pal/tests/palsuite/c_runtime/swprintf/test6/test6.c
new file mode 100644
index 0000000000..ecd6374264
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/test6/test6.c
@@ -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 swprintf with character
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../swprintf.h"
+
+/*
+ * Uses memcmp & wcslen
+ */
+
+int __cdecl main(int argc, char *argv[])
+{
+ WCHAR wb = (WCHAR) 'b';
+
+ if (PAL_Initialize(argc, argv) != 0)
+ {
+ return FAIL;
+ }
+
+
+ DoWCharTest(convert("foo %c"), wb, convert("foo b"));
+ DoCharTest(convert("foo %hc"), 'c', convert("foo c"));
+ DoWCharTest(convert("foo %lc"), wb, convert("foo b"));
+ DoWCharTest(convert("foo %Lc"), wb, convert("foo b"));
+ DoWCharTest(convert("foo %I64c"), wb, convert("foo b"));
+ DoWCharTest(convert("foo %5c"), wb, convert("foo b"));
+ DoWCharTest(convert("foo %.0c"), wb, convert("foo b"));
+ DoWCharTest(convert("foo %-5c"), wb, convert("foo b "));
+ DoWCharTest(convert("foo %05c"), wb, convert("foo 0000b"));
+ DoWCharTest(convert("foo % c"), wb, convert("foo b"));
+ DoWCharTest(convert("foo %#c"), wb, convert("foo b"));
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test6/testinfo.dat b/src/pal/tests/palsuite/c_runtime/swprintf/test6/testinfo.dat
new file mode 100644
index 0000000000..4224d19519
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/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
+Name = Positive Test for swprintf
+TYPE = DEFAULT
+EXE1 = test6
+Description
+= Tests swprintf with characters
diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test7/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swprintf/test7/CMakeLists.txt
new file mode 100644
index 0000000000..2b1c30cb56
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/test7/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test7.c
+)
+
+add_executable(paltest_swprintf_test7
+ ${SOURCES}
+)
+
+add_dependencies(paltest_swprintf_test7 coreclrpal)
+
+target_link_libraries(paltest_swprintf_test7
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test7/test7.c b/src/pal/tests/palsuite/c_runtime/swprintf/test7/test7.c
new file mode 100644
index 0000000000..e231ada3d2
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/test7/test7.c
@@ -0,0 +1,48 @@
+// Licensed to the .NET Foundation under one or more 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 with wide characters
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../swprintf.h"
+
+/*
+ * Uses memcmp & wcslen
+ */
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ WCHAR wb = (WCHAR) 'b';
+
+ if (PAL_Initialize(argc, argv) != 0)
+ {
+ return FAIL;
+ }
+
+
+ DoCharTest(convert("foo %C"), 'c', convert("foo c"));
+ DoWCharTest(convert("foo %hc"), wb, convert("foo b"));
+ DoCharTest(convert("foo %lC"), 'c', convert("foo c"));
+ DoCharTest(convert("foo %LC"), 'c', convert("foo c"));
+ DoCharTest(convert("foo %I64C"), 'c', convert("foo c"));
+ DoCharTest(convert("foo %5C"), 'c', convert("foo c"));
+ DoCharTest(convert("foo %.0C"), 'c', convert("foo c"));
+ DoCharTest(convert("foo %-5C"), 'c', convert("foo c "));
+ DoCharTest(convert("foo %05C"), 'c', convert("foo 0000c"));
+ DoCharTest(convert("foo % C"), 'c', convert("foo c"));
+ DoCharTest(convert("foo %#C"), 'c', convert("foo c"));
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test7/testinfo.dat b/src/pal/tests/palsuite/c_runtime/swprintf/test7/testinfo.dat
new file mode 100644
index 0000000000..7facc90b58
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/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
+Name = Positive Test for swprintf
+TYPE = DEFAULT
+EXE1 = test7
+Description
+= Tests swprintf with wide characters
diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test8/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swprintf/test8/CMakeLists.txt
new file mode 100644
index 0000000000..281e6df097
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/test8/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test8.c
+)
+
+add_executable(paltest_swprintf_test8
+ ${SOURCES}
+)
+
+add_dependencies(paltest_swprintf_test8 coreclrpal)
+
+target_link_libraries(paltest_swprintf_test8
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test8/test8.c b/src/pal/tests/palsuite/c_runtime/swprintf/test8/test8.c
new file mode 100644
index 0000000000..b4be28e78d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/test8/test8.c
@@ -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: Tests swprintf with decimal numbers
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../swprintf.h"
+
+/*
+ * Uses memcmp & 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, "0x0000000000000042",
+ 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/swprintf/test8/testinfo.dat b/src/pal/tests/palsuite/c_runtime/swprintf/test8/testinfo.dat
new file mode 100644
index 0000000000..d5858b2cfe
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/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
+Name = Positive Test for swprintf
+TYPE = DEFAULT
+EXE1 = test8
+Description
+= Tests swprintf with decimal numbers
diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test9/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swprintf/test9/CMakeLists.txt
new file mode 100644
index 0000000000..054b40a998
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/test9/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test9.c
+)
+
+add_executable(paltest_swprintf_test9
+ ${SOURCES}
+)
+
+add_dependencies(paltest_swprintf_test9 coreclrpal)
+
+target_link_libraries(paltest_swprintf_test9
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test9/test9.c b/src/pal/tests/palsuite/c_runtime/swprintf/test9/test9.c
new file mode 100644
index 0000000000..2f5429e5fd
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/test9/test9.c
@@ -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 swprintf with integer numbers
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../swprintf.h"
+
+/*
+ * Uses memcmp & 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, "0x0000000000000042",
+ 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/swprintf/test9/testinfo.dat b/src/pal/tests/palsuite/c_runtime/swprintf/test9/testinfo.dat
new file mode 100644
index 0000000000..7ef9eed134
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/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
+Name = Positive Test for swprintf
+TYPE = DEFAULT
+EXE1 = test9
+Description
+= Tests swprintf with integer numbers
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swscanf/CMakeLists.txt
new file mode 100644
index 0000000000..59f39a5f58
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/CMakeLists.txt
@@ -0,0 +1,20 @@
+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(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/swscanf/swscanf.h b/src/pal/tests/palsuite/c_runtime/swscanf/swscanf.h
new file mode 100644
index 0000000000..1cac450cf4
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/swscanf.h
@@ -0,0 +1,262 @@
+// Licensed to the .NET Foundation under one or more 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: swscanf.h
+**
+** Purpose: Contains common testing functions for swscanf.h
+**
+**
+**==========================================================================*/
+
+#ifndef __SWSCANF_H__
+#define __SWSCANF_H__
+
+void DoVoidTest(WCHAR *inputstr, WCHAR *formatstr)
+{
+ char buf[256] = { 0 };
+ int i;
+ int ret;
+
+ ret = swscanf(inputstr, formatstr, buf);
+ if (ret != 0)
+ {
+ Fail("ERROR: Expected sscanf to return 0, got %d.\n"
+ "Using \"%s\" in \"%s\".\n", ret, convertC(inputstr),
+ convertC(formatstr));
+ }
+
+ for (i=0; i<256; i++)
+ {
+ if (buf[i] != 0)
+ {
+ Fail("ERROR: Parameter unexpectedly modified scanning \"%s\" "
+ "using \"%s\".\n", convertC(inputstr),
+ convertC(formatstr));
+ }
+ }
+
+}
+
+void DoStrTest(WCHAR *inputstr, WCHAR *formatstr, char *checkstr)
+{
+ char buf[256] = { 0 };
+ int ret;
+
+ ret = swscanf(inputstr, formatstr, buf);
+ if (ret != 1)
+ {
+ Fail("ERROR: Expected swscanf to return 1, got %d.\n"
+ "Using \"%s\" in \"%s\".\n", ret, convertC(inputstr),
+ convertC(formatstr));
+ }
+
+ if (memcmp(checkstr, buf, strlen(checkstr) + 1) != 0)
+ {
+ Fail("ERROR: scanned string incorrectly from \"%s\" using \"%s\".\n"
+ "Expected \"%s\", got \"%s\".\n", convertC(inputstr),
+ convertC(formatstr), checkstr,
+ buf);
+ }
+
+}
+
+void DoWStrTest(WCHAR *inputstr, WCHAR *formatstr, WCHAR *checkstr)
+{
+ WCHAR buf[256] = { 0 };
+ int ret;
+
+ ret = swscanf(inputstr, formatstr, buf);
+ if (ret != 1)
+ {
+ Fail("ERROR: Expected swscanf to return 1, got %d.\n"
+ "Using \"%s\" in \"%s\".\n", ret, convertC(inputstr),
+ convertC(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", convertC(inputstr),
+ convertC(formatstr), convertC(checkstr),
+ convertC(buf));
+ }
+
+}
+
+void DoNumTest(WCHAR *inputstr, WCHAR *formatstr, int checknum)
+{
+ int num = 0;
+ int ret;
+
+ ret = swscanf(inputstr, formatstr, &num);
+ if (ret != 1)
+ {
+ Fail("ERROR: Expected swscanf to return 1, got %d.\n"
+ "Using \"%s\" in \"%s\".\n", ret, convertC(inputstr),
+ convertC(formatstr));
+ }
+
+ if (checknum != num)
+ {
+ Fail("ERROR: scanned number incorrectly from \"%s\" using \"%s\".\n"
+ "Expected %d, got %d.\n", convertC(inputstr),
+ convertC(formatstr), checknum, num);
+ }
+}
+
+void DoShortNumTest(WCHAR *inputstr, WCHAR *formatstr, short checknum)
+{
+ short num = 0;
+ int ret;
+
+ ret = swscanf(inputstr, formatstr, &num);
+ if (ret != 1)
+ {
+ Fail("ERROR: Expected swscanf to return 1, got %d.\n"
+ "Using \"%s\" in \"%s\".\n", ret, convertC(inputstr),
+ convertC(formatstr));
+ }
+
+ if (checknum != num)
+ {
+ Fail("ERROR: scanned number incorrectly from \"%s\" using \"%s\".\n"
+ "Expected %hd, got %hd.\n", convertC(inputstr),
+ convertC(formatstr), checknum, num);
+ }
+}
+
+void DoI64NumTest(WCHAR *inputstr, WCHAR *formatstr, INT64 checknum)
+{
+ char buf[256];
+ char check[256];
+ INT64 num;
+ int ret;
+
+ ret = swscanf(inputstr, formatstr, &num);
+ if (ret != 1)
+ {
+ Fail("ERROR: Expected swscanf to return 1, got %d.\n"
+ "Using \"%s\" in \"%s\".\n", ret, convertC(inputstr),
+ convertC(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", convertC(inputstr),
+ convertC(formatstr), check, buf);
+ }
+}
+
+void DoCharTest(WCHAR *inputstr, WCHAR*formatstr, char* checkchars, int numchars)
+{
+ char buf[256];
+ int ret;
+ int i;
+
+ for (i=0; i<256; i++)
+ buf[i] = (char)-1;
+
+ ret = swscanf(inputstr, formatstr, buf);
+ if (ret != 1)
+ {
+ Fail("ERROR: Expected swscanf to return 1, got %d.\n"
+ "Using \"%s\" in \"%s\".\n", ret, convertC(inputstr),
+ convertC(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", convertC(inputstr),
+ convertC(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",
+ convertC(inputstr), convertC(formatstr), numchars);
+ }
+}
+
+void DoWCharTest(WCHAR *inputstr, WCHAR *formatstr, WCHAR *checkchars, int numchars)
+{
+ WCHAR buf[256];
+ int ret;
+ int i;
+
+ for (i=0; i<256; i++)
+ buf[i] = (WCHAR)-1;
+
+ ret = swscanf(inputstr, formatstr, buf);
+ if (ret != 1)
+ {
+ Fail("ERROR: Expected swscanf to return 1, got %d.\n"
+ "Using \"%s\" in \"%s\".\n", ret, convertC(inputstr),
+ convertC(formatstr));
+ }
+
+ if (memcmp(buf, checkchars, numchars*2) != 0)
+ {
+ buf[numchars] = 0;
+
+ Fail("ERROR: scanned wide character(s) incorrectly from \"%s\" using \"%s\".\n"
+ "Expected %s, got %s.\n", convertC(inputstr),
+ convertC(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",
+ convertC(inputstr), convertC(formatstr), numchars);
+ }
+}
+
+
+void DoFloatTest(WCHAR *inputstr, WCHAR *formatstr, float checkval)
+{
+ char buf[256] = { 0 };
+ float val;
+ int ret;
+ int i;
+
+ for (i=0; i<256; i++)
+ buf[i] = (char)-1;
+
+ ret = swscanf(inputstr, formatstr, buf);
+ val = *(float*)buf;
+
+ if (ret != 1)
+ {
+ Fail("ERROR: Expected swscanf to return 1, got %d.\n"
+ "Using \"%s\" in \"%s\".\n", ret, convertC(inputstr),
+ convertC(formatstr));
+ }
+
+ if (val != checkval)
+ {
+ Fail("ERROR: scanned float incorrectly from \"%s\" using \"%s\".\n"
+ "Expected \"%f\", got \"%f\".\n", convertC(inputstr),
+ convertC(formatstr), checkval, val);
+ }
+
+ if (buf[4] != (char)-1)
+ {
+ Fail("ERROR: overflow occurred in scanning float from \"%s\" "
+ "using \"%s\".\n", convertC(inputstr), convertC(formatstr));
+
+ }
+}
+
+
+#endif
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swscanf/test1/CMakeLists.txt
new file mode 100644
index 0000000000..030aaaf709
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/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_swscanf_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_swscanf_test1 coreclrpal)
+
+target_link_libraries(paltest_swscanf_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/swscanf/test1/test1.c
new file mode 100644
index 0000000000..66136e57c5
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/test1/test1.c
@@ -0,0 +1,53 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*============================================================================
+**
+** Source: test1.c
+**
+** Purpose: General test of swscanf
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../swscanf.h"
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ int num;
+ int ret;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ DoVoidTest(convert("foo bar"), convert("foo"));
+ DoVoidTest(convert("foo bar"), convert("baz"));
+ DoVoidTest(convert("foo bar"), convert("foo %*s"));
+
+ DoStrTest(convert("foo % bar"), convert("foo %% %S"), "bar");
+ DoStrTest(convert("foo bar baz"), convert("foo %bar %S"), "baz");
+
+ DoVoidTest(convert("foo bar baz"), convert("foo % bar %S"));
+ DoVoidTest(convert("foo bar baz"), convert("foo% bar %S"));
+
+
+ ret = swscanf(convert("foo bar baz"), convert("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/swscanf/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/swscanf/test1/testinfo.dat
new file mode 100644
index 0000000000..b6366a73d0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/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 = swscanf
+Name = Positive Test for swscanf
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= General test of swscanf
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test10/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swscanf/test10/CMakeLists.txt
new file mode 100644
index 0000000000..f7c8b284ff
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/test10/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test10.c
+)
+
+add_executable(paltest_swscanf_test10
+ ${SOURCES}
+)
+
+add_dependencies(paltest_swscanf_test10 coreclrpal)
+
+target_link_libraries(paltest_swscanf_test10
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test10/test10.c b/src/pal/tests/palsuite/c_runtime/swscanf/test10/test10.c
new file mode 100644
index 0000000000..a8628e0de1
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/test10/test10.c
@@ -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: test10.c
+**
+** Purpose:Tests swscanf with wide characters
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../swscanf.h"
+
+int __cdecl main(int argc, char *argv[])
+{
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ DoCharTest(convert("1234"), convert("%C"), "1", 1);
+ DoCharTest(convert("abc"), convert("%2C"), "ab", 2);
+ DoCharTest(convert(" ab"), convert("%C"), " ", 1);
+ DoCharTest(convert("ab"), convert("%hC"), "a", 1);
+ DoWCharTest(convert("ab"), convert("%lC"), convert("a"), 1);
+ DoCharTest(convert("ab"), convert("%LC"), "a", 1);
+ DoCharTest(convert("ab"), convert("%I64C"), "a", 1);
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test10/testinfo.dat b/src/pal/tests/palsuite/c_runtime/swscanf/test10/testinfo.dat
new file mode 100644
index 0000000000..2f8890db20
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/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 = swscanf
+Name = Positive Test for swscanf
+TYPE = DEFAULT
+EXE1 = test10
+Description
+= Tests swscanf with wide characters
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test11/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swscanf/test11/CMakeLists.txt
new file mode 100644
index 0000000000..17066f31b8
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/test11/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test11.c
+)
+
+add_executable(paltest_swscanf_test11
+ ${SOURCES}
+)
+
+add_dependencies(paltest_swscanf_test11 coreclrpal)
+
+target_link_libraries(paltest_swscanf_test11
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test11/test11.c b/src/pal/tests/palsuite/c_runtime/swscanf/test11/test11.c
new file mode 100644
index 0000000000..f7eb4af46f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/test11/test11.c
@@ -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: test11.c
+**
+** Purpose: Tests swscanf with strings
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../swscanf.h"
+
+int __cdecl main(int argc, char *argv[])
+{
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ DoWStrTest(convert("foo bar"), convert("foo %s"), convert("bar"));
+ DoWStrTest(convert("foo bar"), convert("foo %2s"), convert("ba"));
+ DoStrTest(convert("foo bar"), convert("foo %hs"), "bar");
+ DoWStrTest(convert("foo bar"), convert("foo %ls"), convert("bar"));
+ DoWStrTest(convert("foo bar"), convert("foo %Ls"), convert("bar"));
+ DoWStrTest(convert("foo bar"), convert("foo %I64s"), convert("bar"));
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test11/testinfo.dat b/src/pal/tests/palsuite/c_runtime/swscanf/test11/testinfo.dat
new file mode 100644
index 0000000000..5bbc2e433b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/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 = swscanf
+Name = Positive Test for swscanf
+TYPE = DEFAULT
+EXE1 = test11
+Description
+= Tests swscanf with strings
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test12/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swscanf/test12/CMakeLists.txt
new file mode 100644
index 0000000000..95f5174ecb
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/test12/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test12.c
+)
+
+add_executable(paltest_swscanf_test12
+ ${SOURCES}
+)
+
+add_dependencies(paltest_swscanf_test12 coreclrpal)
+
+target_link_libraries(paltest_swscanf_test12
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test12/test12.c b/src/pal/tests/palsuite/c_runtime/swscanf/test12/test12.c
new file mode 100644
index 0000000000..f5f8bbdf8a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/test12/test12.c
@@ -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 swscanf with wide strings
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../swscanf.h"
+
+int __cdecl main(int argc, char *argv[])
+{
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ DoStrTest(convert("foo bar"), convert("foo %S"), "bar");
+ DoStrTest(convert("foo bar"), convert("foo %2S"), "ba");
+ DoStrTest(convert("foo bar"), convert("foo %hS"), "bar");
+ DoWStrTest(convert("foo bar"), convert("foo %lS"), convert("bar"));
+ DoStrTest(convert("foo bar"), convert("foo %LS"), "bar");
+ DoStrTest(convert("foo bar"), convert("foo %I64S"), "bar");
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test12/testinfo.dat b/src/pal/tests/palsuite/c_runtime/swscanf/test12/testinfo.dat
new file mode 100644
index 0000000000..06bf26af9b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/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 = swscanf
+Name = Positive Test for swscanf
+TYPE = DEFAULT
+EXE1 = test12
+Description
+= Tests swscanf with wide strings
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test13/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swscanf/test13/CMakeLists.txt
new file mode 100644
index 0000000000..47abc50313
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/test13/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test13.c
+)
+
+add_executable(paltest_swscanf_test13
+ ${SOURCES}
+)
+
+add_dependencies(paltest_swscanf_test13 coreclrpal)
+
+target_link_libraries(paltest_swscanf_test13
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test13/test13.c b/src/pal/tests/palsuite/c_runtime/swscanf/test13/test13.c
new file mode 100644
index 0000000000..1bb0b7b21c
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/test13/test13.c
@@ -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 swscanf with floats (decimal notation)
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../swscanf.h"
+
+int __cdecl main(int argc, char *argv[])
+{
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ DoFloatTest(convert("123.0"), convert("%f"), 123.0f);
+ DoFloatTest(convert("123.0"), convert("%2f"), 12.0f);
+ DoFloatTest(convert("10E1"), convert("%f"), 100.0f);
+ DoFloatTest(convert("-12.01e-2"), convert("%f"), -0.1201f);
+ DoFloatTest(convert("+12.01e-2"), convert("%f"), 0.1201f);
+ DoFloatTest(convert("-12.01e+2"), convert("%f"), -1201.0f);
+ DoFloatTest(convert("+12.01e+2"), convert("%f"), 1201.0f);
+ DoFloatTest(convert("1234567890.0123456789f"), convert("%f"), 1234567936);
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test13/testinfo.dat b/src/pal/tests/palsuite/c_runtime/swscanf/test13/testinfo.dat
new file mode 100644
index 0000000000..a3c01c5d76
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/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 = swscanf
+Name = Positive Test for swscanf
+TYPE = DEFAULT
+EXE1 = test13
+Description
+= Tests swscanf with floats (decimal notation)
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test14/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swscanf/test14/CMakeLists.txt
new file mode 100644
index 0000000000..a470436ce7
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/test14/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test14.c
+)
+
+add_executable(paltest_swscanf_test14
+ ${SOURCES}
+)
+
+add_dependencies(paltest_swscanf_test14 coreclrpal)
+
+target_link_libraries(paltest_swscanf_test14
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test14/test14.c b/src/pal/tests/palsuite/c_runtime/swscanf/test14/test14.c
new file mode 100644
index 0000000000..80581b726f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/test14/test14.c
@@ -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: test14.c
+**
+** Purpose: Tests swscanf with floats (exponential notation, lowercase)
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../swscanf.h"
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ DoFloatTest(convert("123.0"), convert("%e"), 123.0f);
+ DoFloatTest(convert("123.0"), convert("%2e"), 12.0f);
+ DoFloatTest(convert("10E1"), convert("%e"), 100.0f);
+ DoFloatTest(convert("-12.01e-2"), convert("%e"), -0.1201f);
+ DoFloatTest(convert("+12.01e-2"), convert("%e"), 0.1201f);
+ DoFloatTest(convert("-12.01e+2"), convert("%e"), -1201.0f);
+ DoFloatTest(convert("+12.01e+2"), convert("%e"), 1201.0f);
+ DoFloatTest(convert("1234567890.0123456789f"), convert("%e"), 1234567936);
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test14/testinfo.dat b/src/pal/tests/palsuite/c_runtime/swscanf/test14/testinfo.dat
new file mode 100644
index 0000000000..184a3e7fb8
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/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 = swscanf
+Name = Positive Test for swscanf
+TYPE = DEFAULT
+EXE1 = test14
+Description
+= Tests swscanf with floats (exponential notation, lowercase)
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test15/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swscanf/test15/CMakeLists.txt
new file mode 100644
index 0000000000..d89650b12c
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/test15/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test15.c
+)
+
+add_executable(paltest_swscanf_test15
+ ${SOURCES}
+)
+
+add_dependencies(paltest_swscanf_test15 coreclrpal)
+
+target_link_libraries(paltest_swscanf_test15
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test15/test15.c b/src/pal/tests/palsuite/c_runtime/swscanf/test15/test15.c
new file mode 100644
index 0000000000..9b7d277e17
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/test15/test15.c
@@ -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: test15.c
+**
+** Purpose: Tests swscanf with floats (exponential notation, uppercase)
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../swscanf.h"
+
+int __cdecl main(int argc, char *argv[])
+{
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ DoFloatTest(convert("123.0"), convert("%E"), 123.0f);
+ DoFloatTest(convert("123.0"), convert("%2E"), 12.0f);
+ DoFloatTest(convert("10E1"), convert("%E"), 100.0f);
+ DoFloatTest(convert("-12.01e-2"), convert("%E"), -0.1201f);
+ DoFloatTest(convert("+12.01e-2"), convert("%E"), 0.1201f);
+ DoFloatTest(convert("-12.01e+2"), convert("%E"), -1201.0f);
+ DoFloatTest(convert("+12.01e+2"), convert("%E"), 1201.0f);
+ DoFloatTest(convert("1234567890.0123456789f"), convert("%E"), 1234567936);
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test15/testinfo.dat b/src/pal/tests/palsuite/c_runtime/swscanf/test15/testinfo.dat
new file mode 100644
index 0000000000..ab20463ecd
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/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 = swscanf
+Name = Positive Test for swscanf
+TYPE = DEFAULT
+EXE1 = test15
+Description
+= Tests swscanf with floats (exponential notation, uppercase)
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test16/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swscanf/test16/CMakeLists.txt
new file mode 100644
index 0000000000..a2a00f11b6
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/test16/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test16.c
+)
+
+add_executable(paltest_swscanf_test16
+ ${SOURCES}
+)
+
+add_dependencies(paltest_swscanf_test16 coreclrpal)
+
+target_link_libraries(paltest_swscanf_test16
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test16/test16.c b/src/pal/tests/palsuite/c_runtime/swscanf/test16/test16.c
new file mode 100644
index 0000000000..c83b64468b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/test16/test16.c
@@ -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 swscanf with floats (compact notation, lowercase)
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../swscanf.h"
+
+int __cdecl main(int argc, char *argv[])
+{
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ DoFloatTest(convert("123.0"), convert("%g"), 123.0f);
+ DoFloatTest(convert("123.0"), convert("%2g"), 12.0f);
+ DoFloatTest(convert("10E1"), convert("%g"), 100.0f);
+ DoFloatTest(convert("-12.01e-2"), convert("%g"), -0.1201f);
+ DoFloatTest(convert("+12.01e-2"), convert("%g"), 0.1201f);
+ DoFloatTest(convert("-12.01e+2"), convert("%g"), -1201.0f);
+ DoFloatTest(convert("+12.01e+2"), convert("%g"), 1201.0f);
+ DoFloatTest(convert("1234567890.0123456789f"), convert("%g"), 1234567936);
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test16/testinfo.dat b/src/pal/tests/palsuite/c_runtime/swscanf/test16/testinfo.dat
new file mode 100644
index 0000000000..0cfa37d63b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/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 = swscanf
+Name = Positive Test for swscanf
+TYPE = DEFAULT
+EXE1 = test16
+Description
+= Tests swscanf with floats (compact notation, lowercase)
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test17/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swscanf/test17/CMakeLists.txt
new file mode 100644
index 0000000000..c224f5d9a6
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/test17/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test17.c
+)
+
+add_executable(paltest_swscanf_test17
+ ${SOURCES}
+)
+
+add_dependencies(paltest_swscanf_test17 coreclrpal)
+
+target_link_libraries(paltest_swscanf_test17
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test17/test17.c b/src/pal/tests/palsuite/c_runtime/swscanf/test17/test17.c
new file mode 100644
index 0000000000..9023f7020a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/test17/test17.c
@@ -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 swscanf with floats (compact notation, uppercase)
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../swscanf.h"
+
+int __cdecl main(int argc, char *argv[])
+{
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ DoFloatTest(convert("123.0"), convert("%G"), 123.0f);
+ DoFloatTest(convert("123.0"), convert("%2G"), 12.0f);
+ DoFloatTest(convert("10E1"), convert("%G"), 100.0f);
+ DoFloatTest(convert("-12.01e-2"), convert("%G"), -0.1201f);
+ DoFloatTest(convert("+12.01e-2"), convert("%G"), 0.1201f);
+ DoFloatTest(convert("-12.01e+2"), convert("%G"), -1201.0f);
+ DoFloatTest(convert("+12.01e+2"), convert("%G"), 1201.0f);
+ DoFloatTest(convert("1234567890.0123456789f"), convert("%G"), 1234567936);
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test17/testinfo.dat b/src/pal/tests/palsuite/c_runtime/swscanf/test17/testinfo.dat
new file mode 100644
index 0000000000..f0489dfa41
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/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 = swscanf
+Name = Positive Test for swscanf
+TYPE = DEFAULT
+EXE1 = test17
+Description
+= Tests swscanf with floats (compact notation, uppercase)
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swscanf/test2/CMakeLists.txt
new file mode 100644
index 0000000000..a5335ddb48
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/test2/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test2.c
+)
+
+add_executable(paltest_swscanf_test2
+ ${SOURCES}
+)
+
+add_dependencies(paltest_swscanf_test2 coreclrpal)
+
+target_link_libraries(paltest_swscanf_test2
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test2/test2.c b/src/pal/tests/palsuite/c_runtime/swscanf/test2/test2.c
new file mode 100644
index 0000000000..8fbd3f86ba
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/test2/test2.c
@@ -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: test2.c
+**
+** Purpose: Test to see if swscanf handles whitespace correctly
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../swscanf.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(convert("foo bar"), convert("foo %S"), "bar");
+ DoStrTest(convert("foo\tbar"), convert("foo %S"), "bar");
+ DoStrTest(convert("foo\nbar"), convert("foo %S"), "bar");
+ DoStrTest(convert("foo\rbar"), convert("foo %S"), "bar");
+ DoStrTest(convert("foo\vbar"), convert("foo %S"), "bar");
+ DoStrTest(convert("foo\fbar"), convert("foo %S"), "bar");
+ DoStrTest(convert("foo \t\n\r\v\fbar"), convert("foo %S"), "bar");
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/swscanf/test2/testinfo.dat
new file mode 100644
index 0000000000..88768ca465
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/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 = swscanf
+Name = Positive Test for swscanf
+TYPE = DEFAULT
+EXE1 = test2
+Description
+= Test to see if swscanf handles whitespace correctly
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swscanf/test3/CMakeLists.txt
new file mode 100644
index 0000000000..5c229c26d3
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/test3/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test3.c
+)
+
+add_executable(paltest_swscanf_test3
+ ${SOURCES}
+)
+
+add_dependencies(paltest_swscanf_test3 coreclrpal)
+
+target_link_libraries(paltest_swscanf_test3
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test3/test3.c b/src/pal/tests/palsuite/c_runtime/swscanf/test3/test3.c
new file mode 100644
index 0000000000..8b05df20f2
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/test3/test3.c
@@ -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: test3.c
+**
+** Purpose: Tests swscanf with bracketed set strings
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../swscanf.h"
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ DoWStrTest(convert("bar1"), convert("%[a-z]"), convert("bar"));
+ DoWStrTest(convert("bar1"), convert("%[z-a]"), convert("bar"));
+ DoWStrTest(convert("bar1"), convert("%[ab]"), convert("ba"));
+ DoWStrTest(convert("bar1"), convert("%[ar1b]"), convert("bar1"));
+ DoWStrTest(convert("bar1"), convert("%[^4]"), convert("bar1"));
+ DoWStrTest(convert("bar1"), convert("%[^4a]"), convert("b"));
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test3/testinfo.dat b/src/pal/tests/palsuite/c_runtime/swscanf/test3/testinfo.dat
new file mode 100644
index 0000000000..998cba8b6b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/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 = swscanf
+Name = Positive Test for swscanf
+TYPE = DEFAULT
+EXE1 = test3
+Description
+= Tests swscanf with bracketed set strings
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test4/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swscanf/test4/CMakeLists.txt
new file mode 100644
index 0000000000..5e281aaf34
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/test4/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test4.c
+)
+
+add_executable(paltest_swscanf_test4
+ ${SOURCES}
+)
+
+add_dependencies(paltest_swscanf_test4 coreclrpal)
+
+target_link_libraries(paltest_swscanf_test4
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test4/test4.c b/src/pal/tests/palsuite/c_runtime/swscanf/test4/test4.c
new file mode 100644
index 0000000000..d63d25b7d0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/test4/test4.c
@@ -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 swscanf with decimal numbers
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../swscanf.h"
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ int n65535 = 65535; /* Walkaround compiler strictness */
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ DoNumTest(convert("1234d"), convert("%d"), 1234);
+ DoNumTest(convert("1234d"), convert("%2d"), 12);
+ DoNumTest(convert("-1"), convert("%d"), -1);
+ DoNumTest(convert("0x1234"), convert("%d"), 0);
+ DoNumTest(convert("012"), convert("%d"), 12);
+ DoShortNumTest(convert("-1"), convert("%hd"), n65535);
+ DoShortNumTest(convert("65536"), convert("%hd"), 0);
+ DoNumTest(convert("-1"), convert("%ld"), -1);
+ DoNumTest(convert("65536"), convert("%ld"), 65536);
+ DoNumTest(convert("-1"), convert("%Ld"), -1);
+ DoNumTest(convert("65536"), convert("%Ld"), 65536);
+ DoI64NumTest(convert("4294967296"), convert("%I64d"), I64(4294967296));
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test4/testinfo.dat b/src/pal/tests/palsuite/c_runtime/swscanf/test4/testinfo.dat
new file mode 100644
index 0000000000..e6102872d7
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/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 = swscanf
+Name = Positive Test for swscanf
+TYPE = DEFAULT
+EXE1 = test4
+Description
+= Tests swscanf with decimal numbers
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test5/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swscanf/test5/CMakeLists.txt
new file mode 100644
index 0000000000..8b259aa78d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/test5/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test5.c
+)
+
+add_executable(paltest_swscanf_test5
+ ${SOURCES}
+)
+
+add_dependencies(paltest_swscanf_test5 coreclrpal)
+
+target_link_libraries(paltest_swscanf_test5
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test5/test5.c b/src/pal/tests/palsuite/c_runtime/swscanf/test5/test5.c
new file mode 100644
index 0000000000..8ae2d81da6
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/test5/test5.c
@@ -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: test5.c
+**
+** Purpose: Tests swscanf with integer numbers
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../swscanf.h"
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ int n65535 = 65535; /* Walkaround compiler strictness */
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ DoNumTest(convert("1234d"), convert("%i"), 1234);
+ DoNumTest(convert("1234d"), convert("%2i"), 12);
+ DoNumTest(convert("-1"), convert("%i"), -1);
+ DoNumTest(convert("0x1234"), convert("%i"), 0x1234);
+ DoNumTest(convert("012"), convert("%i"), 10);
+ DoShortNumTest(convert("-1"), convert("%hi"), n65535);
+ DoShortNumTest(convert("65536"), convert("%hi"), 0);
+ DoNumTest(convert("-1"), convert("%li"), -1);
+ DoNumTest(convert("65536"), convert("%li"), 65536);
+ DoNumTest(convert("-1"), convert("%Li"), -1);
+ DoNumTest(convert("65536"), convert("%Li"), 65536);
+ DoI64NumTest(convert("4294967296"), convert("%I64i"), I64(4294967296));
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test5/testinfo.dat b/src/pal/tests/palsuite/c_runtime/swscanf/test5/testinfo.dat
new file mode 100644
index 0000000000..9991286402
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/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 = swscanf
+Name = Positive Test for swscanf
+TYPE = DEFAULT
+EXE1 = test5
+Description
+= Tests swscanf with integer numbers
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test6/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swscanf/test6/CMakeLists.txt
new file mode 100644
index 0000000000..c3fd8696ab
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/test6/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test6.c
+)
+
+add_executable(paltest_swscanf_test6
+ ${SOURCES}
+)
+
+add_dependencies(paltest_swscanf_test6 coreclrpal)
+
+target_link_libraries(paltest_swscanf_test6
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test6/test6.c b/src/pal/tests/palsuite/c_runtime/swscanf/test6/test6.c
new file mode 100644
index 0000000000..982f799cfc
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/test6/test6.c
@@ -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: test6.c
+**
+** Purpose:Tests swscanf with octal numbers
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../swscanf.h"
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ int n65535 = 65535; /* Walkaround compiler strictness */
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ DoNumTest(convert("1234d"), convert("%o"), 668);
+ DoNumTest(convert("1234d"), convert("%2o"), 10);
+ DoNumTest(convert("-1"), convert("%o"), -1);
+ DoNumTest(convert("0x1234"), convert("%o"), 0);
+ DoNumTest(convert("012"), convert("%o"), 10);
+ DoShortNumTest(convert("-1"), convert("%ho"), n65535);
+ DoShortNumTest(convert("200000"), convert("%ho"), 0);
+ DoNumTest(convert("-1"), convert("%lo"), -1);
+ DoNumTest(convert("200000"), convert("%lo"), 65536);
+ DoNumTest(convert("-1"), convert("%Lo"), -1);
+ DoNumTest(convert("200000"), convert("%Lo"), 65536);
+ DoI64NumTest(convert("40000000000"), convert("%I64o"), I64(4294967296));
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test6/testinfo.dat b/src/pal/tests/palsuite/c_runtime/swscanf/test6/testinfo.dat
new file mode 100644
index 0000000000..ca7870e962
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/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 = swscanf
+Name = Positive Test for swscanf
+TYPE = DEFAULT
+EXE1 = test6
+Description
+= Tests swscanf with octal numbers
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test7/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swscanf/test7/CMakeLists.txt
new file mode 100644
index 0000000000..00541306df
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/test7/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test7.c
+)
+
+add_executable(paltest_swscanf_test7
+ ${SOURCES}
+)
+
+add_dependencies(paltest_swscanf_test7 coreclrpal)
+
+target_link_libraries(paltest_swscanf_test7
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test7/test7.c b/src/pal/tests/palsuite/c_runtime/swscanf/test7/test7.c
new file mode 100644
index 0000000000..45e9400549
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/test7/test7.c
@@ -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: test7.c
+**
+** Purpose: Test #6 for the swscanf function
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../swscanf.h"
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ int n65535 = 65535; /* Walkaround compiler strictness */
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ DoNumTest(convert("1234d"), convert("%x"), 0x1234d);
+ DoNumTest(convert("1234d"), convert("%2x"), 0x12);
+ DoNumTest(convert("-1"), convert("%x"), -1);
+ DoNumTest(convert("0x1234"), convert("%x"), 0x1234);
+ DoNumTest(convert("012"), convert("%x"), 0x12);
+ DoShortNumTest(convert("-1"), convert("%hx"), n65535);
+ DoShortNumTest(convert("10000"), convert("%hx"), 0);
+ DoNumTest(convert("-1"), convert("%lx"), -1);
+ DoNumTest(convert("10000"), convert("%lx"), 65536);
+ DoNumTest(convert("-1"), convert("%Lx"), -1);
+ DoNumTest(convert("10000"), convert("%Lx"), 65536);
+ DoI64NumTest(convert("100000000"), convert("%I64x"), I64(4294967296));
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test7/testinfo.dat b/src/pal/tests/palsuite/c_runtime/swscanf/test7/testinfo.dat
new file mode 100644
index 0000000000..43ff8108df
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/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 = swscanf
+Name = Positive Test for swscanf
+TYPE = DEFAULT
+EXE1 = test7
+Description
+= Tests swscanf with hex numbers (lowercase)
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test8/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swscanf/test8/CMakeLists.txt
new file mode 100644
index 0000000000..d6aa631ab9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/test8/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test8.c
+)
+
+add_executable(paltest_swscanf_test8
+ ${SOURCES}
+)
+
+add_dependencies(paltest_swscanf_test8 coreclrpal)
+
+target_link_libraries(paltest_swscanf_test8
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test8/test8.c b/src/pal/tests/palsuite/c_runtime/swscanf/test8/test8.c
new file mode 100644
index 0000000000..a244de748f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/test8/test8.c
@@ -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: test8.c
+**
+** Purpose: Tests swscanf with unsigned numbers
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../swscanf.h"
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ int n65535 = 65535; /* Walkaround compiler strictness */
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ DoNumTest(convert("1234d"), convert("%u"), 1234);
+ DoNumTest(convert("1234d"), convert("%2u"), 12);
+ DoNumTest(convert("-1"), convert("%u"), -1);
+ DoNumTest(convert("0x1234"), convert("%u"), 0);
+ DoNumTest(convert("012"), convert("%u"), 12);
+ DoShortNumTest(convert("-1"), convert("%hu"), n65535);
+ DoShortNumTest(convert("65536"), convert("%hu"), 0);
+ DoNumTest(convert("-1"), convert("%lu"), -1);
+ DoNumTest(convert("65536"), convert("%lu"), 65536);
+ DoNumTest(convert("-1"), convert("%Lu"), -1);
+ DoNumTest(convert("65536"), convert("%Lu"), 65536);
+ DoI64NumTest(convert("4294967296"), convert("%I64u"), I64(4294967296));
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test8/testinfo.dat b/src/pal/tests/palsuite/c_runtime/swscanf/test8/testinfo.dat
new file mode 100644
index 0000000000..0edefb0756
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/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 = swscanf
+Name = Positive Test for swscanf
+TYPE = DEFAULT
+EXE1 = test8
+Description
+= Tests swscanf with unsigned numbers
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test9/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swscanf/test9/CMakeLists.txt
new file mode 100644
index 0000000000..4f7595a205
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/test9/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test9.c
+)
+
+add_executable(paltest_swscanf_test9
+ ${SOURCES}
+)
+
+add_dependencies(paltest_swscanf_test9 coreclrpal)
+
+target_link_libraries(paltest_swscanf_test9
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test9/test9.c b/src/pal/tests/palsuite/c_runtime/swscanf/test9/test9.c
new file mode 100644
index 0000000000..e289d26f58
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/test9/test9.c
@@ -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: test9.c
+**
+** Purpose: Tests swscanf with characters
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../swscanf.h"
+
+int __cdecl main(int argc, char *argv[])
+{
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ DoWCharTest(convert("1234"), convert("%c"), convert("1"), 1);
+ DoWCharTest(convert("1234"), convert("%c"), convert("1"), 1);
+ DoWCharTest(convert("abc"), convert("%2c"), convert("ab"), 2);
+ DoWCharTest(convert(" ab"), convert("%c"), convert(" "), 1);
+ DoCharTest(convert("ab"), convert("%hc"), "a", 1);
+ DoWCharTest(convert("ab"), convert("%lc"), convert("a"), 1);
+ DoWCharTest(convert("ab"), convert("%Lc"), convert("a"), 1);
+ DoWCharTest(convert("ab"), convert("%I64c"), convert("a"), 1);
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test9/testinfo.dat b/src/pal/tests/palsuite/c_runtime/swscanf/test9/testinfo.dat
new file mode 100644
index 0000000000..955b62b12f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/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 = swscanf
+Name = Positive Test for swscanf
+TYPE = DEFAULT
+EXE1 = test9
+Description
+= Tests swscanf with characters
diff --git a/src/pal/tests/palsuite/c_runtime/tan/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/tan/CMakeLists.txt
new file mode 100644
index 0000000000..5e1ef7f28b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/tan/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/tan/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/tan/test1/CMakeLists.txt
new file mode 100644
index 0000000000..665fc22d5e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/tan/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_tan_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_tan_test1 coreclrpal)
+
+target_link_libraries(paltest_tan_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/tan/test1/test1.c b/src/pal/tests/palsuite/c_runtime/tan/test1/test1.c
new file mode 100644
index 0000000000..443e5da6d6
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/tan/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: Test to ensure that tan return the correct values
+**
+** Dependencies: PAL_Initialize
+** PAL_Terminate
+** Fail
+** fabs
+**
+**===========================================================================*/
+
+#include <palsuite.h>
+
+// binary64 (double) has a machine epsilon of 2^-52 (approx. 2.22e-16). However, this
+// is slightly too accurate when writing tests meant to run against libm implementations
+// for various platforms. 2^-50 (approx. 8.88e-16) 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 (15-17 digits).
+
+// For example, a test with an expect result in the format of 0.xxxxxxxxxxxxxxxxx will use
+// PAL_EPSILON for the variance, while an expected result in the format of 0.0xxxxxxxxxxxxxxxxx
+// will use PAL_EPSILON / 10 and and expected result in the format of x.xxxxxxxxxxxxxxxx will
+// use PAL_EPSILON * 10.
+#define PAL_EPSILON 8.8817841970012523e-16
+
+#define PAL_NAN sqrt(-1.0)
+#define PAL_POSINF -log(0.0)
+#define PAL_NEGINF log(0.0)
+
+/**
+ * Helper test structure
+ */
+struct test
+{
+ double value; /* value to test the function with */
+ double expected; /* expected result */
+ double variance; /* maximum delta between the expected and actual result */
+};
+
+/**
+ * validate
+ *
+ * test validation function
+ */
+void __cdecl validate(double value, double expected, double variance)
+{
+ double result = tan(value);
+
+ /*
+ * The test is valid when the difference between result
+ * and expected is less than or equal to variance
+ */
+ double delta = fabs(result - expected);
+
+ if (delta > variance)
+ {
+ Fail("tan(%g) returned %20.17g when it should have returned %20.17g",
+ value, result, expected);
+ }
+}
+
+/**
+ * validate
+ *
+ * test validation function for values returning NaN
+ */
+void __cdecl validate_isnan(double value)
+{
+ double result = tan(value);
+
+ if (!_isnan(result))
+ {
+ Fail("tan(%g) returned %20.17g when it should have returned %20.17g",
+ 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.31830988618379067, 0.32951473309607836, PAL_EPSILON }, // value: 1 / pi
+ { 0.43429448190325183, 0.46382906716062964, PAL_EPSILON }, // value: log10(e)
+ { 0.63661977236758134, 0.73930295048660405, PAL_EPSILON }, // value: 2 / pi
+ { 0.69314718055994531, 0.83064087786078395, PAL_EPSILON }, // value: ln(2)
+ { 0.70710678118654752, 0.85451043200960189, PAL_EPSILON }, // value: 1 / sqrt(2)
+ { 0.78539816339744831, 1, PAL_EPSILON * 10 }, // value: pi / 4
+ { 1, 1.5574077246549022, PAL_EPSILON * 10 },
+ { 1.1283791670955126, 2.1108768356626451, PAL_EPSILON * 10 }, // value: 2 / sqrt(pi)
+ { 1.4142135623730950, 6.3341191670421916, PAL_EPSILON * 10 }, // value: sqrt(2)
+ { 1.4426950408889634, 7.7635756709721848, PAL_EPSILON * 10 }, // value: log2(e)
+ // SEE BELOW -- { 1.5707963267948966, PAL_POSINF, 0 }, // value: pi / 2
+ { 2.3025850929940457, -1.1134071468135374, PAL_EPSILON * 10 }, // value: ln(10)
+ { 2.7182818284590452, -0.45054953406980750, PAL_EPSILON }, // value: e
+ { 3.1415926535897932, 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, tan(pi / 2) would return PAL_POSINF (atan2(PAL_POSINF) does return (pi / 2)).
+ // However, it seems instead (on all supported systems), we get a different number entirely.
+ validate( 1.5707963267948966, 16331239353195370.0, 0);
+ validate(-1.5707963267948966, -16331239353195370.0, 0);
+
+ 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/tan/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/tan/test1/testinfo.dat
new file mode 100644
index 0000000000..05d6cfeb74
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/tan/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 = tan
+Name = Positive Test for tan
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Passes to tan() a series of angle value, checking that
+= each one return to correct value.
diff --git a/src/pal/tests/palsuite/c_runtime/tanh/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/tanh/CMakeLists.txt
new file mode 100644
index 0000000000..5e1ef7f28b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/tanh/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/tanh/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/tanh/test1/CMakeLists.txt
new file mode 100644
index 0000000000..f8e439dd95
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/tanh/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_tanh_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_tanh_test1 coreclrpal)
+
+target_link_libraries(paltest_tanh_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/tanh/test1/test1.c b/src/pal/tests/palsuite/c_runtime/tanh/test1/test1.c
new file mode 100644
index 0000000000..3b8f87964a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/tanh/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 tanh return the correct values
+**
+** Dependencies: PAL_Initialize
+** PAL_Terminate
+** Fail
+** fabs
+**
+**===========================================================================*/
+
+#include <palsuite.h>
+
+// binary64 (double) has a machine epsilon of 2^-52 (approx. 2.22e-16). However, this
+// is slightly too accurate when writing tests meant to run against libm implementations
+// for various platforms. 2^-50 (approx. 8.88e-16) 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 (15-17 digits).
+
+// For example, a test with an expect result in the format of 0.xxxxxxxxxxxxxxxxx will use
+// PAL_EPSILON for the variance, while an expected result in the format of 0.0xxxxxxxxxxxxxxxxx
+// will use PAL_EPSILON / 10 and and expected result in the format of x.xxxxxxxxxxxxxxxx will
+// use PAL_EPSILON * 10.
+#define PAL_EPSILON 8.8817841970012523e-16
+
+#define PAL_NAN sqrt(-1.0)
+#define PAL_POSINF -log(0.0)
+#define PAL_NEGINF log(0.0)
+
+/**
+ * Helper test structure
+ */
+struct test
+{
+ double value; /* value to test the function with */
+ double expected; /* expected result */
+ double variance; /* maximum delta between the expected and actual result */
+};
+
+/**
+ * validate
+ *
+ * test validation function
+ */
+void __cdecl validate(double value, double expected, double variance)
+{
+ double result = tanh(value);
+
+ /*
+ * The test is valid when the difference between result
+ * and expected is less than or equal to variance
+ */
+ double delta = fabs(result - expected);
+
+ if (delta > variance)
+ {
+ Fail("tanh(%g) returned %20.17g when it should have returned %20.17g",
+ value, result, expected);
+ }
+}
+
+/**
+ * validate
+ *
+ * test validation function for values returning NaN
+ */
+void __cdecl validate_isnan(double value)
+{
+ double result = tanh(value);
+
+ if (!_isnan(result))
+ {
+ Fail("tanh(%g) returned %20.17g when it should have returned %20.17g",
+ 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.31830988618379067, 0.30797791269089433, PAL_EPSILON }, // value: 1 / pi
+ { 0.43429448190325183, 0.40890401183401433, PAL_EPSILON }, // value: log10(e)
+ { 0.63661977236758134, 0.56259360033158334, PAL_EPSILON }, // value: 2 / pi
+ { 0.69314718055994531, 0.6, PAL_EPSILON }, // value: ln(2)
+ { 0.70710678118654752, 0.60885936501391381, PAL_EPSILON }, // value: 1 / sqrt(2)
+ { 0.78539816339744831, 0.65579420263267244, PAL_EPSILON }, // value: pi / 4
+ { 1, 0.76159415595576489, PAL_EPSILON },
+ { 1.1283791670955126, 0.81046380599898809, PAL_EPSILON }, // value: 2 / sqrt(pi)
+ { 1.4142135623730950, 0.88838556158566054, PAL_EPSILON }, // value: sqrt(2)
+ { 1.4426950408889634, 0.89423894585503855, PAL_EPSILON }, // value: log2(e)
+ { 1.5707963267948966, 0.91715233566727435, PAL_EPSILON }, // value: pi / 2
+ { 2.3025850929940457, 0.98019801980198020, PAL_EPSILON }, // value: ln(10)
+ { 2.7182818284590452, 0.99132891580059984, PAL_EPSILON }, // value: e
+ { 3.1415926535897932, 0.99627207622074994, 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/tanh/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/tanh/test1/testinfo.dat
new file mode 100644
index 0000000000..1b2bc91b2b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/tanh/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 = tanh
+Name = Positive Test for tanh
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Passes to tanh() a series of angle value, checking that
+= each one return to correct value.
diff --git a/src/pal/tests/palsuite/c_runtime/time/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/time/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/time/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/time/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/time/test1/CMakeLists.txt
new file mode 100644
index 0000000000..d495266cef
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/time/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_time_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_time_test1 coreclrpal)
+
+target_link_libraries(paltest_time_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/time/test1/test1.c b/src/pal/tests/palsuite/c_runtime/time/test1/test1.c
new file mode 100644
index 0000000000..c668bf38e7
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/time/test1/test1.c
@@ -0,0 +1,51 @@
+// Licensed to the .NET Foundation under one or more 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 the time function and verifies that the time returned
+** is at least a positive value.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char **argv)
+{
+ time_t t = 0;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ time(&t);
+ /*I was going to test that the time returned didn't exceed some
+ reasonable value, but decided not to, for fear of creating my own
+ little Y2K-style disaster.*/
+
+ if (t <= 0)
+ {
+ Fail("time() function doesn't return a time.\n");
+ }
+ t = 0;
+ t = time(NULL);
+ if (t <= 0)
+ {
+ Fail("time() function doesn't return a time.\n");
+ }
+ PAL_Terminate();
+ return PASS;
+}
+
+
+
+
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/time/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/time/test1/testinfo.dat
new file mode 100644
index 0000000000..40134c7623
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/time/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 = time
+Name = Positive Test for time
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Calls the time function and verifies that the time returned is at
+= least a positive value.
+
diff --git a/src/pal/tests/palsuite/c_runtime/tolower/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/tolower/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/tolower/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/tolower/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/tolower/test1/CMakeLists.txt
new file mode 100644
index 0000000000..537f239cf8
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/tolower/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_tolower_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_tolower_test1 coreclrpal)
+
+target_link_libraries(paltest_tolower_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/tolower/test1/test1.c b/src/pal/tests/palsuite/c_runtime/tolower/test1/test1.c
new file mode 100644
index 0000000000..cab623d3f9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/tolower/test1/test1.c
@@ -0,0 +1,79 @@
+// Licensed to the .NET Foundation under one or more 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 tolower function.
+** Check that the tolower function makes capital character
+** lower case. Also check that it has no effect on lower
+** case letters and special characters.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+struct testCase
+{
+ int lower;
+ int start;
+};
+
+int __cdecl main(int argc, char **argv)
+{
+
+ int result;
+ int i;
+
+ struct testCase testCases[] =
+ {
+ {'a', 'A'}, /* Basic cases */
+ {'z', 'Z'},
+ {'b', 'b'}, /* Lower case */
+ {'?', '?'}, /* Characters without case */
+ {230, 230}
+ };
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ /* Loop through each case. Convert each character to lower case
+ and then compare to ensure that it is the correct value.
+ */
+
+ for(i = 0; i < sizeof(testCases) / sizeof(struct testCase); i++)
+ {
+ /*Convert to lower case*/
+ result = tolower(testCases[i].start);
+
+ if (testCases[i].lower != result)
+ {
+ Fail("ERROR: tolower lowered \"%i\" to %i instead of %i.\n",
+ testCases[i].start, result, testCases[i].lower);
+ }
+
+ }
+
+
+ PAL_Terminate();
+ return PASS;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/tolower/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/tolower/test1/testinfo.dat
new file mode 100644
index 0000000000..90f1c729cd
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/tolower/test1/testinfo.dat
@@ -0,0 +1,19 @@
+# Licensed to the .NET Foundation under one or more 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 = tolower
+Name = Positive Test for tolower
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Tests the PAL implementation of the tolower function.
+= Check that the tolower function makes capital character lower case.
+= Also check that it has no effect on lower case letters and special
+= characters.
+
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/toupper/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/toupper/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/toupper/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/toupper/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/toupper/test1/CMakeLists.txt
new file mode 100644
index 0000000000..e5aa375a9b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/toupper/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_toupper_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_toupper_test1 coreclrpal)
+
+target_link_libraries(paltest_toupper_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/toupper/test1/test1.c b/src/pal/tests/palsuite/c_runtime/toupper/test1/test1.c
new file mode 100644
index 0000000000..c580699e3b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/toupper/test1/test1.c
@@ -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: test1.c (toupper)
+**
+**
+** Purpose: Tests the PAL implementation of the toupper function.
+** Check that the toupper function makes lower case
+** character a capital. Also check that it has no effect
+** on upper case letters and special characters.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+struct testCase
+{
+ int upper;
+ int start;
+};
+
+int __cdecl main(int argc, char **argv)
+{
+
+ int result;
+ int i;
+
+ struct testCase testCases[] =
+ {
+ {'A', 'a'}, /* Basic cases */
+ {'Z', 'z'},
+ {'B', 'B'}, /* Upper case */
+ {'%', '%'}, /* Characters without case */
+ {157, 157}
+ };
+
+ if ((PAL_Initialize(argc, argv)) != 0)
+ {
+ return FAIL;
+ }
+
+
+ /* Loop through each case. Convert each character to upper case
+ and then compare to ensure that it is the correct value.
+ */
+ for(i = 0; i < sizeof(testCases) / sizeof(struct testCase); i++)
+ {
+ /*Convert to upper case*/
+ result = toupper(testCases[i].start);
+
+ if (testCases[i].upper != result)
+ {
+ Fail("ERROR: toupper capitalized \"%c\" to %c instead of %c.\n",
+ testCases[i].start, result, testCases[i].upper);
+ }
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/toupper/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/toupper/test1/testinfo.dat
new file mode 100644
index 0000000000..bde7affa4e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/toupper/test1/testinfo.dat
@@ -0,0 +1,19 @@
+# Licensed to the .NET Foundation under one or more 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 = toupper
+Name = Positive Test for toupper
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Tests the PAL implementation of the toupper function.
+= Check that the toupper function makes lower case character a capital.
+= Also check that it has no effect on upper case letters and special
+= characters.
+
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/towlower/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/towlower/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/towlower/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/towlower/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/towlower/test1/CMakeLists.txt
new file mode 100644
index 0000000000..2a3e6a07ef
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/towlower/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_towlower_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_towlower_test1 coreclrpal)
+
+target_link_libraries(paltest_towlower_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/towlower/test1/test1.c b/src/pal/tests/palsuite/c_runtime/towlower/test1/test1.c
new file mode 100644
index 0000000000..5f2457a5fe
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/towlower/test1/test1.c
@@ -0,0 +1,79 @@
+// Licensed to the .NET Foundation under one or more 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 towlower function.
+** Check that the tolower function makes capital character
+** lower case. Also check that it has no effect on lower
+** case letters and special characters.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+struct testCase
+{
+ WCHAR lower;
+ WCHAR start;
+};
+
+int __cdecl main(int argc, char **argv)
+{
+
+ int result;
+ int i;
+
+ struct testCase testCases[] =
+ {
+ {'a', 'A'}, /* Basic cases */
+ {'z', 'Z'},
+ {'b', 'b'}, /* Lower case */
+ {'?', '?'}, /* Characters without case */
+ {230, 230}
+ };
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ /* Loop through each case. Convert each character to lower case
+ and then compare to ensure that it is the correct value.
+ */
+
+ for(i = 0; i < sizeof(testCases) / sizeof(struct testCase); i++)
+ {
+ /*Convert to lower case*/
+ result = towlower(testCases[i].start);
+
+ if (testCases[i].lower != result)
+ {
+ Fail("ERROR: towlower lowered \"%c\" to %c instead of %c.\n",
+ testCases[i].start, result, testCases[i].lower);
+ }
+
+ }
+
+
+ PAL_Terminate();
+ return PASS;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/towlower/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/towlower/test1/testinfo.dat
new file mode 100644
index 0000000000..2df179a8b6
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/towlower/test1/testinfo.dat
@@ -0,0 +1,19 @@
+# Licensed to the .NET Foundation under one or more 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 = towlower
+Name = Positive Test for towlower
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Tests the PAL implementation of the towlower function.
+= Check that the tolower function makes capital character lower case.
+= Also check that it has no effect on lower case letters and special
+= characters.
+
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/towupper/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/towupper/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/towupper/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/towupper/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/towupper/test1/CMakeLists.txt
new file mode 100644
index 0000000000..537efbe0fa
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/towupper/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_towupper_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_towupper_test1 coreclrpal)
+
+target_link_libraries(paltest_towupper_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/towupper/test1/test1.c b/src/pal/tests/palsuite/c_runtime/towupper/test1/test1.c
new file mode 100644
index 0000000000..63f051fa66
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/towupper/test1/test1.c
@@ -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: test1.c(towupper)
+**
+**
+** Purpose: Tests the PAL implementation of the towupper function.
+** Check that the towupper function makes lower case
+** character a capital. Also check that it has no effect
+** on upper case letters and special characters.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+struct testCase
+{
+ WCHAR upper;
+ WCHAR start;
+};
+
+int __cdecl main(int argc, char **argv)
+{
+
+ int result;
+ int i;
+
+ struct testCase testCases[] =
+ {
+ {'A', 'a'}, /* Basic cases */
+ {'Z', 'z'},
+ {'B', 'B'}, /* Upper case */
+ {'%', '%'}, /* Characters without case */
+ {157, 157}
+ };
+
+ if ((PAL_Initialize(argc, argv)) != 0)
+ {
+ return FAIL;
+ }
+
+
+ /* Loop through each case. Convert each character to upper case
+ and then compare to ensure that it is the correct value.
+ */
+
+ for(i = 0; i < sizeof(testCases) / sizeof(struct testCase); i++)
+ {
+ /*Convert to upper case*/
+ result = towupper(testCases[i].start);
+
+ if (testCases[i].upper != result)
+ {
+ Fail("ERROR: towupper capitalized \"%c\" to %c instead of %c.\n",
+ testCases[i].start, result, testCases[i].upper);
+ }
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/towupper/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/towupper/test1/testinfo.dat
new file mode 100644
index 0000000000..40b6fadd5a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/towupper/test1/testinfo.dat
@@ -0,0 +1,19 @@
+# Licensed to the .NET Foundation under one or more 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 = towupper
+Name = Positive Test for towupper
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Tests the PAL implementation of the towupper function.
+= Check that the towupper function makes lower case character a capital.
+= Also check that it has no effect on upper case letters and special
+= characters.
+
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/ungetc/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/ungetc/CMakeLists.txt
new file mode 100644
index 0000000000..ef14ea5352
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/ungetc/CMakeLists.txt
@@ -0,0 +1,5 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+add_subdirectory(test2)
+
diff --git a/src/pal/tests/palsuite/c_runtime/ungetc/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/ungetc/test1/CMakeLists.txt
new file mode 100644
index 0000000000..da19397e2c
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/ungetc/test1/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ ungetc.c
+)
+
+add_executable(paltest_ungetc_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_ungetc_test1 coreclrpal)
+
+target_link_libraries(paltest_ungetc_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/ungetc/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/ungetc/test1/testinfo.dat
new file mode 100644
index 0000000000..08d5b0699a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/ungetc/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 = ungetc
+Name = test for ungetc (test 1)
+Type = DEFAULT
+EXE1 = ungetc
+Description
+= Test how ungetc handles a write-only file (should fail)
diff --git a/src/pal/tests/palsuite/c_runtime/ungetc/test1/ungetc.c b/src/pal/tests/palsuite/c_runtime/ungetc/test1/ungetc.c
new file mode 100644
index 0000000000..397e42ac64
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/ungetc/test1/ungetc.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: ungetc.c (test 1)
+**
+** Purpose: Tests the PAL implementation of the ungetc function by calling
+** the function on a write-only file.
+**
+** Dependencies:
+** fopen
+** fclose
+** fseek
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ char szFileName[] = {"test1.tmp"};
+ const char text[] =
+ {"The quick brown fox jumped over the lazy dog's back."};
+ FILE* pFile = NULL;
+ int nChar = 65; /* 'A' */
+ int nRc = 0;
+ int itemsExpected;
+ int itemsWritten;
+
+ if (0 != PAL_Initialize(argc,argv))
+ {
+ return FAIL;
+ }
+
+ /* create the file */
+ pFile = fopen(szFileName, "w");
+ if (pFile == NULL)
+ {
+ Fail("ungetc: ERROR -> fopen failed to create the file \"%s\""
+ " as write-only.\n",
+ szFileName);
+ }
+
+ /* write to the file */
+ itemsExpected = sizeof(text);
+ itemsWritten = fwrite(text, sizeof(text[0]), sizeof(text), pFile);
+ if (itemsWritten == 0)
+ {
+ Trace("ungetc: ERROR -> fwrite failed to write to the file \"%s\"\n",
+ szFileName);
+
+ if (fclose(pFile) != 0)
+ {
+ Fail("ungetc: ERROR -> fclose failed to close the file.\n");
+ }
+ Fail("");
+
+ }
+ else if (itemsWritten != itemsExpected)
+ {
+ Trace("ungetc: ERROR -> fwrite failed to write the correct number "
+ "of characters to the file \"%s\"\n",
+ szFileName);
+
+ if (fclose(pFile) != 0)
+ {
+ Fail("ungetc: ERROR -> fclose failed to close the file.\n");
+ }
+ Fail("");
+ }
+
+ /* Close the file */
+ if (fclose(pFile) != 0)
+ {
+ Fail("ungetc: ERROR -> fclose failed to close the file.\n");
+ }
+
+ /*
+ ** open the file in write only mode and
+ ** attempt to push an unread character back on the stream
+ */
+
+
+ /* open the file write-only */
+ pFile = fopen(szFileName, "a");
+ if (pFile == NULL)
+ {
+ Fail("ungetc: ERROR -> fopen failed to open the file \"%s\""
+ " as write-only.\n",
+ szFileName);
+ }
+
+ /* move the file pointer back to the beginning of the file */
+ if (fseek(pFile, 1, SEEK_SET) != 0)
+ {
+
+ Trace("ungetc: ERROR -> fseek failed to move the file pointer to the "
+ "beginning of the file.\n");
+ if (fclose(pFile) != 0)
+ {
+ Trace("ungetc: ERROR -> fclose failed to close the file.\n");
+ }
+ Fail("");
+ }
+
+ /* call ungetc on a write-only file which should fail */
+ if ((nRc = ungetc(nChar, pFile)) != EOF)
+ {
+ Trace("ungetc: ERROR -> ungetc returned \"%c\" when run on "
+ "an write-only file.\n", nChar);
+ if (fclose(pFile) != 0)
+ {
+ Trace("ungetc: ERROR -> fclose failed to close the file.\n");
+ }
+ Fail("");
+ }
+
+ if (fclose(pFile) != 0)
+ {
+ Fail("ungetc: ERROR -> fclose failed to close the file.\n");
+ }
+
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/ungetc/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/ungetc/test2/CMakeLists.txt
new file mode 100644
index 0000000000..7b63423628
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/ungetc/test2/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ ungetc.c
+)
+
+add_executable(paltest_ungetc_test2
+ ${SOURCES}
+)
+
+add_dependencies(paltest_ungetc_test2 coreclrpal)
+
+target_link_libraries(paltest_ungetc_test2
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/ungetc/test2/test2.txt b/src/pal/tests/palsuite/c_runtime/ungetc/test2/test2.txt
new file mode 100644
index 0000000000..96c906756d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/ungetc/test2/test2.txt
@@ -0,0 +1 @@
+foo bar \ No newline at end of file
diff --git a/src/pal/tests/palsuite/c_runtime/ungetc/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/ungetc/test2/testinfo.dat
new file mode 100644
index 0000000000..b942c931f5
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/ungetc/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 = ungetc
+Name = test for ungetc (test 2)
+Type = DEFAULT
+EXE1 = ungetc
+Description
+= Push characters back onto the stream and verify
diff --git a/src/pal/tests/palsuite/c_runtime/ungetc/test2/ungetc.c b/src/pal/tests/palsuite/c_runtime/ungetc/test2/ungetc.c
new file mode 100644
index 0000000000..cbc8102eec
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/ungetc/test2/ungetc.c
@@ -0,0 +1,188 @@
+// Licensed to the .NET Foundation under one or more 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: ungetc.c (test 2)
+**
+** Purpose: Tests the PAL implementation of the ungetc function
+**
+** Dependencies:
+** fopen
+** fread
+** fclose
+** fseek
+** getc
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ const char szFileName[] = {"test2.txt"};
+ const char szNewString[] = {"bar bar"};
+ char szBuffer[MAX_PATH];
+ FILE* pFile = NULL;
+ int nChar = 32; /* space */
+ int i = 0;
+ int nRc = 0;
+ size_t nCount = 0;
+
+
+ if (0 != PAL_Initialize(argc,argv))
+ {
+ return FAIL;
+ }
+
+
+ memset(szBuffer, 0, MAX_PATH);
+
+ /*
+ ** open the file in write only mode, populate it and
+ ** attempt to push an unread character back on the stream
+ */
+
+
+ /* open the file for read */
+ pFile = fopen(szFileName, "r");
+ if (pFile == NULL)
+ {
+ Fail("ungetc: ERROR -> fopen failed to open the file \"%s\""
+ " as read-only.n",
+ szFileName);
+ }
+
+
+ /*
+ ** Call getc to get the first char and ungetc to put
+ ** it back. getc should read it again.
+ */
+
+ /* read a character */
+ if ((nChar = getc(pFile)) == EOF)
+ {
+ Trace("ungetc: ERROR -> getc encountered an error reading.\n");
+ if (fclose(pFile) != 0)
+ {
+ Trace("ungetc: ERROR -> fclose failed to close the file.\n");
+ }
+ Fail("");
+ }
+
+ /* put it back */
+ if ((nRc = ungetc(nChar, pFile)) == EOF)
+ {
+ Trace("ungetc: ERROR -> ungetc failed to push '%c' back onto the"
+ " stream.\n");
+ if (fclose(pFile) != 0)
+ {
+ Trace("ungetc: ERROR -> fclose failed to close the file.\n");
+ }
+ Fail("");
+ }
+
+ /* read it again... hopefully */
+ if (((nChar = getc(pFile)) == EOF) || (nChar != nRc))
+ {
+ Trace("ungetc: ERROR -> getc encountered an error reading.\n");
+ if (fclose(pFile) != 0)
+ {
+ Trace("ungetc: ERROR -> fclose failed to close the file.\n");
+ }
+ Fail("");
+ }
+
+ /*
+ ** test multiple ungetcs by replacing "foo" in the stream with "bar"
+ */
+
+ /* move the file pointer back to the beginning of the file */
+ if (fseek(pFile, 0, SEEK_SET) != 0)
+ {
+ Trace("ungetc: ERROR -> fseek failed to move the file pointer to the "
+ "beginning of the file. GetLastError returned %ld\n",
+ GetLastError());
+ if (fclose(pFile) != 0)
+ {
+ Trace("ungetc: ERROR -> fclose failed to close the file.\n");
+ }
+ Fail("");
+ }
+
+ /* read a few characters */
+ for (i = 0; i < 3; i++)
+ {
+ if (getc(pFile) == EOF)
+ {
+ Trace("ungetc: ERROR -> getc encountered an error reading. "
+ "GetLastError returned %ld\n",
+ GetLastError());
+ if (fclose(pFile) != 0)
+ {
+ Trace("ungetc: ERROR -> fclose failed to close the file.\n");
+ }
+ Fail("");
+ }
+ }
+
+ /* we just read "foo" so push "bar" back on the stream */
+ for (i = 2; i >= 0; i--)
+ {
+ if ((nRc = ungetc(szNewString[i], pFile)) == EOF)
+ {
+ Trace("ungetc: ERROR -> ungetc failed to push '%c' back onto the"
+ " stream.\n");
+ if (fclose(pFile) != 0)
+ {
+ Trace("ungetc: ERROR -> fclose failed to close the file.\n");
+ }
+ Fail("");
+ }
+ }
+
+
+ /* read the new and improved stream - I use szNewString because it
+ is correct length */
+ nCount = fread(szBuffer, sizeof(char), strlen(szNewString), pFile);
+
+ /* did we get the right number of characters?*/
+ if (nCount != strlen(szNewString))
+ {
+ Trace("ungetc: ERROR -> fread read %d characters from the stream but"
+ " %d characters were expected\n",
+ nRc,
+ strlen(szNewString));
+ if (fclose(pFile) != 0)
+ {
+ Trace("ungetc: ERROR -> fclose failed to close the file.\n");
+ }
+ Fail("");
+ }
+
+ /* did we get the right string? */
+ if (strcmp(szBuffer, szNewString) != 0)
+ {
+ Trace("ungetc: ERROR -> fread returned \"%s\" but \"%s\" was "
+ "expected\n",
+ szBuffer,
+ szNewString);
+ if (fclose(pFile) != 0)
+ {
+ Trace("ungetc: ERROR -> fclose failed to close the file.\n");
+ }
+ Fail("");
+ }
+
+ if (fclose(pFile) != 0)
+ {
+ Fail("ungetc: ERROR -> fclose failed to close the file.\n");
+ }
+
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vfprintf/CMakeLists.txt
new file mode 100644
index 0000000000..cafb9536b0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/CMakeLists.txt
@@ -0,0 +1,22 @@
+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/vfprintf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vfprintf/test1/CMakeLists.txt
new file mode 100644
index 0000000000..4c967fbc5b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/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_vfprintf_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vfprintf_test1 coreclrpal)
+
+target_link_libraries(paltest_vfprintf_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/vfprintf/test1/test1.c
new file mode 100644
index 0000000000..302c914e3a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test1/test1.c
@@ -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: test1.c
+**
+** Purpose: Test #1 for the vfprintf function. A single, basic, test
+** case with no formatting.
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../vfprintf.h"
+
+int __cdecl main(int argc, char *argv[])
+{
+ FILE *fp;
+ char testfile[] = "testfile.txt";
+ char buf[256];
+ char checkstr[] = "hello world";
+ int ret;
+
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ if ((fp = fopen(testfile, "w+")) == NULL)
+ {
+ Fail("ERROR: fopen failed to create \"%s\"\n", testfile);
+ }
+
+ ret = DoVfprintf(fp, "hello world");
+
+ if (ret != strlen(checkstr))
+ {
+ Fail("Expected vfprintf to return %d, got %d.\n",
+ strlen(checkstr), ret);
+
+ }
+
+ if ((fseek(fp, 0, SEEK_SET)) != 0)
+ {
+ Fail("ERROR: Fseek failed to set pointer to beginning of file\n" );
+ }
+
+ if ((fgets(buf, 100, fp)) == NULL)
+ {
+ Fail("ERROR: fgets failed\n");
+ }
+ if (memcmp(checkstr, buf, strlen(checkstr)+1) != 0)
+ {
+ Fail("ERROR: expected %s, got %s\n", checkstr, buf);
+ }
+ if ((fclose(fp)) != 0)
+ {
+ Fail("ERROR: fclose failed to close \"%s\"\n", testfile);
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vfprintf/test1/testinfo.dat
new file mode 100644
index 0000000000..8359de8e3d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/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 = vfprintf
+Name = Positive Test for vfprintf
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= General test to see if vfprintf works correctly
diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test10/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vfprintf/test10/CMakeLists.txt
new file mode 100644
index 0000000000..e154107e36
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test10/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test10.c
+)
+
+add_executable(paltest_vfprintf_test10
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vfprintf_test10 coreclrpal)
+
+target_link_libraries(paltest_vfprintf_test10
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test10/test10.c b/src/pal/tests/palsuite/c_runtime/vfprintf/test10/test10.c
new file mode 100644
index 0000000000..ecb4b0314a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test10/test10.c
@@ -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: test10.c
+**
+** Purpose: Test #10 for the vfprintf function. Tests the octal specifier
+** (%o).
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../vfprintf.h"
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ int neg = -42;
+ int pos = 42;
+ INT64 l = 42;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ 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/vfprintf/test10/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vfprintf/test10/testinfo.dat
new file mode 100644
index 0000000000..034610a7dc
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/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 = vfprintf
+Name = Positive Test for vfprintf
+TYPE = DEFAULT
+EXE1 = test10
+Description
+= Tests vfprintf with octal numbers
diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test11/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vfprintf/test11/CMakeLists.txt
new file mode 100644
index 0000000000..f51f379bcd
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test11/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test11.c
+)
+
+add_executable(paltest_vfprintf_test11
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vfprintf_test11 coreclrpal)
+
+target_link_libraries(paltest_vfprintf_test11
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test11/test11.c b/src/pal/tests/palsuite/c_runtime/vfprintf/test11/test11.c
new file mode 100644
index 0000000000..5f7bc118cc
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test11/test11.c
@@ -0,0 +1,51 @@
+// Licensed to the .NET Foundation under one or more 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 vfprintf function. Test the unsigned int
+** specifier (%u).
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../vfprintf.h"
+
+int __cdecl main(int argc, char *argv[])
+{
+ int neg = -42;
+ int pos = 42;
+ INT64 l = 42;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ 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/vfprintf/test11/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vfprintf/test11/testinfo.dat
new file mode 100644
index 0000000000..4050bd610e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/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 = vfprintf
+Name = Positive Test for vfprintf
+TYPE = DEFAULT
+EXE1 = test11
+Description
+= Tests vfprintf with unsigned numbers
diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test12/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vfprintf/test12/CMakeLists.txt
new file mode 100644
index 0000000000..3ef68cff70
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test12/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test12.c
+)
+
+add_executable(paltest_vfprintf_test12
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vfprintf_test12 coreclrpal)
+
+target_link_libraries(paltest_vfprintf_test12
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test12/test12.c b/src/pal/tests/palsuite/c_runtime/vfprintf/test12/test12.c
new file mode 100644
index 0000000000..0bf61d3ecc
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test12/test12.c
@@ -0,0 +1,53 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*============================================================================
+**
+** Source: test12.c
+**
+** Purpose: Test #12 for the vfprintf function. Tests the (lowercase)
+** hexadecimal specifier (%x)
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../vfprintf.h"
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ int neg = -42;
+ int pos = 0x1234ab;
+ INT64 l = I64(0x1234567887654321);
+
+ if (PAL_Initialize(argc, argv))
+ {
+ 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/vfprintf/test12/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vfprintf/test12/testinfo.dat
new file mode 100644
index 0000000000..640af62aff
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/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 = vfprintf
+Name = Positive Test for vfprintf
+TYPE = DEFAULT
+EXE1 = test12
+Description
+= Tests vfprintf with hex numbers (lowercase)
diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test13/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vfprintf/test13/CMakeLists.txt
new file mode 100644
index 0000000000..cd34f6649c
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test13/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test13.c
+)
+
+add_executable(paltest_vfprintf_test13
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vfprintf_test13 coreclrpal)
+
+target_link_libraries(paltest_vfprintf_test13
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test13/test13.c b/src/pal/tests/palsuite/c_runtime/vfprintf/test13/test13.c
new file mode 100644
index 0000000000..1e42ce9e8d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test13/test13.c
@@ -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: Test #13 for the vfprintf function. Tests the (uppercase)
+** hexadecimal specifier (%X)
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../vfprintf.h"
+
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ int neg = -42;
+ int pos = 0x1234AB;
+ INT64 l = I64(0x1234567887654321);
+
+ if (PAL_Initialize(argc, argv))
+ {
+ 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/vfprintf/test13/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vfprintf/test13/testinfo.dat
new file mode 100644
index 0000000000..26c7db0523
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/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 = vfprintf
+Name = Positive Test for vfprintf
+TYPE = DEFAULT
+EXE1 = test13
+Description
+= Tests vfprintf with hex numbers (uppercase)
diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test14/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vfprintf/test14/CMakeLists.txt
new file mode 100644
index 0000000000..396a4631c5
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test14/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test14.c
+)
+
+add_executable(paltest_vfprintf_test14
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vfprintf_test14 coreclrpal)
+
+target_link_libraries(paltest_vfprintf_test14
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test14/test14.c b/src/pal/tests/palsuite/c_runtime/vfprintf/test14/test14.c
new file mode 100644
index 0000000000..82f247430f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test14/test14.c
@@ -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: test14.c
+**
+** Purpose: Test #14 for the vfprintf function. Tests the lowercase
+** exponential notation double specifier (%e)
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../vfprintf.h"
+
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ double val = 256.0;
+ double neg = -256.0;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ 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/vfprintf/test14/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vfprintf/test14/testinfo.dat
new file mode 100644
index 0000000000..fa36319311
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/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 = vfprintf
+Name = Positive Test for vfprintf
+TYPE = DEFAULT
+EXE1 = test14
+Description
+= Tests vfprintf with exponential format doubles (lowercase)
diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test15/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vfprintf/test15/CMakeLists.txt
new file mode 100644
index 0000000000..b9ddbe3b4a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test15/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test15.c
+)
+
+add_executable(paltest_vfprintf_test15
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vfprintf_test15 coreclrpal)
+
+target_link_libraries(paltest_vfprintf_test15
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test15/test15.c b/src/pal/tests/palsuite/c_runtime/vfprintf/test15/test15.c
new file mode 100644
index 0000000000..53cc2ceb87
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test15/test15.c
@@ -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: test15.c
+**
+** Purpose: Test #15 for the vfprintf function. Tests the uppercase
+** exponential notation double specifier (%E)
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../vfprintf.h"
+
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ double val = 256.0;
+ double neg = -256.0;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ 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/vfprintf/test15/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vfprintf/test15/testinfo.dat
new file mode 100644
index 0000000000..f51f72c122
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/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 = vfprintf
+Name = Positive Test for vfprintf
+TYPE = DEFAULT
+EXE1 = test15
+Description
+= Tests vfprintf with exponential format doubles (uppercase)
diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test16/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vfprintf/test16/CMakeLists.txt
new file mode 100644
index 0000000000..0fd4177ed8
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test16/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test16.c
+)
+
+add_executable(paltest_vfprintf_test16
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vfprintf_test16 coreclrpal)
+
+target_link_libraries(paltest_vfprintf_test16
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test16/test16.c b/src/pal/tests/palsuite/c_runtime/vfprintf/test16/test16.c
new file mode 100644
index 0000000000..2b7674bb94
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test16/test16.c
@@ -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: test16.c
+**
+** Purpose: Test #16 for the vfprintf function. Tests the decimal notation
+** double specifier (%f)
+**
+**
+**==========================================================================*/
+
+
+#include <palsuite.h>
+#include "../vfprintf.h"
+
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ double val = 2560.001;
+ double neg = -2560.001;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ 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/vfprintf/test16/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vfprintf/test16/testinfo.dat
new file mode 100644
index 0000000000..f91d9f429c
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/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 = vfprintf
+Name = Positive Test for vfprintf
+TYPE = DEFAULT
+EXE1 = test16
+Description
+= Tests vfprintf with decimal point format doubles
diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test17/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vfprintf/test17/CMakeLists.txt
new file mode 100644
index 0000000000..afc0b3828d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test17/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test17.c
+)
+
+add_executable(paltest_vfprintf_test17
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vfprintf_test17 coreclrpal)
+
+target_link_libraries(paltest_vfprintf_test17
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test17/test17.c b/src/pal/tests/palsuite/c_runtime/vfprintf/test17/test17.c
new file mode 100644
index 0000000000..956be15f6f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test17/test17.c
@@ -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: test17.c
+**
+** Purpose: Test #17 for the vfprintf function. Tests the lowercase
+** shorthand notation double specifier (%g)
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../vfprintf.h"
+
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ double val = 2560.001;
+ double neg = -2560.001;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ 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/vfprintf/test17/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vfprintf/test17/testinfo.dat
new file mode 100644
index 0000000000..623846465f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/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 = vfprintf
+Name = Positive Test for vfprintf
+TYPE = DEFAULT
+EXE1 = test17
+Description
+= Tests vfprintf with compact format doubles (lowercase)
diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test18/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vfprintf/test18/CMakeLists.txt
new file mode 100644
index 0000000000..9e373b999e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test18/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test18.c
+)
+
+add_executable(paltest_vfprintf_test18
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vfprintf_test18 coreclrpal)
+
+target_link_libraries(paltest_vfprintf_test18
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test18/test18.c b/src/pal/tests/palsuite/c_runtime/vfprintf/test18/test18.c
new file mode 100644
index 0000000000..c61c8cbdab
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test18/test18.c
@@ -0,0 +1,51 @@
+// Licensed to the .NET Foundation under one or more 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 vfprintf function. Tests the uppercase
+** shorthand notation double specifier (%G)
+**
+**
+**==========================================================================*/
+
+
+#include <palsuite.h>
+#include "../vfprintf.h"
+
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ double val = 2560.001;
+ double neg = -2560.001;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ 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/vfprintf/test18/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vfprintf/test18/testinfo.dat
new file mode 100644
index 0000000000..44ddab30bc
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/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 = vfprintf
+Name = Positive Test for vfprintf
+TYPE = DEFAULT
+EXE1 = test18
+Description
+= Tests vfprintf with compact format doubles (uppercase)
diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test19/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vfprintf/test19/CMakeLists.txt
new file mode 100644
index 0000000000..3120c9117f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test19/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test19.c
+)
+
+add_executable(paltest_vfprintf_test19
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vfprintf_test19 coreclrpal)
+
+target_link_libraries(paltest_vfprintf_test19
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test19/test19.c b/src/pal/tests/palsuite/c_runtime/vfprintf/test19/test19.c
new file mode 100644
index 0000000000..e88ce23663
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test19/test19.c
@@ -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, "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/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vfprintf/test19/testinfo.dat
new file mode 100644
index 0000000000..729c279608
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/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 = vfprintf
+Name = Positive Test for vfprintf
+TYPE = DEFAULT
+EXE1 = test19
+Description
+= Tests vfprintf with argument specified precision
diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vfprintf/test2/CMakeLists.txt
new file mode 100644
index 0000000000..6e700090d6
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test2/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test2.c
+)
+
+add_executable(paltest_vfprintf_test2
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vfprintf_test2 coreclrpal)
+
+target_link_libraries(paltest_vfprintf_test2
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test2/test2.c b/src/pal/tests/palsuite/c_runtime/vfprintf/test2/test2.c
new file mode 100644
index 0000000000..d01117f047
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test2/test2.c
@@ -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: test2.c
+**
+** Purpose: Test #2 for the vfprintf function. Tests the string specifier
+** (%s).
+**
+**
+**==========================================================================*/
+
+
+#include <palsuite.h>
+#include "../vfprintf.h"
+
+
+
+int __cdecl main(int argc, char *argv[])
+{
+
+ if (PAL_Initialize(argc, argv))
+ {
+ 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/vfprintf/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vfprintf/test2/testinfo.dat
new file mode 100644
index 0000000000..6d2f231566
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/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 = vfprintf
+Name = Positive Test for vfprintf
+TYPE = DEFAULT
+EXE1 = test2
+Description
+= Tests vfprintf with strings
diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vfprintf/test3/CMakeLists.txt
new file mode 100644
index 0000000000..1a14d85603
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test3/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test3.c
+)
+
+add_executable(paltest_vfprintf_test3
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vfprintf_test3 coreclrpal)
+
+target_link_libraries(paltest_vfprintf_test3
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test3/test3.c b/src/pal/tests/palsuite/c_runtime/vfprintf/test3/test3.c
new file mode 100644
index 0000000000..0081daa426
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test3/test3.c
@@ -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: Test #3 for the vfprintf function. Tests the wide string
+** specifier (%S).
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../vfprintf.h"
+
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ if (PAL_Initialize(argc, argv))
+ {
+ 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/vfprintf/test3/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vfprintf/test3/testinfo.dat
new file mode 100644
index 0000000000..b5aa1e2f07
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/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 = vfprintf
+Name = Positive Test for vfprintf
+TYPE = DEFAULT
+EXE1 = test3
+Description
+= Tests vfprintf with wide strings
diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test4/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vfprintf/test4/CMakeLists.txt
new file mode 100644
index 0000000000..c1285942bc
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test4/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test4.c
+)
+
+add_executable(paltest_vfprintf_test4
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vfprintf_test4 coreclrpal)
+
+target_link_libraries(paltest_vfprintf_test4
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test4/test4.c b/src/pal/tests/palsuite/c_runtime/vfprintf/test4/test4.c
new file mode 100644
index 0000000000..d24f08d6e0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test4/test4.c
@@ -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: test4.c
+**
+** Purpose: Test #4 for the vfprintf function. Tests the pointer
+** specifier (%p).
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../vfprintf.h"
+
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ void *ptr = (void*) 0x123456;
+ INT64 lptr = I64(0x1234567887654321);
+
+ if (PAL_Initialize(argc, argv))
+ {
+ 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/vfprintf/test4/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vfprintf/test4/testinfo.dat
new file mode 100644
index 0000000000..d08928a8b6
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/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 = vfprintf
+Name = Positive Test for vfprintf
+TYPE = DEFAULT
+EXE1 = test4
+Description
+= Tests vfprintf with pointers
diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test5/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vfprintf/test5/CMakeLists.txt
new file mode 100644
index 0000000000..0cccdfd630
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test5/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test5.c
+)
+
+add_executable(paltest_vfprintf_test5
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vfprintf_test5 coreclrpal)
+
+target_link_libraries(paltest_vfprintf_test5
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test5/test5.c b/src/pal/tests/palsuite/c_runtime/vfprintf/test5/test5.c
new file mode 100644
index 0000000000..44f21b61db
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test5/test5.c
@@ -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: test5.c
+**
+** Purpose: Test #5 for the vfprintf function. Tests the count specifier (%n).
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../vfprintf.h"
+
+
+
+
+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))
+ {
+ 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/vfprintf/test5/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vfprintf/test5/testinfo.dat
new file mode 100644
index 0000000000..73feaa0202
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/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 = vfprintf
+Name = Positive Test for vfprintf
+TYPE = DEFAULT
+EXE1 = test5
+Description
+= Tests vfprintf with the count specifier
diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test6/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vfprintf/test6/CMakeLists.txt
new file mode 100644
index 0000000000..2c036a45ae
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test6/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test6.c
+)
+
+add_executable(paltest_vfprintf_test6
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vfprintf_test6 coreclrpal)
+
+target_link_libraries(paltest_vfprintf_test6
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test6/test6.c b/src/pal/tests/palsuite/c_runtime/vfprintf/test6/test6.c
new file mode 100644
index 0000000000..36c6fe51ca
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test6/test6.c
@@ -0,0 +1,48 @@
+// Licensed to the .NET Foundation under one or more 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 vfprintf function. Tests the char specifier (%c).
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../vfprintf.h"
+
+
+
+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/vfprintf/test6/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vfprintf/test6/testinfo.dat
new file mode 100644
index 0000000000..cb1337dfd7
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/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 = vfprintf
+Name = Positive Test for vfprintf
+TYPE = DEFAULT
+EXE1 = test6
+Description
+= Tests vfprintf with characters
diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test7/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vfprintf/test7/CMakeLists.txt
new file mode 100644
index 0000000000..ca483af773
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test7/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test7.c
+)
+
+add_executable(paltest_vfprintf_test7
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vfprintf_test7 coreclrpal)
+
+target_link_libraries(paltest_vfprintf_test7
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test7/test7.c b/src/pal/tests/palsuite/c_runtime/vfprintf/test7/test7.c
new file mode 100644
index 0000000000..a9cfe319bd
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test7/test7.c
@@ -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: Test #7 for the vfprintf function. Tests the wide char
+** specifier (%C).
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../vfprintf.h"
+
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ WCHAR wb = (WCHAR) 'b';
+
+ if (PAL_Initialize(argc, argv))
+ {
+ 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/vfprintf/test7/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vfprintf/test7/testinfo.dat
new file mode 100644
index 0000000000..c861344845
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/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 = vfprintf
+Name = Positive Test for vfprintf
+TYPE = DEFAULT
+EXE1 = test7
+Description
+= Tests vfprintf with wide characters
diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test8/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vfprintf/test8/CMakeLists.txt
new file mode 100644
index 0000000000..89459b4e93
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test8/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test8.c
+)
+
+add_executable(paltest_vfprintf_test8
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vfprintf_test8 coreclrpal)
+
+target_link_libraries(paltest_vfprintf_test8
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test8/test8.c b/src/pal/tests/palsuite/c_runtime/vfprintf/test8/test8.c
new file mode 100644
index 0000000000..5cef99741a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test8/test8.c
@@ -0,0 +1,53 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*============================================================================
+**
+** Source: test8.c
+**
+** Purpose: Test #8 for the vfprintf function. Tests the decimal
+** specifier (%d).
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../vfprintf.h"
+
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ int neg = -42;
+ int pos = 42;
+ INT64 l = 42;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ 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/vfprintf/test8/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vfprintf/test8/testinfo.dat
new file mode 100644
index 0000000000..e96723378d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/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 = vfprintf
+Name = Positive Test for vfprintf
+TYPE = DEFAULT
+EXE1 = test8
+Description
+= Tests vfprintf with decimal numbers
diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test9/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vfprintf/test9/CMakeLists.txt
new file mode 100644
index 0000000000..3e3b5b99ed
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test9/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test9.c
+)
+
+add_executable(paltest_vfprintf_test9
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vfprintf_test9 coreclrpal)
+
+target_link_libraries(paltest_vfprintf_test9
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test9/test9.c b/src/pal/tests/palsuite/c_runtime/vfprintf/test9/test9.c
new file mode 100644
index 0000000000..45d0dc7a9e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test9/test9.c
@@ -0,0 +1,53 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*============================================================================
+**
+** Source: test9.c
+**
+** Purpose: Test #9 for the vfprintf function. Tests the integer
+** specifier (%i).
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../vfprintf.h"
+
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ int neg = -42;
+ int pos = 42;
+ INT64 l = 42;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ 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/vfprintf/test9/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vfprintf/test9/testinfo.dat
new file mode 100644
index 0000000000..48621773cc
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/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 = vfprintf
+Name = Positive Test for vfprintf
+TYPE = DEFAULT
+EXE1 = test9
+Description
+= Tests vfprintf with integer numbers
diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/vfprintf.h b/src/pal/tests/palsuite/c_runtime/vfprintf/vfprintf.h
new file mode 100644
index 0000000000..f4ae7a53fa
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vfprintf/vfprintf.h
@@ -0,0 +1,463 @@
+// Licensed to the .NET Foundation under one or more 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: vfprintf.h
+**
+** Purpose: Contains common testing functions for vfprintf
+**
+**
+**==========================================================================*/
+
+#ifndef __vfprintf_H__
+#define __vfprintf_H__
+
+int DoVfprintf(FILE *fp, char *format, ...)
+{
+ int retVal;
+ va_list arglist;
+
+ va_start(arglist, format);
+ retVal = vfprintf(fp, format, arglist);
+ va_end(arglist);
+
+ return (retVal);
+}
+
+void DoStrTest(char *formatstr, char* param, char *checkstr)
+{
+ FILE *fp;
+ char buf[256] = { 0 };
+
+ if ((fp = fopen("testfile.txt", "w+")) == NULL )
+ {
+ Fail("ERROR: fopen failed to create testfile\n");
+ }
+ if ((DoVfprintf(fp, formatstr, param)) < 0)
+ {
+ Fail("ERROR: vfprintf failed\n");
+ }
+ if ((fseek(fp, 0, SEEK_SET)) != 0)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+ if ((fgets(buf, 100, fp)) == NULL)
+ {
+ Fail("ERROR: fgets failed\n");
+ }
+
+ 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);
+ }
+ fclose(fp);
+}
+
+void DoWStrTest(char *formatstr, WCHAR* param, char *checkstr)
+{
+ FILE *fp;
+ char buf[256] = { 0 };
+
+ if ((fp = fopen("testfile.txt", "w+")) == NULL )
+ {
+ Fail("ERROR: fopen failed to create testfile\n");
+ }
+ if ((DoVfprintf(fp, formatstr, param)) < 0)
+ {
+ Fail("ERROR: vfprintf failed\n");
+ }
+ if ((fseek(fp, 0, SEEK_SET)) != 0)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+ if ((fgets(buf, 100, fp)) == NULL)
+ {
+ Fail("ERROR: fgets failed\n");
+ }
+
+ if (memcmp(buf, checkstr, strlen(checkstr) + 1) != 0)
+ {
+ Fail("ERROR: failed to insert wide string \"%S\" into \"%s\"\n"
+ "Expected \"%s\" got \"%s\".\n",
+ param, formatstr, checkstr, buf);
+ }
+ fclose(fp);
+}
+
+
+void DoPointerTest(char *formatstr, void* param, char* paramstr,
+ char *checkstr1)
+{
+ FILE *fp;
+ char buf[256] = { 0 };
+
+ if ((fp = fopen("testfile.txt", "w+")) == NULL )
+ {
+ Fail("ERROR: fopen failed to create testfile\n");
+ }
+
+ if ((DoVfprintf(fp, formatstr, param)) < 0)
+ {
+ Fail("ERROR: vfprintf failed\n");
+ }
+
+ if ((fseek(fp, 0, SEEK_SET)) != 0)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+
+ if ((fgets(buf, 100, fp)) == NULL)
+ {
+ Fail("ERROR: fgets failed\n");
+ }
+
+ 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);
+ }
+
+ if ((fclose( fp )) != 0)
+ {
+ Fail("ERROR: fclose failed to close \"testfile.txt\"\n");
+ }
+}
+
+
+
+void DoCountTest(char *formatstr, int param, char *checkstr)
+{
+ FILE *fp;
+ char buf[512] = { 0 };
+ int n = -1;
+
+ if ((fp = fopen("testfile.txt", "w+")) == NULL )
+ {
+ Fail("ERROR: fopen failed to create testfile\n");
+ }
+
+ if ((DoVfprintf(fp, formatstr, &n)) < 0)
+ {
+ Fail("ERROR: vfprintf failed\n");
+ }
+
+ if ((fseek(fp, 0, SEEK_SET)) != 0)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+
+ if ((fgets(buf, sizeof(buf), fp)) == NULL)
+ {
+ Fail("ERROR: fgets failed\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);
+ }
+
+ if ((fclose( fp )) != 0)
+ {
+ Fail("ERROR: fclose failed to close \"testfile.txt\"\n");
+ }
+}
+
+void DoShortCountTest(char *formatstr, int param, char *checkstr)
+{
+ FILE *fp;
+ char buf[512] = { 0 };
+ short int n = -1;
+
+ if ((fp = fopen("testfile.txt", "w+")) == NULL )
+ {
+ Fail("ERROR: fopen failed to create testfile\n");
+ }
+
+ if ((DoVfprintf(fp, formatstr, &n)) < 0)
+ {
+ Fail("ERROR: vfprintf failed\n");
+ }
+
+ if ((fseek(fp, 0, SEEK_SET)) != 0)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+
+ if ((fgets(buf, 100, fp)) == NULL)
+ {
+ Fail("ERROR: fgets failed\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);
+ }
+
+ if ((fclose( fp )) != 0)
+ {
+ Fail("ERROR: fclose failed to close \"testfile.txt\"\n");
+ }
+}
+
+
+void DoCharTest(char *formatstr, char param, char *checkstr)
+{
+ FILE *fp;
+ char buf[256] = { 0 };
+
+ if ((fp = fopen("testfile.txt", "w+")) == NULL )
+ {
+ Fail("ERROR: fopen failed to create testfile\n");
+ }
+ if ((DoVfprintf(fp, formatstr, param)) < 0)
+ {
+ Fail("ERROR: vfprintf failed\n");
+ }
+ if ((fseek(fp, 0, SEEK_SET)) != 0)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+ if ((fgets(buf, 100, fp)) == NULL)
+ {
+ Fail("ERROR: fgets failed\n");
+ }
+
+ 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);
+ }
+ fclose(fp);
+}
+
+void DoWCharTest(char *formatstr, WCHAR param, char *checkstr)
+{
+ FILE *fp;
+ char buf[256] = { 0 };
+
+ if ((fp = fopen("testfile.txt", "w+")) == NULL )
+ {
+ Fail("ERROR: fopen failed to create testfile\n");
+ }
+ if ((DoVfprintf(fp, formatstr, param)) < 0)
+ {
+ Fail("ERROR: vfprintf failed\n");
+ }
+ if ((fseek(fp, 0, SEEK_SET)) != 0)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+ if ((fgets(buf, 100, fp)) == NULL)
+ {
+ Fail("ERROR: fgets failed\n");
+ }
+
+ 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);
+ }
+ fclose(fp);
+}
+
+void DoNumTest(char *formatstr, int value, char *checkstr)
+{
+ FILE *fp;
+ char buf[256] = { 0 };
+
+ if ((fp = fopen("testfile.txt", "w+")) == NULL )
+ {
+ Fail("ERROR: fopen failed to create testfile\n");
+ }
+ if ((DoVfprintf(fp, formatstr, value)) < 0)
+ {
+ Fail("ERROR: vfprintf failed\n");
+ }
+ if ((fseek(fp, 0, SEEK_SET)) != 0)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+ if ((fgets(buf, 100, fp)) == NULL)
+ {
+ Fail("ERROR: fgets failed\n");
+ }
+
+ 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);
+ }
+ fclose(fp);
+}
+
+void DoI64Test(char *formatstr, INT64 value, char *valuestr, char *checkstr1)
+{
+ FILE *fp;
+ char buf[256] = { 0 };
+
+ if ((fp = fopen("testfile.txt", "w+")) == NULL )
+ {
+ Fail("ERROR: fopen failed to create testfile\n");
+ }
+ if ((DoVfprintf(fp, formatstr, value)) < 0)
+ {
+ Fail("ERROR: vfprintf failed\n");
+ }
+ if ((fseek(fp, 0, SEEK_SET)) != 0)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+ if ((fgets(buf, 100, fp)) == NULL)
+ {
+ Fail("ERROR: fgets failed\n");
+ }
+
+ 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);
+ }
+ fclose(fp);
+}
+
+void DoDoubleTest(char *formatstr, double value, char *checkstr1,
+ char *checkstr2)
+{
+ FILE *fp;
+ char buf[256] = { 0 };
+
+ if ((fp = fopen("testfile.txt", "w+")) == NULL )
+ {
+ Fail("ERROR: fopen failed to create testfile\n");
+ }
+
+ if ((DoVfprintf(fp, formatstr, value)) < 0)
+ {
+ Fail("ERROR: vfprintf failed\n");
+ }
+ if ((fseek(fp, 0, SEEK_SET)) != 0)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+ if ((fgets(buf, 100, fp)) == NULL)
+ {
+ Fail("ERROR: fgets failed\n");
+ }
+
+ 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);
+ }
+ fclose(fp);
+}
+
+
+void DoArgumentPrecTest(char *formatstr, int precision, void *param,
+ char *paramstr, char *checkstr1, char *checkstr2)
+{
+ FILE *fp;
+ char buf[256];
+
+ if ((fp = fopen("testfile.txt", "w+")) == NULL )
+ {
+ Fail("ERROR: fopen failed to create testfile\n");
+ }
+
+ if ((DoVfprintf(fp, formatstr, precision, param)) < 0)
+ {
+ Fail("ERROR: vfprintf failed\n");
+ }
+
+ if ((fseek(fp, 0, SEEK_SET)) != 0)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+
+ if ((fgets(buf, 100, fp)) == NULL)
+ {
+ Fail("ERROR: fgets failed\n");
+ }
+
+ 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);
+ }
+
+
+ if ((fclose( fp )) != 0)
+ {
+ Fail("ERROR: fclose failed to close \"testfile.txt\"\n");
+ }
+
+}
+
+void DoArgumentPrecDoubleTest(char *formatstr, int precision, double param,
+ char *checkstr1, char *checkstr2)
+{
+ FILE *fp;
+ char buf[256];
+
+ if ((fp = fopen("testfile.txt", "w+")) == NULL )
+ {
+ Fail("ERROR: fopen failed to create testfile\n");
+ }
+
+ if ((DoVfprintf(fp, formatstr, precision, param)) < 0)
+ {
+ Fail("ERROR: vfprintf failed\n");
+ }
+
+ if ((fseek(fp, 0, SEEK_SET)) != 0)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+
+ if ((fgets(buf, 100, fp)) == NULL)
+ {
+ Fail("ERROR: fgets failed\n");
+ }
+
+ 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);
+ }
+
+ if ((fclose( fp )) != 0)
+ {
+ Fail("ERROR: fclose failed to close \"testfile.txt\"\n");
+ }
+
+}
+
+#endif
+
diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vprintf/CMakeLists.txt
new file mode 100644
index 0000000000..c7e7647ea9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/CMakeLists.txt
@@ -0,0 +1,23 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+# This test fails to build on ARM
+#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/vprintf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vprintf/test1/CMakeLists.txt
new file mode 100644
index 0000000000..eabdf87393
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/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_vprintf_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vprintf_test1 coreclrpal)
+
+target_link_libraries(paltest_vprintf_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/vprintf/test1/test1.c
new file mode 100644
index 0000000000..404d7a0dc9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/test1/test1.c
@@ -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: test1.c
+**
+** Purpose: Test #1 for the vprintf function. A single, basic, test
+** case with no formatting.
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../vprintf.h"
+
+int __cdecl main(int argc, char *argv[])
+{
+ char checkstr[] = "hello world";
+ int ret;
+
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ ret = vprintf("hello world", NULL);
+
+ if (ret != strlen(checkstr))
+ {
+ Fail("Expected vprintf to return %d, got %d.\n",
+ strlen(checkstr), ret);
+
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
+
diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vprintf/test1/testinfo.dat
new file mode 100644
index 0000000000..ac5de86341
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/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 = vprintf
+Name = Positive Test for vprintf
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= General test to see if vprintf works correctly
diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test10/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vprintf/test10/CMakeLists.txt
new file mode 100644
index 0000000000..47a21d909a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/test10/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test10.c
+)
+
+add_executable(paltest_vprintf_test10
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vprintf_test10 coreclrpal)
+
+target_link_libraries(paltest_vprintf_test10
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test10/test10.c b/src/pal/tests/palsuite/c_runtime/vprintf/test10/test10.c
new file mode 100644
index 0000000000..b363d7c02c
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/test10/test10.c
@@ -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: test10.c
+**
+** Purpose: Test #10 for the vprintf function. Tests the octal specifier
+** (%o).
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../vprintf.h"
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ int neg = -42;
+ int pos = 42;
+ INT64 l = 42;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ 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/vprintf/test10/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vprintf/test10/testinfo.dat
new file mode 100644
index 0000000000..4494024300
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/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 = vprintf
+Name = Positive Test for vprintf
+TYPE = DEFAULT
+EXE1 = test10
+Description
+= Tests vprintf with octal numbers
diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test11/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vprintf/test11/CMakeLists.txt
new file mode 100644
index 0000000000..4c750b72ac
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/test11/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test11.c
+)
+
+add_executable(paltest_vprintf_test11
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vprintf_test11 coreclrpal)
+
+target_link_libraries(paltest_vprintf_test11
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test11/test11.c b/src/pal/tests/palsuite/c_runtime/vprintf/test11/test11.c
new file mode 100644
index 0000000000..f5157ac99f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/test11/test11.c
@@ -0,0 +1,51 @@
+// Licensed to the .NET Foundation under one or more 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 vprintf function. Test the unsigned int
+** specifier (%u).
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../vprintf.h"
+
+int __cdecl main(int argc, char *argv[])
+{
+ int neg = -42;
+ int pos = 42;
+ INT64 l = 42;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ 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/vprintf/test11/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vprintf/test11/testinfo.dat
new file mode 100644
index 0000000000..c504c70e88
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/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 = vprintf
+Name = Positive Test for vprintf
+TYPE = DEFAULT
+EXE1 = test11
+Description
+= Tests vprintf with unsigned numbers
diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test12/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vprintf/test12/CMakeLists.txt
new file mode 100644
index 0000000000..1feb886fc1
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/test12/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test12.c
+)
+
+add_executable(paltest_vprintf_test12
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vprintf_test12 coreclrpal)
+
+target_link_libraries(paltest_vprintf_test12
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test12/test12.c b/src/pal/tests/palsuite/c_runtime/vprintf/test12/test12.c
new file mode 100644
index 0000000000..703a8c4fdc
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/test12/test12.c
@@ -0,0 +1,53 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*============================================================================
+**
+** Source: test12.c
+**
+** Purpose: Test #12 for the vprintf function. Tests the (lowercase)
+** hexadecimal specifier (%x)
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../vprintf.h"
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ int neg = -42;
+ int pos = 0x1234ab;
+ INT64 l = I64(0x1234567887654321);
+
+ if (PAL_Initialize(argc, argv))
+ {
+ 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/vprintf/test12/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vprintf/test12/testinfo.dat
new file mode 100644
index 0000000000..558ce37c8b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/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 = vprintf
+Name = Positive Test for vprintf
+TYPE = DEFAULT
+EXE1 = test12
+Description
+= Tests vprintf with hex numbers (lowercase)
diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test13/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vprintf/test13/CMakeLists.txt
new file mode 100644
index 0000000000..cd7535a1ad
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/test13/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test13.c
+)
+
+add_executable(paltest_vprintf_test13
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vprintf_test13 coreclrpal)
+
+target_link_libraries(paltest_vprintf_test13
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test13/test13.c b/src/pal/tests/palsuite/c_runtime/vprintf/test13/test13.c
new file mode 100644
index 0000000000..ecb83ba38d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/test13/test13.c
@@ -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: Test #13 for the vprintf function. Tests the (uppercase)
+** hexadecimal specifier (%X)
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../vprintf.h"
+
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ int neg = -42;
+ int pos = 0x1234AB;
+ INT64 l = I64(0x1234567887654321);
+
+ if (PAL_Initialize(argc, argv))
+ {
+ 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/vprintf/test13/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vprintf/test13/testinfo.dat
new file mode 100644
index 0000000000..33822958dd
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/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 = vprintf
+Name = Positive Test for vprintf
+TYPE = DEFAULT
+EXE1 = test13
+Description
+= Tests vprintf with hex numbers (uppercase)
diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test14/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vprintf/test14/CMakeLists.txt
new file mode 100644
index 0000000000..82cfd68ecf
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/test14/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test14.c
+)
+
+add_executable(paltest_vprintf_test14
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vprintf_test14 coreclrpal)
+
+target_link_libraries(paltest_vprintf_test14
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test14/test14.c b/src/pal/tests/palsuite/c_runtime/vprintf/test14/test14.c
new file mode 100644
index 0000000000..536c1950e3
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/test14/test14.c
@@ -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: test14.c
+**
+** Purpose: Test #14 for the vprintf function. Tests the lowercase
+** exponential notation double specifier (%e)
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../vprintf.h"
+
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ double val = 256.0;
+ double neg = -256.0;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ 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/vprintf/test14/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vprintf/test14/testinfo.dat
new file mode 100644
index 0000000000..d2633fca43
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/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 = vprintf
+Name = Positive Test for vprintf
+TYPE = DEFAULT
+EXE1 = test14
+Description
+= Tests vprintf with exponential format doubles (lowercase)
diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test15/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vprintf/test15/CMakeLists.txt
new file mode 100644
index 0000000000..29a134d48c
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/test15/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test15.c
+)
+
+add_executable(paltest_vprintf_test15
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vprintf_test15 coreclrpal)
+
+target_link_libraries(paltest_vprintf_test15
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test15/test15.c b/src/pal/tests/palsuite/c_runtime/vprintf/test15/test15.c
new file mode 100644
index 0000000000..9aff6e457d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/test15/test15.c
@@ -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: test15.c
+**
+** Purpose: Test #15 for the vprintf function. Tests the uppercase
+** exponential notation double specifier (%E)
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../vprintf.h"
+
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ double val = 256.0;
+ double neg = -256.0;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ 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/vprintf/test15/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vprintf/test15/testinfo.dat
new file mode 100644
index 0000000000..c1e00520a7
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/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 = vprintf
+Name = Positive Test for vprintf
+TYPE = DEFAULT
+EXE1 = test15
+Description
+= Tests vprintf with exponential format doubles (uppercase)
diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test16/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vprintf/test16/CMakeLists.txt
new file mode 100644
index 0000000000..7fbf43ac84
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/test16/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test16.c
+)
+
+add_executable(paltest_vprintf_test16
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vprintf_test16 coreclrpal)
+
+target_link_libraries(paltest_vprintf_test16
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test16/test16.c b/src/pal/tests/palsuite/c_runtime/vprintf/test16/test16.c
new file mode 100644
index 0000000000..66e9afe2d7
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/test16/test16.c
@@ -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: test16.c
+**
+** Purpose: Test #16 for the vprintf function. Tests the decimal notation
+** double specifier (%f)
+**
+**
+**==========================================================================*/
+
+
+#include <palsuite.h>
+#include "../vprintf.h"
+
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ double val = 2560.001;
+ double neg = -2560.001;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ 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/vprintf/test16/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vprintf/test16/testinfo.dat
new file mode 100644
index 0000000000..8b17d2f71a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/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 = vprintf
+Name = Positive Test for vprintf
+TYPE = DEFAULT
+EXE1 = test16
+Description
+= Tests vprintf with decimal point format doubles
diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test17/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vprintf/test17/CMakeLists.txt
new file mode 100644
index 0000000000..25970cba15
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/test17/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test17.c
+)
+
+add_executable(paltest_vprintf_test17
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vprintf_test17 coreclrpal)
+
+target_link_libraries(paltest_vprintf_test17
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test17/test17.c b/src/pal/tests/palsuite/c_runtime/vprintf/test17/test17.c
new file mode 100644
index 0000000000..d36a084903
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/test17/test17.c
@@ -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: test17.c
+**
+** Purpose: Test #17 for the vprintf function. Tests the lowercase
+** shorthand notation double specifier (%g)
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../vprintf.h"
+
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ double val = 2560.001;
+ double neg = -2560.001;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ 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/vprintf/test17/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vprintf/test17/testinfo.dat
new file mode 100644
index 0000000000..9f40fb03a0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/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 = vprintf
+Name = Positive Test for vprintf
+TYPE = DEFAULT
+EXE1 = test17
+Description
+= Tests vprintf with compact format doubles (lowercase)
diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test18/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vprintf/test18/CMakeLists.txt
new file mode 100644
index 0000000000..45676b93dd
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/test18/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test18.c
+)
+
+add_executable(paltest_vprintf_test18
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vprintf_test18 coreclrpal)
+
+target_link_libraries(paltest_vprintf_test18
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test18/test18.c b/src/pal/tests/palsuite/c_runtime/vprintf/test18/test18.c
new file mode 100644
index 0000000000..6fde79b5fb
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/test18/test18.c
@@ -0,0 +1,51 @@
+// Licensed to the .NET Foundation under one or more 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 vprintf function. Tests the uppercase
+** shorthand notation double specifier (%G)
+**
+**
+**==========================================================================*/
+
+
+#include <palsuite.h>
+#include "../vprintf.h"
+
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ double val = 2560.001;
+ double neg = -2560.001;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ 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/vprintf/test18/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vprintf/test18/testinfo.dat
new file mode 100644
index 0000000000..b41f8c63e0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/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 = vprintf
+Name = Positive Test for vprintf
+TYPE = DEFAULT
+EXE1 = test18
+Description
+= Tests vprintf with compact format doubles (uppercase)
diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test19/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vprintf/test19/CMakeLists.txt
new file mode 100644
index 0000000000..25bc2fccd1
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/test19/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test19.c
+)
+
+add_executable(paltest_vprintf_test19
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vprintf_test19 coreclrpal)
+
+target_link_libraries(paltest_vprintf_test19
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test19/test19.c b/src/pal/tests/palsuite/c_runtime/vprintf/test19/test19.c
new file mode 100644
index 0000000000..d79f2e2591
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/test19/test19.c
@@ -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, "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/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vprintf/test19/testinfo.dat
new file mode 100644
index 0000000000..03c3afa693
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/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 = vprintf
+Name = Positive Test for vprintf
+TYPE = DEFAULT
+EXE1 = test19
+Description
+= Tests vprintf with argument specified precision
diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vprintf/test2/CMakeLists.txt
new file mode 100644
index 0000000000..6820069cb9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/test2/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test2.c
+)
+
+add_executable(paltest_vprintf_test2
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vprintf_test2 coreclrpal)
+
+target_link_libraries(paltest_vprintf_test2
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test2/test2.c b/src/pal/tests/palsuite/c_runtime/vprintf/test2/test2.c
new file mode 100644
index 0000000000..4d9c9bc6f5
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/test2/test2.c
@@ -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: test2.c
+**
+** Purpose: Test #2 for the vprintf function. Tests the string specifier
+** (%s).
+**
+**
+**==========================================================================*/
+
+
+#include <palsuite.h>
+#include "../vprintf.h"
+
+
+
+int __cdecl main(int argc, char *argv[])
+{
+
+ if (PAL_Initialize(argc, argv))
+ {
+ 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/vprintf/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vprintf/test2/testinfo.dat
new file mode 100644
index 0000000000..32c1d70d9e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/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 = vprintf
+Name = Positive Test for vprintf
+TYPE = DEFAULT
+EXE1 = test2
+Description
+= Tests vprintf with strings
diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vprintf/test3/CMakeLists.txt
new file mode 100644
index 0000000000..676d19bf7a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/test3/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test3.c
+)
+
+add_executable(paltest_vprintf_test3
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vprintf_test3 coreclrpal)
+
+target_link_libraries(paltest_vprintf_test3
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test3/test3.c b/src/pal/tests/palsuite/c_runtime/vprintf/test3/test3.c
new file mode 100644
index 0000000000..5376c56b76
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/test3/test3.c
@@ -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: Test #3 for the vprintf function. Tests the wide string
+** specifier (%S).
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../vprintf.h"
+
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ if (PAL_Initialize(argc, argv))
+ {
+ 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/vprintf/test3/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vprintf/test3/testinfo.dat
new file mode 100644
index 0000000000..c3b385e8f1
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/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 = vprintf
+Name = Positive Test for vprintf
+TYPE = DEFAULT
+EXE1 = test3
+Description
+= Tests vprintf with wide strings
diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test4/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vprintf/test4/CMakeLists.txt
new file mode 100644
index 0000000000..9ddb087e83
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/test4/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test4.c
+)
+
+add_executable(paltest_vprintf_test4
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vprintf_test4 coreclrpal)
+
+target_link_libraries(paltest_vprintf_test4
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test4/test4.c b/src/pal/tests/palsuite/c_runtime/vprintf/test4/test4.c
new file mode 100644
index 0000000000..3b66cde22e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/test4/test4.c
@@ -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: test4.c
+**
+** Purpose: Test #4 for the vprintf function. Tests the pointer
+** specifier (%p).
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../vprintf.h"
+
+
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ void *ptr = (void*) 0x123456;
+ INT64 lptr = I64(0x1234567887654321);
+
+ if (PAL_Initialize(argc, argv))
+ {
+ 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/vprintf/test4/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vprintf/test4/testinfo.dat
new file mode 100644
index 0000000000..74c4ce932e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/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 = vprintf
+Name = Positive Test for vprintf
+TYPE = DEFAULT
+EXE1 = test4
+Description
+= Tests vprintf with pointers
diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test5/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vprintf/test5/CMakeLists.txt
new file mode 100644
index 0000000000..f453bb66ee
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/test5/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test5.c
+)
+
+add_executable(paltest_vprintf_test5
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vprintf_test5 coreclrpal)
+
+target_link_libraries(paltest_vprintf_test5
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test5/test5.c b/src/pal/tests/palsuite/c_runtime/vprintf/test5/test5.c
new file mode 100644
index 0000000000..c9e2901230
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/test5/test5.c
@@ -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: test5.c
+**
+** Purpose: Test #5 for the vprintf function. Tests the count specifier (%n).
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../vprintf.h"
+
+
+
+
+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))
+ {
+ 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/vprintf/test5/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vprintf/test5/testinfo.dat
new file mode 100644
index 0000000000..01ff864208
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/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 = vprintf
+Name = Positive Test for vprintf
+TYPE = DEFAULT
+EXE1 = test5
+Description
+= Tests vprintf with the count specifier
diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test6/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vprintf/test6/CMakeLists.txt
new file mode 100644
index 0000000000..1ce8d5aa4c
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/test6/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test6.c
+)
+
+add_executable(paltest_vprintf_test6
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vprintf_test6 coreclrpal)
+
+target_link_libraries(paltest_vprintf_test6
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test6/test6.c b/src/pal/tests/palsuite/c_runtime/vprintf/test6/test6.c
new file mode 100644
index 0000000000..6a83cccea6
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/test6/test6.c
@@ -0,0 +1,48 @@
+// Licensed to the .NET Foundation under one or more 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 vprintf function. Tests the char specifier (%c).
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../vprintf.h"
+
+
+
+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/vprintf/test6/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vprintf/test6/testinfo.dat
new file mode 100644
index 0000000000..ce450183f6
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/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 = vprintf
+Name = Positive Test for vprintf
+TYPE = DEFAULT
+EXE1 = test6
+Description
+= Tests vprintf with characters
diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test7/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vprintf/test7/CMakeLists.txt
new file mode 100644
index 0000000000..5627fe4c1e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/test7/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test7.c
+)
+
+add_executable(paltest_vprintf_test7
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vprintf_test7 coreclrpal)
+
+target_link_libraries(paltest_vprintf_test7
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test7/test7.c b/src/pal/tests/palsuite/c_runtime/vprintf/test7/test7.c
new file mode 100644
index 0000000000..5096ace42c
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/test7/test7.c
@@ -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: Test #7 for the vprintf function. Tests the wide char
+** specifier (%C).
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../vprintf.h"
+
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ WCHAR wb = (WCHAR) 'b';
+
+ if (PAL_Initialize(argc, argv))
+ {
+ 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/vprintf/test7/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vprintf/test7/testinfo.dat
new file mode 100644
index 0000000000..254e31e5f8
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/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 = vprintf
+Name = Positive Test for vprintf
+TYPE = DEFAULT
+EXE1 = test7
+Description
+= Tests vprintf with wide characters
diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test8/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vprintf/test8/CMakeLists.txt
new file mode 100644
index 0000000000..0131e4943e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/test8/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test8.c
+)
+
+add_executable(paltest_vprintf_test8
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vprintf_test8 coreclrpal)
+
+target_link_libraries(paltest_vprintf_test8
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test8/test8.c b/src/pal/tests/palsuite/c_runtime/vprintf/test8/test8.c
new file mode 100644
index 0000000000..2683339ece
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/test8/test8.c
@@ -0,0 +1,53 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*============================================================================
+**
+** Source: test8.c
+**
+** Purpose: Test #8 for the vprintf function. Tests the decimal
+** specifier (%d).
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../vprintf.h"
+
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ int neg = -42;
+ int pos = 42;
+ INT64 l = 42;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ 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/vprintf/test8/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vprintf/test8/testinfo.dat
new file mode 100644
index 0000000000..73f287b9fe
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/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 = vprintf
+Name = Positive Test for vprintf
+TYPE = DEFAULT
+EXE1 = test8
+Description
+= Tests vprintf with decimal numbers
diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test9/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vprintf/test9/CMakeLists.txt
new file mode 100644
index 0000000000..c70631f9dc
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/test9/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test9.c
+)
+
+add_executable(paltest_vprintf_test9
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vprintf_test9 coreclrpal)
+
+target_link_libraries(paltest_vprintf_test9
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test9/test9.c b/src/pal/tests/palsuite/c_runtime/vprintf/test9/test9.c
new file mode 100644
index 0000000000..8545bc760e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/test9/test9.c
@@ -0,0 +1,53 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*============================================================================
+**
+** Source: test9.c
+**
+** Purpose: Test #9 for the vprintf function. Tests the integer
+** specifier (%i).
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../vprintf.h"
+
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ int neg = -42;
+ int pos = 42;
+ INT64 l = 42;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ 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/vprintf/test9/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vprintf/test9/testinfo.dat
new file mode 100644
index 0000000000..c4c77b9d11
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/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 = vprintf
+Name = Positive Test for vprintf
+TYPE = DEFAULT
+EXE1 = test9
+Description
+= Tests vprintf with integer numbers
diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/vprintf.h b/src/pal/tests/palsuite/c_runtime/vprintf/vprintf.h
new file mode 100644
index 0000000000..477db32f4d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vprintf/vprintf.h
@@ -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: vprintf.h
+**
+** Purpose: Containts common testing functions for vprintf
+**
+**
+**==========================================================================*/
+
+#ifndef __vprintf_H__
+#define __vprintf_H__
+
+int DoVprintf(char *format, ...)
+{
+ int retVal;
+ va_list arglist;
+
+ va_start(arglist, format);
+ retVal = vprintf(format, arglist);
+ va_end(arglist);
+
+ return (retVal);
+}
+
+void DoStrTest(char *formatstr, char* param, char *checkstr)
+{
+ int ret;
+
+ ret = DoVprintf(formatstr, param);
+ if (ret != strlen(checkstr))
+ {
+ Fail("Expected vprintf to return %d, got %d.\n",
+ strlen(checkstr), ret);
+ }
+}
+
+void DoWStrTest(char *formatstr, WCHAR* param, char *checkstr)
+{
+ int ret;
+
+ ret = DoVprintf(formatstr, param);
+ if (ret != strlen(checkstr))
+ {
+ Fail("Expected vprintf to return %d, got %d.\n",
+ strlen(checkstr), ret);
+ }
+}
+
+void DoPointerTest(char *formatstr, void* param, char* paramstr,
+ char *checkstr1)
+{
+ int ret;
+
+ ret = DoVprintf(formatstr, param);
+ if (ret != strlen(checkstr1))
+ {
+ Fail("Expected vprintf to return %d, got %d.\n",
+ strlen(checkstr1), ret);
+ }
+}
+
+void DoCountTest(char *formatstr, int param, char *checkstr)
+{
+ int ret;
+ int n = -1;
+
+ ret = DoVprintf(formatstr, &n);
+
+ if (n != param)
+ {
+ Fail("Expected count parameter to resolve to %d, got %d\n", param, n);
+ }
+
+ if (ret != strlen(checkstr))
+ {
+ Fail("Expected vprintf to return %d, got %d.\n",
+ strlen(checkstr), ret);
+ }
+}
+
+void DoShortCountTest(char *formatstr, int param, char *checkstr)
+{
+ int ret;
+ short int n = -1;
+
+ ret = DoVprintf(formatstr, &n);
+
+ if (n != param)
+ {
+ Fail("Expected count parameter to resolve to %d, got %d\n", param, n);
+ }
+
+ if (ret != strlen(checkstr))
+ {
+ Fail("Expected vprintf to return %d, got %d.\n",
+ strlen(checkstr), ret);
+ }
+}
+
+
+void DoCharTest(char *formatstr, char param, char *checkstr)
+{
+ int ret;
+
+ ret = DoVprintf(formatstr, param);
+ if (ret != strlen(checkstr))
+ {
+ Fail("Expected vprintf to return %d, got %d.\n",
+ strlen(checkstr), ret);
+ }
+}
+
+void DoWCharTest(char *formatstr, WCHAR param, char *checkstr)
+{
+ int ret;
+
+ ret = DoVprintf(formatstr, param);
+ if (ret != strlen(checkstr))
+ {
+ Fail("Expected vprintf to return %d, got %d.\n",
+ strlen(checkstr), ret);
+ }
+}
+
+void DoNumTest(char *formatstr, int param, char *checkstr)
+{
+ int ret;
+
+ ret = DoVprintf(formatstr, param);
+ if (ret != strlen(checkstr))
+ {
+ Fail("Expected vprintf to return %d, got %d.\n",
+ strlen(checkstr), ret);
+ }
+}
+
+void DoI64Test(char *formatstr, INT64 param, char *valuestr, char *checkstr1)
+{
+ int ret;
+
+ ret = DoVprintf(formatstr, param);
+ if (ret != strlen(checkstr1))
+ {
+ Fail("Expected vprintf to return %d, got %d.\n",
+ strlen(checkstr1), ret);
+ }
+}
+
+void DoDoubleTest(char *formatstr, double param, char *checkstr1,
+ char *checkstr2)
+{
+ int ret;
+
+ ret = DoVprintf(formatstr, param);
+ if (ret != strlen(checkstr1) && ret != strlen(checkstr2))
+ {
+ Fail("Expected vprintf to return %d or %d, got %d.\n",
+ strlen(checkstr1), strlen(checkstr2), ret);
+ }
+}
+
+void DoArgumentPrecTest(char *formatstr, int precision, void *param,
+ char *paramstr, char *checkstr1, char *checkstr2)
+{
+ int ret;
+
+ ret = DoVprintf(formatstr, precision, param);
+ if (ret != strlen(checkstr1) && ret != strlen(checkstr2))
+ {
+ Fail("Expected vprintf to return %d or %d, got %d.\n",
+ strlen(checkstr1), strlen(checkstr2), ret);
+ }
+}
+
+void DoArgumentPrecDoubleTest(char *formatstr, int precision, double param,
+ char *checkstr1, char *checkstr2)
+{
+ int ret;
+
+ ret = DoVprintf(formatstr, precision, param);
+ if (ret != strlen(checkstr1) && ret != strlen(checkstr2))
+ {
+ Fail("Expected vprintf to return %d or %d, got %d.\n",
+ strlen(checkstr1), strlen(checkstr2), ret);
+ }
+}
+
+#endif
+
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/CMakeLists.txt
new file mode 100644
index 0000000000..cafb9536b0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/CMakeLists.txt
@@ -0,0 +1,22 @@
+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/vsprintf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test1/CMakeLists.txt
new file mode 100644
index 0000000000..4f0872eccc
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/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_vsprintf_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsprintf_test1 coreclrpal)
+
+target_link_libraries(paltest_vsprintf_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/vsprintf/test1/test1.c
new file mode 100644
index 0000000000..2007fefc5b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test1/test1.c
@@ -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: test1.c
+**
+** Purpose: Test #1 for the vsprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../vsprintf.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);
+ }
+
+ testvsp(buf, "hello world");
+
+ if (memcmp(checkstr, buf, strlen(checkstr)+1) != 0)
+ {
+ Fail("ERROR: expected \"%s\" (up to %d chars), got \"%s\"\n",
+ checkstr, 256, buf);
+ }
+
+ testvsp(buf, "xxxxxxxxxxxxxxxxx");
+ ret = testvsp(buf, "hello world");
+
+ if (ret != strlen(checkstr))
+ {
+ Fail("ERROR: expected negative return value, got %d", ret);
+ }
+
+ if (memcmp(checkstr, buf, ret) != 0)
+ {
+ Fail("ERROR: expected %s, got %s\n", checkstr, buf);
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vsprintf/test1/testinfo.dat
new file mode 100644
index 0000000000..996364f366
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/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 = vsprintf
+Name = Positive Test for vsprintf
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Tests the PAL implementation of the vsprintf function.
+= This test is modeled after _snprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test10/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test10/CMakeLists.txt
new file mode 100644
index 0000000000..d32de01ba1
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test10/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test10.c
+)
+
+add_executable(paltest_vsprintf_test10
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsprintf_test10 coreclrpal)
+
+target_link_libraries(paltest_vsprintf_test10
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test10/test10.c b/src/pal/tests/palsuite/c_runtime/vsprintf/test10/test10.c
new file mode 100644
index 0000000000..791213fccc
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test10/test10.c
@@ -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 vsprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../vsprintf.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/vsprintf/test10/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vsprintf/test10/testinfo.dat
new file mode 100644
index 0000000000..1a1f4ef217
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/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 = vsprintf
+Name = Positive Test for vsprintf
+TYPE = DEFAULT
+EXE1 = test10
+Description
+= Tests the PAL implementation of the vsprintf function.
+= Tests vsprintf with octal numbers.
+= This test is modeled after _snprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test11/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test11/CMakeLists.txt
new file mode 100644
index 0000000000..ce67444c39
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test11/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test11.c
+)
+
+add_executable(paltest_vsprintf_test11
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsprintf_test11 coreclrpal)
+
+target_link_libraries(paltest_vsprintf_test11
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test11/test11.c b/src/pal/tests/palsuite/c_runtime/vsprintf/test11/test11.c
new file mode 100644
index 0000000000..e0af94981b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test11/test11.c
@@ -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 vsprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../vsprintf.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/vsprintf/test11/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vsprintf/test11/testinfo.dat
new file mode 100644
index 0000000000..d44167e255
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/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 = vsprintf
+Name = Positive Test for vsprintf
+TYPE = DEFAULT
+EXE1 = test11
+Description
+= Tests the PAL implementation of the vsprintf function.
+= Tests vsprintf with unsigned numbers.
+= This test is modeled after _snprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test12/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test12/CMakeLists.txt
new file mode 100644
index 0000000000..fe6ccb8399
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test12/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test12.c
+)
+
+add_executable(paltest_vsprintf_test12
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsprintf_test12 coreclrpal)
+
+target_link_libraries(paltest_vsprintf_test12
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test12/test12.c b/src/pal/tests/palsuite/c_runtime/vsprintf/test12/test12.c
new file mode 100644
index 0000000000..f86ddcade8
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test12/test12.c
@@ -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: test12.c
+**
+** Purpose: Test #12 for the vsprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../vsprintf.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/vsprintf/test12/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vsprintf/test12/testinfo.dat
new file mode 100644
index 0000000000..781fb9cae8
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/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 = vsprintf
+Name = Positive Test for vsprintf
+TYPE = DEFAULT
+EXE1 = test12
+Description
+= Tests the PAL implementation of the vsprintf function.
+= Tests vsprintf with hex numbers (lowercase).
+= This test is modeled after _snprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test13/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test13/CMakeLists.txt
new file mode 100644
index 0000000000..97fdf8cdd0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test13/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test13.c
+)
+
+add_executable(paltest_vsprintf_test13
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsprintf_test13 coreclrpal)
+
+target_link_libraries(paltest_vsprintf_test13
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test13/test13.c b/src/pal/tests/palsuite/c_runtime/vsprintf/test13/test13.c
new file mode 100644
index 0000000000..36e7825531
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test13/test13.c
@@ -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: test13.c
+**
+** Purpose: Test #13 for the vsprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../vsprintf.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/vsprintf/test13/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vsprintf/test13/testinfo.dat
new file mode 100644
index 0000000000..7b28a91e65
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/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 = vsprintf
+Name = Positive Test for vsprintf
+TYPE = DEFAULT
+EXE1 = test13
+Description
+= Tests the PAL implementation of the vsprintf function.
+= Tests vsprintf with hex numbers (uppercase).
+= This test is modeled after _snprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test14/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test14/CMakeLists.txt
new file mode 100644
index 0000000000..2851a8893e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test14/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test14.c
+)
+
+add_executable(paltest_vsprintf_test14
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsprintf_test14 coreclrpal)
+
+target_link_libraries(paltest_vsprintf_test14
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test14/test14.c b/src/pal/tests/palsuite/c_runtime/vsprintf/test14/test14.c
new file mode 100644
index 0000000000..360fafc37f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test14/test14.c
@@ -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: test14.c
+**
+** Purpose: Test #14 for the vsprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../vsprintf.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/vsprintf/test14/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vsprintf/test14/testinfo.dat
new file mode 100644
index 0000000000..a0934096cc
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/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 = vsprintf
+Name = Positive Test for vsprintf
+TYPE = DEFAULT
+EXE1 = test14
+Description
+= Tests the PAL implementation of the vsprintf function.
+= Tests vsprintf with exponential format doubles (lowercase).
+= This test is modeled after _snprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test15/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test15/CMakeLists.txt
new file mode 100644
index 0000000000..6fb1d321b8
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test15/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test15.c
+)
+
+add_executable(paltest_vsprintf_test15
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsprintf_test15 coreclrpal)
+
+target_link_libraries(paltest_vsprintf_test15
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test15/test15.c b/src/pal/tests/palsuite/c_runtime/vsprintf/test15/test15.c
new file mode 100644
index 0000000000..a5b4c94226
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test15/test15.c
@@ -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 vsprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../vsprintf.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/vsprintf/test15/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vsprintf/test15/testinfo.dat
new file mode 100644
index 0000000000..c3b8ebd292
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/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 = vsprintf
+Name = Positive Test for vsprintf
+TYPE = DEFAULT
+EXE1 = test15
+Description
+= Tests the PAL implementation of the vsprintf function.
+= Tests vsprintf with exponential format doubles (uppercase).
+= This test is modeled after _snprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test16/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test16/CMakeLists.txt
new file mode 100644
index 0000000000..ccc21378fc
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test16/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test16.c
+)
+
+add_executable(paltest_vsprintf_test16
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsprintf_test16 coreclrpal)
+
+target_link_libraries(paltest_vsprintf_test16
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test16/test16.c b/src/pal/tests/palsuite/c_runtime/vsprintf/test16/test16.c
new file mode 100644
index 0000000000..a7258db9d6
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test16/test16.c
@@ -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: test16.c
+**
+** Purpose: Test #16 for the vsprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../vsprintf.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/vsprintf/test16/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vsprintf/test16/testinfo.dat
new file mode 100644
index 0000000000..d29634e3ed
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/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 = vsprintf
+Name = Positive Test for vsprintf
+TYPE = DEFAULT
+EXE1 = test16
+Description
+= Tests the PAL implementation of the vsprintf function.
+= Tests vsprintf with decimal point format doubles.
+= This test is modeled after _snprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test17/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test17/CMakeLists.txt
new file mode 100644
index 0000000000..4c9dcd986f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test17/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test17.c
+)
+
+add_executable(paltest_vsprintf_test17
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsprintf_test17 coreclrpal)
+
+target_link_libraries(paltest_vsprintf_test17
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test17/test17.c b/src/pal/tests/palsuite/c_runtime/vsprintf/test17/test17.c
new file mode 100644
index 0000000000..0ad246a1ae
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test17/test17.c
@@ -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: test17.c
+**
+** Purpose: Test #17 for the vsprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../vsprintf.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/vsprintf/test17/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vsprintf/test17/testinfo.dat
new file mode 100644
index 0000000000..0dcd3c869e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/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 = vsprintf
+Name = Positive Test for vsprintf
+TYPE = DEFAULT
+EXE1 = test17
+Description
+= Tests the PAL implementation of the vsprintf function.
+= Tests vsprintf with compact format doubles (lowercase).
+= This test is modeled after _snprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test18/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test18/CMakeLists.txt
new file mode 100644
index 0000000000..2e8610d4a5
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test18/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test18.c
+)
+
+add_executable(paltest_vsprintf_test18
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsprintf_test18 coreclrpal)
+
+target_link_libraries(paltest_vsprintf_test18
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test18/test18.c b/src/pal/tests/palsuite/c_runtime/vsprintf/test18/test18.c
new file mode 100644
index 0000000000..9a45305562
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test18/test18.c
@@ -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: test18.c
+**
+** Purpose: Test #18 for the vsprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../vsprintf.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/vsprintf/test18/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vsprintf/test18/testinfo.dat
new file mode 100644
index 0000000000..43299968c3
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/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 = vsprintf
+Name = Positive Test for vsprintf
+TYPE = DEFAULT
+EXE1 = test18
+Description
+= Tests the PAL implementation of the vsprintf function.
+= Tests vsprintf with compact format doubles (uppercase).
+= This test is modeled after _snprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test19/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test19/CMakeLists.txt
new file mode 100644
index 0000000000..92e39ab597
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test19/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test19.c
+)
+
+add_executable(paltest_vsprintf_test19
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsprintf_test19 coreclrpal)
+
+target_link_libraries(paltest_vsprintf_test19
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test19/test19.c b/src/pal/tests/palsuite/c_runtime/vsprintf/test19/test19.c
new file mode 100644
index 0000000000..18590ed51b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test19/test19.c
@@ -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, "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/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vsprintf/test19/testinfo.dat
new file mode 100644
index 0000000000..1e7bc7615e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/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 = vsprintf
+Name = Positive Test for vsprintf
+TYPE = DEFAULT
+EXE1 = test19
+Description
+= Tests the PAL implementation of the vsprintf function.
+= Tests vsprintf with argument specified precision.
+= This test is modeled after _snprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test2/CMakeLists.txt
new file mode 100644
index 0000000000..2308bc2573
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test2/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test2.c
+)
+
+add_executable(paltest_vsprintf_test2
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsprintf_test2 coreclrpal)
+
+target_link_libraries(paltest_vsprintf_test2
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test2/test2.c b/src/pal/tests/palsuite/c_runtime/vsprintf/test2/test2.c
new file mode 100644
index 0000000000..fbd4b41068
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test2/test2.c
@@ -0,0 +1,42 @@
+// Licensed to the .NET Foundation under one or more 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 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);
+ }
+
+ 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/vsprintf/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vsprintf/test2/testinfo.dat
new file mode 100644
index 0000000000..7958c1ad97
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/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 = vsprintf
+Name = Positive Test for vsprintf
+TYPE = DEFAULT
+EXE1 = test2
+Description
+= Tests the PAL implementation of the vsprintf function.
+= Tests vsprintf with strings.
+= This test is modeled after _snprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test3/CMakeLists.txt
new file mode 100644
index 0000000000..aef24171fc
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test3/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test3.c
+)
+
+add_executable(paltest_vsprintf_test3
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsprintf_test3 coreclrpal)
+
+target_link_libraries(paltest_vsprintf_test3
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test3/test3.c b/src/pal/tests/palsuite/c_runtime/vsprintf/test3/test3.c
new file mode 100644
index 0000000000..742370ebe9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test3/test3.c
@@ -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: test3.c
+**
+** Purpose: Test #3 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);
+ }
+
+ 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/vsprintf/test3/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vsprintf/test3/testinfo.dat
new file mode 100644
index 0000000000..afeb7da953
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/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 = vsprintf
+Name = Positive Test for vsprintf
+TYPE = DEFAULT
+EXE1 = test3
+Description
+= Tests the PAL implementation of the vsprintf function.
+= Tests vsprintf with wide strings.
+= This test is modeled after _snprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test4/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test4/CMakeLists.txt
new file mode 100644
index 0000000000..9570255475
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test4/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test4.c
+)
+
+add_executable(paltest_vsprintf_test4
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsprintf_test4 coreclrpal)
+
+target_link_libraries(paltest_vsprintf_test4
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test4/test4.c b/src/pal/tests/palsuite/c_runtime/vsprintf/test4/test4.c
new file mode 100644
index 0000000000..dc43a9e2c7
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test4/test4.c
@@ -0,0 +1,72 @@
+// Licensed to the .NET Foundation under one or more 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 vsprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../vsprintf.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");
+ DoI64DoubleTest("%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");
+ DoI64DoubleTest("%I64p", lptr, "pointer to 0x1234567887654321",
+ "1234567887654321");
+#endif
+
+
+
+
+
+
+ PAL_Terminate();
+ return PASS;
+}
+
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test4/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vsprintf/test4/testinfo.dat
new file mode 100644
index 0000000000..7331c20375
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/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 = vsprintf
+Name = Positive Test for vsprintf
+TYPE = DEFAULT
+EXE1 = test4
+Description
+= Tests the PAL implementation of the vsprintf function.
+= Tests vsprintf with pointers.
+= This test is modeled after _snprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test5/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test5/CMakeLists.txt
new file mode 100644
index 0000000000..34a3e6243f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test5/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test5.c
+)
+
+add_executable(paltest_vsprintf_test5
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsprintf_test5 coreclrpal)
+
+target_link_libraries(paltest_vsprintf_test5
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test5/test5.c b/src/pal/tests/palsuite/c_runtime/vsprintf/test5/test5.c
new file mode 100644
index 0000000000..e630d8863b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test5/test5.c
@@ -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: Test #5 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);
+ }
+
+ DoTest("foo %n bar", 4, "foo bar");
+ DoTest("foo %#n bar", 4, "foo bar");
+ DoTest("foo % n bar", 4, "foo bar");
+ DoTest("foo %+n bar", 4, "foo bar");
+ DoTest("foo %-n bar", 4, "foo bar");
+ DoTest("foo %0n bar", 4, "foo bar");
+ DoShortTest("foo %hn bar", 4, "foo bar");
+ DoTest("foo %ln bar", 4, "foo bar");
+ DoTest("foo %Ln bar", 4, "foo bar");
+ DoTest("foo %I64n bar", 4, "foo bar");
+ DoTest("foo %20.3n bar", 4, "foo bar");
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test5/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vsprintf/test5/testinfo.dat
new file mode 100644
index 0000000000..81748f88b9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test5/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 = vsprintf
+Name = Positive Test for vsprintf
+TYPE = DEFAULT
+EXE1 = test5
+Description
+= Tests the PAL implementation of the vsprintf function.
+= Tests vsprintf with the count specifier.
+= This test is modeled after _snprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test6/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test6/CMakeLists.txt
new file mode 100644
index 0000000000..dccca0b2b7
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test6/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test6.c
+)
+
+add_executable(paltest_vsprintf_test6
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsprintf_test6 coreclrpal)
+
+target_link_libraries(paltest_vsprintf_test6
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test6/test6.c b/src/pal/tests/palsuite/c_runtime/vsprintf/test6/test6.c
new file mode 100644
index 0000000000..0d38a3a114
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test6/test6.c
@@ -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: test6.c
+**
+** Purpose: Test #6 for the vsprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../vsprintf.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/vsprintf/test6/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vsprintf/test6/testinfo.dat
new file mode 100644
index 0000000000..d76c5bf1a8
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/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 = vsprintf
+Name = Positive Test for vsprintf
+TYPE = DEFAULT
+EXE1 = test6
+Description
+= Tests the PAL implementation of the vsprintf function.
+= Tests vsprintf with characters.
+= This test is modeled after _snprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test7/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test7/CMakeLists.txt
new file mode 100644
index 0000000000..7f18de056e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test7/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test7.c
+)
+
+add_executable(paltest_vsprintf_test7
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsprintf_test7 coreclrpal)
+
+target_link_libraries(paltest_vsprintf_test7
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test7/test7.c b/src/pal/tests/palsuite/c_runtime/vsprintf/test7/test7.c
new file mode 100644
index 0000000000..c9f87d4343
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test7/test7.c
@@ -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: test7.c
+**
+** Purpose: Test #7 for the vsprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../vsprintf.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/vsprintf/test7/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vsprintf/test7/testinfo.dat
new file mode 100644
index 0000000000..facf60d6aa
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/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 = vsprintf
+Name = Positive Test for vsprintf
+TYPE = DEFAULT
+EXE1 = test7
+Description
+= Tests the PAL implementation of the vsprintf function.
+= Tests vsprintf with wide characters.
+= This test is modeled after _snprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test8/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test8/CMakeLists.txt
new file mode 100644
index 0000000000..34c92e1045
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test8/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test8.c
+)
+
+add_executable(paltest_vsprintf_test8
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsprintf_test8 coreclrpal)
+
+target_link_libraries(paltest_vsprintf_test8
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test8/test8.c b/src/pal/tests/palsuite/c_runtime/vsprintf/test8/test8.c
new file mode 100644
index 0000000000..e741d1da8b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test8/test8.c
@@ -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: test8.c
+**
+** Purpose: Test #8 for the vsprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../vsprintf.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/vsprintf/test8/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vsprintf/test8/testinfo.dat
new file mode 100644
index 0000000000..05f84f4999
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/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 = vsprintf
+Name = Positive Test for vsprintf
+TYPE = DEFAULT
+EXE1 = test8
+Description
+= Tests the PAL implementation of the vsprintf function.
+= Tests vsprintf with decimal numbers.
+= This test is modeled after _snprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test9/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test9/CMakeLists.txt
new file mode 100644
index 0000000000..1fe177de95
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test9/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test9.c
+)
+
+add_executable(paltest_vsprintf_test9
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsprintf_test9 coreclrpal)
+
+target_link_libraries(paltest_vsprintf_test9
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test9/test9.c b/src/pal/tests/palsuite/c_runtime/vsprintf/test9/test9.c
new file mode 100644
index 0000000000..e1f7c84195
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test9/test9.c
@@ -0,0 +1,51 @@
+// Licensed to the .NET Foundation under one or more 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 vsprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../vsprintf.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/vsprintf/test9/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vsprintf/test9/testinfo.dat
new file mode 100644
index 0000000000..3bc0057c96
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/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 = vsprintf
+Name = Positive Test for vsprintf
+TYPE = DEFAULT
+EXE1 = test9
+Description
+= Tests the PAL implementation of the vsprintf function.
+= Tests vsprintf with integer numbers.
+= This test is modeled after _snprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/vsprintf.h b/src/pal/tests/palsuite/c_runtime/vsprintf/vsprintf.h
new file mode 100644
index 0000000000..10648d896f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/vsprintf.h
@@ -0,0 +1,218 @@
+// Licensed to the .NET Foundation under one or more 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: vsprintf.h
+**
+** Purpose: Helper functions for the vsprintf tests.
+**
+**
+**===================================================================*/
+#ifndef __VSPRINTF_H__
+#define __VSPRINTF_H__
+
+/* These functions leaks memory like crazy. C'est la vie. */
+int testvsp(char* buf, const char* format, ...)
+{
+ int retVal;
+ va_list arglist;
+
+ va_start(arglist, format);
+ retVal = vsprintf(buf, format, arglist);
+ va_end(arglist);
+
+ return (retVal);
+}
+
+void DoStrTest(char *formatstr, char* param, char *checkstr)
+{
+ char buf[256] = { 0 };
+
+ testvsp(buf, formatstr, param);
+ if (memcmp(buf, checkstr, strlen(buf) + 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 };
+
+ testvsp(buf, formatstr, param);
+ if (memcmp(buf, checkstr, strlen(buf) + 1) != 0)
+ {
+ Fail("ERROR: failed to insert wide string \"%s\" into \"%s\"\n"
+ "Expected \"%s\" got \"%s\".\n",
+ convertC(param), formatstr, checkstr, buf);
+ }
+}
+
+
+void DoCharTest(char *formatstr, char param, char *checkstr)
+{
+ char buf[256] = { 0 };
+
+ testvsp(buf, formatstr, param);
+ if (memcmp(buf, checkstr, strlen(buf) + 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 };
+
+ testvsp(buf, formatstr, param);
+ if (memcmp(buf, checkstr, strlen(buf) + 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 };
+
+ testvsp(buf, formatstr, value);
+ if (memcmp(buf, checkstr, strlen(buf) + 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 *checkstr)
+{
+ char buf[256] = { 0 };
+
+ testvsp(buf, formatstr, value);
+ if (memcmp(buf, checkstr, strlen(buf) + 1) != 0)
+ {
+ Fail("ERROR: failed to insert %s into \"%s\"\n"
+ "Expected \"%s\" got \"%s\".\n",
+ valuestr, formatstr, checkstr, buf);
+ }
+}
+void DoDoubleTest(char *formatstr, double value, char *checkstr1, char
+*checkstr2)
+{
+ char buf[256] = { 0 };
+
+ testvsp(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);
+ }
+}
+/*FROM TEST 9*/
+void DoArgumentPrecTest(char *formatstr, int precision, void *param,
+ char *paramstr, char *checkstr1, char *checkstr2)
+{
+ char buf[256];
+
+ testvsp(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];
+
+ testvsp(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);
+ }
+}
+/*FROM TEST4*/
+void DoPointerTest(char *formatstr, void* param, char* paramstr,
+ char *checkstr1)
+{
+ char buf[256] = { 0 };
+
+ testvsp(buf, formatstr, param);
+ if (memcmp(buf, checkstr1, strlen(checkstr1) + 1))
+ {
+ Fail("ERROR: failed to insert %s into \"%s\"\n"
+ "Expected \"%s\" got \"%s\".\n",
+ paramstr, formatstr, checkstr1, buf);
+ }
+}
+
+void DoI64DoubleTest(char *formatstr, INT64 value, char *valuestr,
+ char *checkstr1)
+{
+ char buf[256] = { 0 };
+
+ testvsp(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 DoTest(char *formatstr, int param, char *checkstr)
+{
+ char buf[256] = { 0 };
+ int n = -1;
+
+ testvsp(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(buf) + 1) != 0)
+ {
+ Fail("ERROR: Expected \"%s\" got \"%s\".\n", checkstr, buf);
+ }
+}
+
+void DoShortTest(char *formatstr, int param, char *checkstr)
+{
+ char buf[256] = { 0 };
+ short int n = -1;
+
+ testvsp(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(buf) + 1) != 0)
+ {
+ Fail("ERROR: Expected \"%s\" got \"%s\".\n", checkstr, buf);
+ }
+}
+
+#endif
+
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/CMakeLists.txt
new file mode 100644
index 0000000000..cafb9536b0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/CMakeLists.txt
@@ -0,0 +1,22 @@
+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/vswprintf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test1/CMakeLists.txt
new file mode 100644
index 0000000000..97fbeb4e28
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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_vswprintf_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vswprintf_test1 coreclrpal)
+
+target_link_libraries(paltest_vswprintf_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test1/test1.c
new file mode 100644
index 0000000000..d386ce104f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test1/test1.c
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more 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 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 */
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ WCHAR *checkstr = NULL;
+ WCHAR buf[256] = { 0 };
+
+ if (PAL_Initialize(argc, argv) != 0)
+ return(FAIL);
+
+ checkstr = convert("hello world");
+ testvswp(buf, checkstr);
+
+ if (memcmp(checkstr, buf, wcslen(checkstr)*2+2) != 0)
+ {
+ Fail("ERROR: Expected \"%s\", got \"%s\"\n",
+ convertC(checkstr), convertC(buf));
+ }
+
+ free(checkstr);
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vswprintf/test1/testinfo.dat
new file mode 100644
index 0000000000..6161190d4c
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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 = vswprintf
+Name = Positive Test for vswprintf
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Tests the PAL implementation of the vswprintf function.
+= General test to see if vswprintf works correctly.
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test10/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test10/CMakeLists.txt
new file mode 100644
index 0000000000..06c11f68ca
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test10/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test10.c
+)
+
+add_executable(paltest_vswprintf_test10
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vswprintf_test10 coreclrpal)
+
+target_link_libraries(paltest_vswprintf_test10
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test10/test10.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test10/test10.c
new file mode 100644
index 0000000000..7f316e28f6
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test10/test10.c
@@ -0,0 +1,48 @@
+// Licensed to the .NET Foundation under one or more 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 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 */
+
+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/vswprintf/test10/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vswprintf/test10/testinfo.dat
new file mode 100644
index 0000000000..81fbce5e4d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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 = vswprintf
+Name = Positive Test for vswprintf
+TYPE = DEFAULT
+EXE1 = test10
+Description
+= Tests the PAL implementation of the vswprintf function.
+= Tests vswprintf with octal numbers.
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test11/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test11/CMakeLists.txt
new file mode 100644
index 0000000000..5237ba4e1d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test11/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test11.c
+)
+
+add_executable(paltest_vswprintf_test11
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vswprintf_test11 coreclrpal)
+
+target_link_libraries(paltest_vswprintf_test11
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test11/test11.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test11/test11.c
new file mode 100644
index 0000000000..608069f829
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test11/test11.c
@@ -0,0 +1,48 @@
+// Licensed to the .NET Foundation under one or more 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 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 */
+
+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/vswprintf/test11/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vswprintf/test11/testinfo.dat
new file mode 100644
index 0000000000..13585cc94e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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 = vswprintf
+Name = Positive Test for vswprintf
+TYPE = DEFAULT
+EXE1 = test11
+Description
+= Tests the PAL implementation of the vswprintf function.
+= Tests vswprintf with unsigned numbers.
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test12/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test12/CMakeLists.txt
new file mode 100644
index 0000000000..26199c3dcc
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test12/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test12.c
+)
+
+add_executable(paltest_vswprintf_test12
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vswprintf_test12 coreclrpal)
+
+target_link_libraries(paltest_vswprintf_test12
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test12/test12.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test12/test12.c
new file mode 100644
index 0000000000..36b203853a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test12/test12.c
@@ -0,0 +1,48 @@
+// Licensed to the .NET Foundation under one or more 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 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 */
+
+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/vswprintf/test12/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vswprintf/test12/testinfo.dat
new file mode 100644
index 0000000000..d42e9a1801
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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 = vswprintf
+Name = Positive Test for vswprintf
+TYPE = DEFAULT
+EXE1 = test12
+Description
+= Tests the PAL implementation of the vswprintf function.
+= Tests vswprintf with hex numbers (lowercase).
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test13/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test13/CMakeLists.txt
new file mode 100644
index 0000000000..d0acd98d64
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test13/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test13.c
+)
+
+add_executable(paltest_vswprintf_test13
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vswprintf_test13 coreclrpal)
+
+target_link_libraries(paltest_vswprintf_test13
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test13/test13.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test13/test13.c
new file mode 100644
index 0000000000..63dc36a960
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test13/test13.c
@@ -0,0 +1,48 @@
+// Licensed to the .NET Foundation under one or more 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 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 */
+
+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/vswprintf/test13/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vswprintf/test13/testinfo.dat
new file mode 100644
index 0000000000..f7c6756e30
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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 = vswprintf
+Name = Positive Test for vswprintf
+TYPE = DEFAULT
+EXE1 = test13
+Description
+= Tests the PAL implementation of the vswprintf function.
+= Tests vswprintf with hex numbers (uppercase).
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test14/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test14/CMakeLists.txt
new file mode 100644
index 0000000000..06c12674a4
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test14/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test14.c
+)
+
+add_executable(paltest_vswprintf_test14
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vswprintf_test14 coreclrpal)
+
+target_link_libraries(paltest_vswprintf_test14
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test14/test14.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test14/test14.c
new file mode 100644
index 0000000000..bb4ab16a54
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test14/test14.c
@@ -0,0 +1,61 @@
+// Licensed to the .NET Foundation under one or more 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 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 */
+
+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/vswprintf/test14/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vswprintf/test14/testinfo.dat
new file mode 100644
index 0000000000..e9615f906a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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 = vswprintf
+Name = Positive Test for vswprintf
+TYPE = DEFAULT
+EXE1 = test14
+Description
+= Tests the PAL implementation of the vswprintf function.
+= Tests vswprintf with exponential format doubles (lowercase).
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test15/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test15/CMakeLists.txt
new file mode 100644
index 0000000000..05dc41b0d8
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test15/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test15.c
+)
+
+add_executable(paltest_vswprintf_test15
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vswprintf_test15 coreclrpal)
+
+target_link_libraries(paltest_vswprintf_test15
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test15/test15.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test15/test15.c
new file mode 100644
index 0000000000..6296220c4e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test15/test15.c
@@ -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: test15.c
+**
+** Purpose: Test #15 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 */
+
+
+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/vswprintf/test15/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vswprintf/test15/testinfo.dat
new file mode 100644
index 0000000000..24ff03b11a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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 = vswprintf
+Name = Positive Test for vswprintf
+TYPE = DEFAULT
+EXE1 = test15
+Description
+= Tests the PAL implementation of the vswprintf function.
+= Tests vswprintf with exponential format doubles (uppercase).
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test16/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test16/CMakeLists.txt
new file mode 100644
index 0000000000..3c42755043
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test16/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test16.c
+)
+
+add_executable(paltest_vswprintf_test16
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vswprintf_test16 coreclrpal)
+
+target_link_libraries(paltest_vswprintf_test16
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test16/test16.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test16/test16.c
new file mode 100644
index 0000000000..3a2059a491
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test16/test16.c
@@ -0,0 +1,61 @@
+// Licensed to the .NET Foundation under one or more 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 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 */
+
+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/vswprintf/test16/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vswprintf/test16/testinfo.dat
new file mode 100644
index 0000000000..6dc45f4c78
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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 = vswprintf
+Name = Positive Test for vswprintf
+TYPE = DEFAULT
+EXE1 = test16
+Description
+= Tests the PAL implementation of the vswprintf function.
+= Tests vswprintf with decimal point format doubles.
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test17/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test17/CMakeLists.txt
new file mode 100644
index 0000000000..b94c466d5f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test17/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test17.c
+)
+
+add_executable(paltest_vswprintf_test17
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vswprintf_test17 coreclrpal)
+
+target_link_libraries(paltest_vswprintf_test17
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test17/test17.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test17/test17.c
new file mode 100644
index 0000000000..95e3bd9995
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test17/test17.c
@@ -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: test17.c
+**
+** Purpose: Test #17 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 */
+
+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/vswprintf/test17/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vswprintf/test17/testinfo.dat
new file mode 100644
index 0000000000..815e57ddf5
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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 = vswprintf
+Name = Positive Test for vswprintf
+TYPE = DEFAULT
+EXE1 = test17
+Description
+= Tests the PAL implementation of the vswprintf function.
+= Tests vswprintf with compact format doubles (lowercase).
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test18/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test18/CMakeLists.txt
new file mode 100644
index 0000000000..57cc8ccb03
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test18/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test18.c
+)
+
+add_executable(paltest_vswprintf_test18
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vswprintf_test18 coreclrpal)
+
+target_link_libraries(paltest_vswprintf_test18
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test18/test18.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test18/test18.c
new file mode 100644
index 0000000000..ae7ae4c44b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test18/test18.c
@@ -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: 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 */
+
+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/vswprintf/test18/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vswprintf/test18/testinfo.dat
new file mode 100644
index 0000000000..b5165999a6
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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 = vswprintf
+Name = Positive Test for vswprintf
+TYPE = DEFAULT
+EXE1 = test18
+Description
+= Tests the PAL implementation of the vswprintf function.
+= Tests vswprintf with compact format doubles (uppercase).
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test19/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test19/CMakeLists.txt
new file mode 100644
index 0000000000..2187b58727
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test19/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test19.c
+)
+
+add_executable(paltest_vswprintf_test19
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vswprintf_test19 coreclrpal)
+
+target_link_libraries(paltest_vswprintf_test19
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test19/test19.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test19/test19.c
new file mode 100644
index 0000000000..c00185be6d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test19/test19.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: 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/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vswprintf/test19/testinfo.dat
new file mode 100644
index 0000000000..ccc08cd7ba
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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 = vswprintf
+Name = Positive Test for vswprintf
+TYPE = DEFAULT
+EXE1 = test19
+Description
+= Tests the PAL implementation of the vswprintf function.
+= Tests vswprintf with argument specified precision.
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test2/CMakeLists.txt
new file mode 100644
index 0000000000..295448cb0c
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test2/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test2.c
+)
+
+add_executable(paltest_vswprintf_test2
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vswprintf_test2 coreclrpal)
+
+target_link_libraries(paltest_vswprintf_test2
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test2/test2.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test2/test2.c
new file mode 100644
index 0000000000..491d99f0cf
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test2/test2.c
@@ -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 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 */
+
+
+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/vswprintf/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vswprintf/test2/testinfo.dat
new file mode 100644
index 0000000000..d6d7c3e8bd
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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 = vswprintf
+Name = Positive Test for vswprintf
+TYPE = DEFAULT
+EXE1 = test2
+Description
+= Tests the PAL implementation of the vswprintf function.
+= Tests vswprintf with strings.
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test3/CMakeLists.txt
new file mode 100644
index 0000000000..1fb6272ae7
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test3/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test3.c
+)
+
+add_executable(paltest_vswprintf_test3
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vswprintf_test3 coreclrpal)
+
+target_link_libraries(paltest_vswprintf_test3
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test3/test3.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test3/test3.c
new file mode 100644
index 0000000000..1eb0b65ebe
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test3/test3.c
@@ -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 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 */
+
+
+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/vswprintf/test3/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vswprintf/test3/testinfo.dat
new file mode 100644
index 0000000000..8fb9dc8060
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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 = vswprintf
+Name = Positive Test for vswprintf
+TYPE = DEFAULT
+EXE1 = test3
+Description
+= Tests the PAL implementation of the vswprintf function.
+= Tests vswprintf with wide strings.
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test4/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test4/CMakeLists.txt
new file mode 100644
index 0000000000..cae0806e03
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test4/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test4.c
+)
+
+add_executable(paltest_vswprintf_test4
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vswprintf_test4 coreclrpal)
+
+target_link_libraries(paltest_vswprintf_test4
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test4/test4.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test4/test4.c
new file mode 100644
index 0000000000..5c9047b5a7
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test4/test4.c
@@ -0,0 +1,118 @@
+// Licensed to the .NET Foundation under one or more 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 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 */
+static void DoPointerTest(WCHAR *formatstr, void* param, WCHAR* paramstr,
+ WCHAR *checkstr1)
+{
+ WCHAR buf[256] = { 0 };
+
+ testvswp(buf, 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 };
+
+ testvswp(buf, 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("0000000000000000"));
+ 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/vswprintf/test4/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vswprintf/test4/testinfo.dat
new file mode 100644
index 0000000000..435f9703cd
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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 = vswprintf
+Name = Positive Test for vswprintf
+TYPE = DEFAULT
+EXE1 = test4
+Description
+= Tests the PAL implementation of the vswprintf function.
+= Tests vswprintf with pointers.
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test5/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test5/CMakeLists.txt
new file mode 100644
index 0000000000..7c480455ed
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test5/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test5.c
+)
+
+add_executable(paltest_vswprintf_test5
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vswprintf_test5 coreclrpal)
+
+target_link_libraries(paltest_vswprintf_test5
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test5/test5.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test5/test5.c
new file mode 100644
index 0000000000..42146c8be7
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test5/test5.c
@@ -0,0 +1,79 @@
+// Licensed to the .NET Foundation under one or more 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 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 */
+
+static void DoTest(WCHAR *formatstr, int param, WCHAR *checkstr)
+{
+ WCHAR buf[256] = { 0 };
+ int n = -1;
+
+ testvswp(buf, 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;
+
+ testvswp(buf, 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/vswprintf/test5/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vswprintf/test5/testinfo.dat
new file mode 100644
index 0000000000..17ca0fd33b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test5/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 = vswprintf
+Name = Positive Test for vswprintf
+TYPE = DEFAULT
+EXE1 = test5
+Description
+= Tests the PAL implementation of the vswprintf function.
+= Tests vswprintf with the count specifier.
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test6/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test6/CMakeLists.txt
new file mode 100644
index 0000000000..d7de580853
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test6/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test6.c
+)
+
+add_executable(paltest_vswprintf_test6
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vswprintf_test6 coreclrpal)
+
+target_link_libraries(paltest_vswprintf_test6
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test6/test6.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test6/test6.c
new file mode 100644
index 0000000000..51e99267a1
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test6/test6.c
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more 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 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 */
+
+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/vswprintf/test6/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vswprintf/test6/testinfo.dat
new file mode 100644
index 0000000000..f4ad2e954e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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 = vswprintf
+Name = Positive Test for vswprintf
+TYPE = DEFAULT
+EXE1 = test6
+Description
+= Tests the PAL implementation of the vswprintf function.
+= Tests vswprintf with characters.
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test7/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test7/CMakeLists.txt
new file mode 100644
index 0000000000..eb07ee2cae
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test7/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test7.c
+)
+
+add_executable(paltest_vswprintf_test7
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vswprintf_test7 coreclrpal)
+
+target_link_libraries(paltest_vswprintf_test7
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test7/test7.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test7/test7.c
new file mode 100644
index 0000000000..6037cb0fe7
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test7/test7.c
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more 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 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 */
+
+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/vswprintf/test7/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vswprintf/test7/testinfo.dat
new file mode 100644
index 0000000000..ed0a474f7e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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 = vswprintf
+Name = Positive Test for vswprintf
+TYPE = DEFAULT
+EXE1 = test7
+Description
+= Tests the PAL implementation of the vswprintf function.
+= Tests vswprintf with wide characters.
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test8/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test8/CMakeLists.txt
new file mode 100644
index 0000000000..ed35ea8dd0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test8/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test8.c
+)
+
+add_executable(paltest_vswprintf_test8
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vswprintf_test8 coreclrpal)
+
+target_link_libraries(paltest_vswprintf_test8
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test8/test8.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test8/test8.c
new file mode 100644
index 0000000000..baba524650
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test8/test8.c
@@ -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: test8.c
+**
+** Purpose: Test #8 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 */
+
+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/vswprintf/test8/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vswprintf/test8/testinfo.dat
new file mode 100644
index 0000000000..4c5114bd27
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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 = vswprintf
+Name = Positive Test for vswprintf
+TYPE = DEFAULT
+EXE1 = test8
+Description
+= Tests the PAL implementation of the vswprintf function.
+= Tests vswprintf with decimal numbers.
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test9/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test9/CMakeLists.txt
new file mode 100644
index 0000000000..7098da31d0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test9/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test9.c
+)
+
+add_executable(paltest_vswprintf_test9
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vswprintf_test9 coreclrpal)
+
+target_link_libraries(paltest_vswprintf_test9
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test9/test9.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test9/test9.c
new file mode 100644
index 0000000000..5de004f5ed
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test9/test9.c
@@ -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: test9.c
+**
+** Purpose: Test #9 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 */
+
+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/vswprintf/test9/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vswprintf/test9/testinfo.dat
new file mode 100644
index 0000000000..3c2bcdf3e5
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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 = vswprintf
+Name = Positive Test for vswprintf
+TYPE = DEFAULT
+EXE1 = test9
+Description
+= Tests the PAL implementation of the vswprintf function.
+= Tests vswprintf with integer numbers
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/vswprintf.h b/src/pal/tests/palsuite/c_runtime/vswprintf/vswprintf.h
new file mode 100644
index 0000000000..a79c9bb7a9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/vswprintf.h
@@ -0,0 +1,132 @@
+// Licensed to the .NET Foundation under one or more 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: vswprintf.h
+**
+** Purpose: Containts common testing functions for vswprintf
+**
+**
+**==========================================================================*/
+
+#ifndef __vswprintf_H__
+#define __vswprintf_H__
+
+/* These functions leaks memory like crazy. C'est la vie. */
+int testvswp(wchar_t* buf, const wchar_t* format, ...)
+{
+ int retVal = 0;
+ va_list arglist;
+
+ va_start(arglist, format);
+ retVal = vswprintf(buf, format, arglist);
+ va_end(arglist);
+
+ return( retVal);
+}
+
+void DoWStrTest(WCHAR *formatstr, WCHAR *param, WCHAR *checkstr)
+{
+ WCHAR buf[256] = { 0 };
+
+ testvswp(buf, 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 };
+
+ testvswp(buf, 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 };
+
+ testvswp(buf, 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 };
+
+ testvswp(buf, 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 };
+
+ testvswp(buf, 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 };
+
+ testvswp(buf, 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 };
+
+ testvswp(buf, 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/wcscat/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcscat/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcscat/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/wcscat/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcscat/test1/CMakeLists.txt
new file mode 100644
index 0000000000..34dfee01bd
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcscat/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_wcscat_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_wcscat_test1 coreclrpal)
+
+target_link_libraries(paltest_wcscat_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/wcscat/test1/test1.c b/src/pal/tests/palsuite/c_runtime/wcscat/test1/test1.c
new file mode 100644
index 0000000000..789eebf5a3
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcscat/test1/test1.c
@@ -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
+ */
+
+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/testinfo.dat b/src/pal/tests/palsuite/c_runtime/wcscat/test1/testinfo.dat
new file mode 100644
index 0000000000..878c446251
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcscat/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 = wcscat
+Name = Positive Test for wcscat
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Test to that wcscat correctly concatanates wide strings, including placing
+= null pointers
diff --git a/src/pal/tests/palsuite/c_runtime/wcschr/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcschr/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcschr/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/wcschr/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcschr/test1/CMakeLists.txt
new file mode 100644
index 0000000000..542d70b7e6
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcschr/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_wcschr_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_wcschr_test1 coreclrpal)
+
+target_link_libraries(paltest_wcschr_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/wcschr/test1/test1.c b/src/pal/tests/palsuite/c_runtime/wcschr/test1/test1.c
new file mode 100644
index 0000000000..a4963672f8
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcschr/test1/test1.c
@@ -0,0 +1,51 @@
+// Licensed to the .NET Foundation under one or more 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 wcschr correctly finds the first occurrence of a character in a
+** string
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char *argv[])
+{
+ WCHAR str[] = {'f','o','o',' ','b','a','r',' ',0};
+ WCHAR c = (WCHAR)' ';
+ WCHAR c2 = (WCHAR)'$';
+ WCHAR *ptr;
+
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ ptr = wcschr(str, c);
+ if (ptr != str + 3)
+ {
+ Fail("ERROR: expected wcschr to return pointer to %p, got %p\n",
+ str + 3, ptr);
+ }
+
+ ptr = wcschr(str, c2);
+ if (ptr != NULL)
+ {
+ Fail("ERROR: expected wcschr to return pointer to %p, got %p\n",
+ NULL, ptr);
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
+
diff --git a/src/pal/tests/palsuite/c_runtime/wcschr/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/wcschr/test1/testinfo.dat
new file mode 100644
index 0000000000..40a166d615
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcschr/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 = wcschr
+Name = Positive Test for wcschr
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Tests that wcschr correctly finds the first occurrence of a character in a
+= string.
diff --git a/src/pal/tests/palsuite/c_runtime/wcscmp/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcscmp/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcscmp/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/wcscmp/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcscmp/test1/CMakeLists.txt
new file mode 100644
index 0000000000..009e48e1ba
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcscmp/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_wcscmp_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_wcscmp_test1 coreclrpal)
+
+target_link_libraries(paltest_wcscmp_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/wcscmp/test1/test1.c b/src/pal/tests/palsuite/c_runtime/wcscmp/test1/test1.c
new file mode 100644
index 0000000000..1c38dd6d58
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcscmp/test1/test1.c
@@ -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: test1.c
+**
+** Purpose: Tests that wcscmp correctly compares two strings with
+** case sensitivity.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ WCHAR str1[] = {'f','o','o',0};
+ WCHAR str2[] = {'f','o','o','x',0};
+ WCHAR str3[] = {'f','O','o',0};
+ char cstr1[] = "foo";
+ char cstr2[] = "foox";
+ char cstr3[] = "fOo";
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+
+ if (wcscmp(str1, str2) >= 0)
+ {
+ Fail("ERROR: wcscmp(\"%s\", \"%s\") returned >= 0\n", cstr1, cstr2);
+ }
+
+ if (wcscmp(str2, str1) <= 0)
+ {
+ Fail("ERROR: wcscmp(\"%s\", \"%s\") returned <= 0\n", cstr2, cstr1);
+ }
+
+ if (wcscmp(str1, str3) <= 0)
+ {
+ Fail("ERROR: wcscmp(\"%s\", \"%s\") returned >= 0\n", cstr1, cstr3);
+ }
+
+ if (wcscmp(str3, str1) >= 0)
+ {
+ Fail("ERROR: wcscmp(\"%s\", \"%s\") returned >= 0\n", cstr3, cstr1);
+ }
+
+ PAL_Terminate();
+
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/wcscmp/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/wcscmp/test1/testinfo.dat
new file mode 100644
index 0000000000..0fe696fbe7
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcscmp/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 = wcscmp
+Name = Test #1 for wcscmp
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Tests that wcscmp correctly compares two strings with case sensitivity.
diff --git a/src/pal/tests/palsuite/c_runtime/wcscpy/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcscpy/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcscpy/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/wcscpy/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcscpy/test1/CMakeLists.txt
new file mode 100644
index 0000000000..5f21b829ee
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcscpy/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_wcscpy_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_wcscpy_test1 coreclrpal)
+
+target_link_libraries(paltest_wcscpy_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/wcscpy/test1/test1.c b/src/pal/tests/palsuite/c_runtime/wcscpy/test1/test1.c
new file mode 100644
index 0000000000..4e45c86516
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcscpy/test1/test1.c
@@ -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.
+ */
+
+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/testinfo.dat b/src/pal/tests/palsuite/c_runtime/wcscpy/test1/testinfo.dat
new file mode 100644
index 0000000000..ef9c58ecc9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcscpy/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 = wcscpy
+Name = Positive Test for wcscpy
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Tests that wcscpy correctly copies a null-terminated wide string.
diff --git a/src/pal/tests/palsuite/c_runtime/wcslen/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcslen/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcslen/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/wcslen/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcslen/test1/CMakeLists.txt
new file mode 100644
index 0000000000..de0f1c22d3
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcslen/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_wcslen_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_wcslen_test1 coreclrpal)
+
+target_link_libraries(paltest_wcslen_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/wcslen/test1/test1.c b/src/pal/tests/palsuite/c_runtime/wcslen/test1/test1.c
new file mode 100644
index 0000000000..17d0327628
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcslen/test1/test1.c
@@ -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: test1.c
+**
+** Purpose:
+** Tests that wcslen correctly returns the length (in wide characters,
+** not byte) of a wide string
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char *argv[])
+{
+ WCHAR str1[] = {'f','o','o',' ',0};
+ WCHAR str2[] = {0};
+ int ret;
+
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ ret = wcslen(str1);
+ if (ret != 4)
+ {
+ Fail("ERROR: Expected wcslen of \"foo \" to be 4, got %d\n", ret);
+ }
+
+ ret = wcslen(str2);
+ if (ret != 0)
+ {
+ Fail("ERROR: Expected wcslen of \"\" to be 0, got %d\n", ret);
+ }
+
+
+ PAL_Terminate();
+ return PASS;
+}
+
diff --git a/src/pal/tests/palsuite/c_runtime/wcslen/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/wcslen/test1/testinfo.dat
new file mode 100644
index 0000000000..cfdef4819d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcslen/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 = wcslen
+Name = Positive Test for wcslen
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Tests that wcslen correctly returns the length (in wide characters, not byte)
+= of a wide string
diff --git a/src/pal/tests/palsuite/c_runtime/wcsncat/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcsncat/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcsncat/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/wcsncat/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcsncat/test1/CMakeLists.txt
new file mode 100644
index 0000000000..12c286a43a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcsncat/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_wcsncat_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_wcsncat_test1 coreclrpal)
+
+target_link_libraries(paltest_wcsncat_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/wcsncat/test1/test1.c b/src/pal/tests/palsuite/c_runtime/wcsncat/test1/test1.c
new file mode 100644
index 0000000000..0cd5c3e15a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcsncat/test1/test1.c
@@ -0,0 +1,77 @@
+// Licensed to the .NET Foundation under one or more 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 wcsncat correctly appends wide strings, making sure it handles
+** count argument correctly (appending no more than count characters, always
+** placing a null, and padding the string if necessary).
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+
+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;
+ int i;
+
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ dest[0] = 0;
+ for (i=1; i<80; i++)
+ {
+ dest[i] = (WCHAR)'x';
+ }
+
+ ptr = wcsncat(dest, str1, wcslen(str1));
+ if (ptr != dest)
+ {
+ Fail("ERROR: Expected wcsncat to return ptr to %p, got %p", dest, ptr);
+ }
+
+ ptr = wcsncat(dest, str2, 3);
+ if (ptr != dest)
+ {
+ Fail("ERROR: Expected wcsncat to return ptr to %p, got %p", dest, ptr);
+ }
+ if (dest[7] != 0)
+ {
+ Fail("ERROR: wcsncat did not place a terminating NULL!");
+ }
+
+ ptr = wcsncat(dest, str3, 20);
+ if (ptr != dest)
+ {
+ Fail("ERROR: Expected wcsncat to return ptr to %p, got %p", dest, ptr);
+ }
+ if (wcscmp(dest, test) != 0)
+ {
+ Fail("ERROR: Expected wcsncat to give \"%S\", got \"%S\"\n",
+ test, dest);
+ }
+ if (dest[wcslen(test)+1] != (WCHAR)'x')
+ {
+ Fail("wcsncat went out of bounds!\n");
+ }
+
+ PAL_Terminate();
+
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/wcsncat/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/wcsncat/test1/testinfo.dat
new file mode 100644
index 0000000000..39077a237d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcsncat/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 = wcsncat
+Name = Test #1 for wcsncat
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Tests that wcsncat correctly appends wide strings, making sure it handles
+= count argument correctly (appending no more than count characters, always
+= placing a null, and padding the string if necessary).
diff --git a/src/pal/tests/palsuite/c_runtime/wcsncmp/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcsncmp/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcsncmp/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/wcsncmp/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcsncmp/test1/CMakeLists.txt
new file mode 100644
index 0000000000..56c9b25806
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcsncmp/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_wcsncmp_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_wcsncmp_test1 coreclrpal)
+
+target_link_libraries(paltest_wcsncmp_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/wcsncmp/test1/test1.c b/src/pal/tests/palsuite/c_runtime/wcsncmp/test1/test1.c
new file mode 100644
index 0000000000..4e4488f5a1
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcsncmp/test1/test1.c
@@ -0,0 +1,73 @@
+// Licensed to the .NET Foundation under one or more 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 wcsncmp case-sensitively compares wide strings, making sure that
+** the count argument is handled correctly.
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+
+/*
+ * Notes: uses wcslen.
+ */
+
+int __cdecl main(int argc, char *argv[])
+{
+ WCHAR str1[] = {'f','o','o',0};
+ WCHAR str2[] = {'f','o','o','x',0};
+ WCHAR str3[] = {'f','O','o',0};
+ char cstr1[] = "foo";
+ char cstr2[] = "foox";
+ char cstr3[] = "fOo";
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+
+ if (wcsncmp(str1, str2, wcslen(str2)) >= 0)
+ {
+ Fail("ERROR: wcsncmp(\"%s\", \"%s\", %d) returned >= 0\n", cstr1,
+ cstr2, wcslen(str2));
+ }
+
+ if (wcsncmp(str2, str1, wcslen(str2)) <= 0)
+ {
+ Fail("ERROR: wcsncmp(\"%s\", \"%s\", %d) returned <= 0\n", cstr2,
+ cstr1, wcslen(str2));
+ }
+
+ if (wcsncmp(str1, str2, wcslen(str1)) != 0)
+ {
+ Fail("ERROR: wcsncmp(\"%s\", \"%s\", %d) returned != 0\n", cstr1,
+ cstr2, wcslen(str1));
+ }
+
+ if (wcsncmp(str1, str3, wcslen(str1)) <= 0)
+ {
+ Fail("ERROR: wcsncmp(\"%s\", \"%s\", %d) returned >= 0\n", cstr1,
+ cstr3, wcslen(str1));
+ }
+
+ if (wcsncmp(str3, str1, wcslen(str1)) >= 0)
+ {
+ Fail("ERROR: wcsncmp(\"%s\", \"%s\", %d) returned >= 0\n", cstr3,
+ cstr1, wcslen(str1));
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
+
diff --git a/src/pal/tests/palsuite/c_runtime/wcsncmp/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/wcsncmp/test1/testinfo.dat
new file mode 100644
index 0000000000..1f8b508748
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcsncmp/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 = wcsncmp
+Name = Positive Test for wcsncmp
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Tests that wcsncmp case-sensitively compares wide strings, making sure that
+= the count argument is handled correctly.
diff --git a/src/pal/tests/palsuite/c_runtime/wcsncpy/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcsncpy/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcsncpy/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/wcsncpy/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcsncpy/test1/CMakeLists.txt
new file mode 100644
index 0000000000..1c1d70ba04
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcsncpy/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_wcsncpy_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_wcsncpy_test1 coreclrpal)
+
+target_link_libraries(paltest_wcsncpy_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/wcsncpy/test1/test1.c b/src/pal/tests/palsuite/c_runtime/wcsncpy/test1/test1.c
new file mode 100644
index 0000000000..50d97b0e9c
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcsncpy/test1/test1.c
@@ -0,0 +1,84 @@
+// Licensed to the .NET Foundation under one or more 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 to see that wcsncpy correctly copies wide strings, including handling
+** the count argument correctly (copying no more that count characters, not
+** automatically adding a null, and padding if necessary).
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ WCHAR dest[80];
+ WCHAR result[] = {'f','o','o','b','a','r',0};
+ WCHAR str[] = {'f','o','o','b','a','r',0,'b','a','z',0};
+ WCHAR *ret;
+ int i;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ for (i=0; i<80; i++)
+ {
+ dest[i] = 'x';
+ }
+
+ ret = wcsncpy(dest, str, 3);
+ if (ret != dest)
+ {
+ Fail("Expected wcsncpy to return %p, got %p!\n", dest, ret);
+ }
+
+ if (wcsncmp(dest, result, 3) != 0)
+ {
+ Fail("Expected wcsncpy to give \"%S\", got \"%S\"!\n", result, dest);
+ }
+
+ if (dest[3] != (WCHAR)'x')
+ {
+ Fail("wcsncpy overflowed!\n");
+ }
+
+ ret = wcsncpy(dest, str, 40);
+ if (ret != dest)
+ {
+ Fail("Expected wcsncpy to return %p, got %p!\n", dest, ret);
+ }
+
+ if (wcscmp(dest, result) != 0)
+ {
+ Fail("Expected wcsncpy to give \"%S\", got \"%S\"!\n", result, dest);
+ }
+
+ for (i=wcslen(str); i<40; i++)
+ {
+ if (dest[i] != 0)
+ {
+ Fail("wcsncpy failed to pad the destination with NULLs!\n");
+ }
+ }
+
+ if (dest[40] != (WCHAR)'x')
+ {
+ Fail("wcsncpy overflowed!\n");
+ }
+
+
+
+ PAL_Terminate();
+
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/wcsncpy/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/wcsncpy/test1/testinfo.dat
new file mode 100644
index 0000000000..b8b0ddb3f7
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcsncpy/test1/testinfo.dat
@@ -0,0 +1,15 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = wcsncpy
+Name = Test #1 for wcsncpy
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Tests to see that wcsncpy correctly copies wide strings, including handling
+= the count argument correctly (copying no more that count characters, not
+= automatically adding a null, and padding if necessary).
+
diff --git a/src/pal/tests/palsuite/c_runtime/wcspbrk/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcspbrk/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcspbrk/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/wcspbrk/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcspbrk/test1/CMakeLists.txt
new file mode 100644
index 0000000000..c6a3f87d75
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcspbrk/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_wcspbrk_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_wcspbrk_test1 coreclrpal)
+
+target_link_libraries(paltest_wcspbrk_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/wcspbrk/test1/test1.c b/src/pal/tests/palsuite/c_runtime/wcspbrk/test1/test1.c
new file mode 100644
index 0000000000..b0432f7819
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcspbrk/test1/test1.c
@@ -0,0 +1,61 @@
+// Licensed to the .NET Foundation under one or more 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 wcspbrk returns a pointer to the first element in the first
+** string that matches a character in the second (or NULL).
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char *argv[])
+{
+ WCHAR *string;
+ WCHAR *key1;
+ WCHAR *key2;
+ WCHAR key3[] = {0};
+ WCHAR *result;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ string = convert("foo bar baz bar");
+ key1 = convert("z ");
+ key2 = convert("Q");
+
+ result = wcspbrk(string, key1);
+ if (result != string + 3)
+ {
+ Fail("ERROR: Got incorrect result in scanning \"%s\" with the set \"%s\".\n"
+ "Expected to get pointer to %#p, got %#p\n", convertC(string),
+ convertC(key1), string + 3, result);
+ }
+
+ result = wcspbrk(string, key2);
+ if (result != NULL)
+ {
+ Fail("ERROR: Got incorrect result in scanning \"%s\" with the set \"%s\".\n"
+ "Expected to get pointer to %#p, got %#p\n", convertC(string),
+ convertC(key2), NULL, result);
+ }
+
+ result = wcspbrk(string, key3);
+ if (result != NULL)
+ {
+ Fail("ERROR: Got incorrect result in scanning \"%s\" with the set \"%s\".\n"
+ "Expected to get pointer to %#p, got %#p\n", convertC(string),
+ convertC(key3), NULL, result);
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/wcspbrk/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/wcspbrk/test1/testinfo.dat
new file mode 100644
index 0000000000..7044197b77
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcspbrk/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 = wcspbrk
+Name = Positive Test for wcspbrk
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Tests that wcspbrk returns a pointer to the first element in the first
+= string that matches a character in the second (or NULL).
diff --git a/src/pal/tests/palsuite/c_runtime/wcsrchr/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcsrchr/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcsrchr/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/wcsrchr/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcsrchr/test1/CMakeLists.txt
new file mode 100644
index 0000000000..80513af1af
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcsrchr/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_wcsrchr_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_wcsrchr_test1 coreclrpal)
+
+target_link_libraries(paltest_wcsrchr_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/wcsrchr/test1/test1.c b/src/pal/tests/palsuite/c_runtime/wcsrchr/test1/test1.c
new file mode 100644
index 0000000000..ae8765776e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcsrchr/test1/test1.c
@@ -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: test1.c
+**
+** Purpose:
+** Tests to see that wcsrchr correctly returns a pointer to the last occurence
+** of a character in a a string.
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char *argv[])
+{
+ WCHAR str[] = {'f','o','o',' ','b','a','r',' ','b','a','z',0};
+ WCHAR c = (WCHAR)' ';
+ WCHAR c2 = (WCHAR)'$';
+ WCHAR *ptr;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ ptr = wcsrchr(str, c);
+ if (ptr != str + 7)
+ {
+ Fail("ERROR: expected wcsrchr to return pointer to %p, got %p\n",
+ str + 7, ptr);
+ }
+
+ ptr = wcsrchr(str, c2);
+ if (ptr != NULL)
+ {
+ Fail("ERROR: expected wcsrchr to return pointer to %p, got %p\n",
+ NULL, ptr);
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
+
diff --git a/src/pal/tests/palsuite/c_runtime/wcsrchr/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/wcsrchr/test1/testinfo.dat
new file mode 100644
index 0000000000..984df9a3f3
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcsrchr/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 = wcsrchr
+Name = Positive Test for wcsrchr
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Tests to see that wcsrchr correctly returns a pointer to the last occurence
+= of a character in a a string.
diff --git a/src/pal/tests/palsuite/c_runtime/wcsstr/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcsstr/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcsstr/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/wcsstr/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcsstr/test1/CMakeLists.txt
new file mode 100644
index 0000000000..e42619344d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcsstr/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_wcsstr_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_wcsstr_test1 coreclrpal)
+
+target_link_libraries(paltest_wcsstr_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/wcsstr/test1/test1.c b/src/pal/tests/palsuite/c_runtime/wcsstr/test1/test1.c
new file mode 100644
index 0000000000..8296a74983
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcsstr/test1/test1.c
@@ -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:
+** Tests that wcsstr correctly find substrings in wide stings, including
+** returning NULL when the substring can't be found.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char *argv[])
+{
+ WCHAR *string;
+ WCHAR *key1;
+ WCHAR *key2;
+ WCHAR key3[] = { 0 };
+ WCHAR *result;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ string = convert("foo bar baz bar");
+ key1 = convert("bar");
+ key2 = convert("Bar");
+
+ result = wcsstr(string, key1);
+ if (result != string + 4)
+ {
+ Fail("ERROR: Got incorrect result in scanning \"%s\" for \"%s\".\n"
+ "Expected to get pointer to %#p, got %#p\n", convertC(string),
+ convertC(key1), string + 4, result);
+ }
+
+
+ result = wcsstr(string, key2);
+ if (result != NULL)
+ {
+ Fail("ERROR: Got incorrect result in scanning \"%s\" for \"%s\".\n"
+ "Expected to get pointer to %#p, got %#p\n", convertC(string),
+ convertC(key2), NULL, result);
+ }
+
+ result = wcsstr(string, key3);
+ if (result != string)
+ {
+ Fail("ERROR: Got incorrect result in scanning \"%s\" for \"%s\".\n"
+ "Expected to get pointer to %#p, got %#p\n", convertC(string),
+ convertC(key3), string, result);
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/wcsstr/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/wcsstr/test1/testinfo.dat
new file mode 100644
index 0000000000..e42fd8c9eb
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcsstr/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 = wcsstr
+Name = Positive Test for wcsstr
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Tests that wcsstr correctly find substrings in wide stings, including
+= returning NULL when the substring can't be found.
diff --git a/src/pal/tests/palsuite/c_runtime/wcstod/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcstod/CMakeLists.txt
new file mode 100644
index 0000000000..ef14ea5352
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcstod/CMakeLists.txt
@@ -0,0 +1,5 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+add_subdirectory(test2)
+
diff --git a/src/pal/tests/palsuite/c_runtime/wcstod/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcstod/test1/CMakeLists.txt
new file mode 100644
index 0000000000..cf585d051a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcstod/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_wcstod_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_wcstod_test1 coreclrpal)
+
+target_link_libraries(paltest_wcstod_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/wcstod/test1/test1.c b/src/pal/tests/palsuite/c_runtime/wcstod/test1/test1.c
new file mode 100644
index 0000000000..e41e92e961
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcstod/test1/test1.c
@@ -0,0 +1,79 @@
+// Licensed to the .NET Foundation under one or more 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 wcstod with a number of sample strings.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+struct testCase
+{
+ double CorrectResult;
+ char string[20];
+ int stopChar;
+};
+
+struct testCase testCases[] =
+{
+ {1234,"1234", 4},
+ {-1234,"-1234", 5},
+ {1234.44,"1234.44", 7},
+ {1234e-5,"1234e-5", 7},
+ {1234e+5,"1234e+5", 7},
+ {1234E5,"1234E5", 6},
+ {1234.657e-8, "1234.657e-8", 11},
+ {0, "1e-800", 6},
+ {0, "-1e-800", 7},
+ {1234567e-8, " 1234567e-8 foo", 13},
+ {0, " foo 32 bar", 0},
+};
+
+int __cdecl main(int argc, char **argv)
+{
+ WCHAR *wideStr;
+ WCHAR *endptr;
+ double result;
+ int i;
+
+ if (PAL_Initialize(argc,argv))
+ {
+ return FAIL;
+ }
+
+ for(i = 0; i < sizeof(testCases) / sizeof(struct testCase); i++)
+ {
+ wideStr = convert(testCases[i].string);
+ result = wcstod(wideStr, &endptr);
+
+ if (testCases[i].CorrectResult != result)
+ {
+ free(wideStr);
+ Fail("ERROR: wcstod misinterpreted \"%s\" as %g instead of "
+ "%g.\n",
+ testCases[i].string,
+ result,
+ testCases[i].CorrectResult);
+ }
+
+ if (endptr != wideStr + testCases[i].stopChar)
+ {
+ free(wideStr);
+ Fail("ERROR: wcstod stopped scanning \"%s\" at %p, "
+ "instead of %p!\n", testCases[i].string, endptr,
+ wideStr + testCases[i].stopChar);
+ }
+
+ free(wideStr);
+ }
+
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/wcstod/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/wcstod/test1/testinfo.dat
new file mode 100644
index 0000000000..19da0b5a42
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcstod/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 = wcstod
+Name = Positive Test for wcstod
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Tests wcstod with a number of sample strings.
+
diff --git a/src/pal/tests/palsuite/c_runtime/wcstod/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcstod/test2/CMakeLists.txt
new file mode 100644
index 0000000000..43d5bf8a40
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcstod/test2/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test2.c
+)
+
+add_executable(paltest_wcstod_test2
+ ${SOURCES}
+)
+
+add_dependencies(paltest_wcstod_test2 coreclrpal)
+
+target_link_libraries(paltest_wcstod_test2
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/wcstod/test2/test2.c b/src/pal/tests/palsuite/c_runtime/wcstod/test2/test2.c
new file mode 100644
index 0000000000..8f9b5cbf58
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcstod/test2/test2.c
@@ -0,0 +1,59 @@
+// Licensed to the .NET Foundation under one or more 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 wcstod with overflows
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char **argv)
+{
+ /* Representation of positive infinty for a IEEE 64-bit double */
+ INT64 PosInifity = (INT64)(0x7ff00000) << 32;
+ double HugeVal = *(double*) &PosInifity;
+ char *PosStr = "1E+10000";
+ char *NegStr = "-1E+10000";
+ WCHAR *wideStr;
+ double result;
+
+
+ if (PAL_Initialize(argc,argv))
+ {
+ return FAIL;
+ }
+
+ wideStr = convert(PosStr);
+ result = wcstod(wideStr, NULL);
+ free(wideStr);
+
+ if (result != HugeVal)
+ {
+ Fail("ERROR: wcstod interpreted \"%s\" as %g instead of %g\n",
+ PosStr, result, HugeVal);
+ }
+
+
+
+ wideStr = convert(NegStr);
+ result = wcstod(wideStr, NULL);
+ free(wideStr);
+
+ if (result != -HugeVal)
+ {
+ Fail("ERROR: wcstod interpreted \"%s\" as %g instead of %g\n",
+ NegStr, result, -HugeVal);
+ }
+
+
+ PAL_Terminate();
+
+ return PASS;
+}
+
diff --git a/src/pal/tests/palsuite/c_runtime/wcstod/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/wcstod/test2/testinfo.dat
new file mode 100644
index 0000000000..bf41e97075
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcstod/test2/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 = wcstod
+Name = Positive Test for wcstod
+TYPE = DEFAULT
+EXE1 = test2
+Description
+= Tests wcstod with overflows
+
diff --git a/src/pal/tests/palsuite/c_runtime/wcstok/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcstok/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcstok/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/wcstok/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcstok/test1/CMakeLists.txt
new file mode 100644
index 0000000000..863f5d8c29
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcstok/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_wcstok_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_wcstok_test1 coreclrpal)
+
+target_link_libraries(paltest_wcstok_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/wcstok/test1/test1.c b/src/pal/tests/palsuite/c_runtime/wcstok/test1/test1.c
new file mode 100644
index 0000000000..76d7dc02b3
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcstok/test1/test1.c
@@ -0,0 +1,114 @@
+// Licensed to the .NET Foundation under one or more 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:
+** Search for a number of tokens within strings. Check that the return values
+** are what is expected, and also that the strings match up with our expected
+** results.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char *argv[])
+{
+ /* foo bar baz */
+ WCHAR str[] = {'f','o','o',' ','b','a','r',' ','b','a','z','\0'};
+
+ /* foo \0ar baz */
+ WCHAR result1[] = {'f','o','o',' ','\0','a','r',' ','b','a','z','\0'};
+
+ /* foo \0a\0 baz */
+ WCHAR result2[] = {'f','o','o',' ','\0','a','\0',' ','b','a','z','\0'};
+
+ WCHAR* tempString;
+ int len = 0;
+ WCHAR *ptr;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ len = (wcslen(str)*sizeof(WCHAR)) + 2;
+
+ /* Tokenize 'str'. It will hit the 'b' delimiter first. Check to see
+ that the ptr is pointing to the start of the string and do a compare
+ to ensure the tokenized string is what we expected.
+ */
+
+ tempString = convert("bz");
+ ptr = wcstok(str, tempString);
+ free(tempString);
+
+ if (ptr != str)
+ {
+ Fail("ERROR: Expected wcstok() to return %p, got %p!\n", str, ptr);
+ }
+
+ if (memcmp(str, result1, len) != 0)
+ {
+ Fail("ERROR: wcstok altered the string in an unexpected fashion.");
+ }
+
+ /* If NULL is passed as the first parameter, wcstok will continue
+ tokenizing the same string. Test that this works properly.
+ */
+ tempString = convert("r ");
+ ptr = wcstok(NULL, tempString);
+ free(tempString);
+
+ if (ptr != str + 5)
+ {
+ Fail("ERROR: Expected wcstok() to return %p, got %p!\n", str+5, ptr);
+ }
+
+ if (memcmp(str, result2, len) != 0)
+ {
+ Fail("ERROR: wcstok altered the string in an unexpected fashion.");
+ }
+
+ /* Continue onward, and search for 'X' now, which won't be found. The
+ pointer should point just after the last NULL in the string. And
+ the string itself shouldn't have changed.
+ */
+ tempString = convert("X");
+ ptr = wcstok(NULL, tempString);
+ free(tempString);
+
+ if (ptr != str + 7)
+ {
+ Fail("ERROR: Expected wcstok() to return %p, got %p!\n", str + 7, ptr);
+ }
+
+ if (memcmp(str, result2, len) != 0)
+ {
+ Fail("ERROR: wcstok altered the string in an unexpeced fashion.\n");
+ }
+
+ /* Call wcstok again. Now the ptr should point to the end of the
+ string at NULL. And the string itself shouldn't have changed.
+ */
+ tempString = convert("X");
+ ptr = wcstok(NULL, tempString);
+ free(tempString);
+
+ if (ptr != NULL)
+ {
+ Fail("ERROR: Expected wcstok() to return %p, got %p!\n", NULL, ptr);
+ }
+
+ if (memcmp(str, result2, len) != 0)
+ {
+ Fail("ERROR: wcstok altered the string in an unexpeced fashion.\n");
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/wcstok/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/wcstok/test1/testinfo.dat
new file mode 100644
index 0000000000..cc00844c6a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcstok/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 = wcstok
+Name = wcstok test- tokenize a string and ensure the string takes correct form.
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Search for a number of tokens within strings. Check that the return values
+= are what is expect, and also that the strings match up with our expected
+= results.
diff --git a/src/pal/tests/palsuite/c_runtime/wcstol/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcstol/CMakeLists.txt
new file mode 100644
index 0000000000..7c20179353
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcstol/CMakeLists.txt
@@ -0,0 +1,9 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+add_subdirectory(test2)
+add_subdirectory(test3)
+add_subdirectory(test4)
+add_subdirectory(test5)
+add_subdirectory(test6)
+
diff --git a/src/pal/tests/palsuite/c_runtime/wcstol/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcstol/test1/CMakeLists.txt
new file mode 100644
index 0000000000..25e96e7de0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcstol/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_wcstol_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_wcstol_test1 coreclrpal)
+
+target_link_libraries(paltest_wcstol_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/wcstol/test1/test1.c b/src/pal/tests/palsuite/c_runtime/wcstol/test1/test1.c
new file mode 100644
index 0000000000..d84ba66adc
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcstol/test1/test1.c
@@ -0,0 +1,53 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*============================================================================
+**
+** Source: test1.c
+**
+** Purpose: Test #1 for the wcstol function. Does a simple test with radix 4.
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+
+
+/*
+ * Notes: wcstol should depend on the current locale's LC_NUMERIC category,
+ * this is not currently tested.
+ */
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ WCHAR *end;
+ WCHAR teststr[] = {'1','2','3','4','5',0};
+ LONG result = 27;
+ LONG l;
+
+ if ( 0 != PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ l = wcstol(teststr, &end, 4);
+
+ if (l != result)
+ {
+ Fail("ERROR: Expected wcstol to return %d, got %d\n", result, l);
+ }
+
+ if (end != teststr + 3)
+ {
+ Fail("ERROR: Expected wcstol to give an end value of %p, got %p\n",
+ teststr + 3, end);
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/wcstol/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/wcstol/test1/testinfo.dat
new file mode 100644
index 0000000000..48108f22bf
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcstol/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 = wcstol
+Name = Positive Test for wcstol
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Tests wcstol with base 4 and a string that includes some invalid characters.
diff --git a/src/pal/tests/palsuite/c_runtime/wcstol/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcstol/test2/CMakeLists.txt
new file mode 100644
index 0000000000..ea33ec8c7e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcstol/test2/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test2.c
+)
+
+add_executable(paltest_wcstol_test2
+ ${SOURCES}
+)
+
+add_dependencies(paltest_wcstol_test2 coreclrpal)
+
+target_link_libraries(paltest_wcstol_test2
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/wcstol/test2/test2.c b/src/pal/tests/palsuite/c_runtime/wcstol/test2/test2.c
new file mode 100644
index 0000000000..58309be6b4
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcstol/test2/test2.c
@@ -0,0 +1,53 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*============================================================================
+**
+** Source: test2.c
+**
+** Purpose: Test #2 for the wcstol function. Does a simple test with radix
+** 10.
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+
+
+/*
+ * Notes: wcstol should depend on the current locale's LC_NUMERIC category,
+ * this is not currently tested.
+ */
+
+int __cdecl main(int argc, char *argv[])
+{
+ WCHAR *end;
+ WCHAR teststr[] = {'1','2','3','4','5',0};
+ LONG result = 12345;
+ LONG l;
+
+ if (0 != PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ l = wcstol(teststr, &end, 10);
+
+ if (l != result)
+ {
+ Fail("ERROR: Expected wcstol to return %d, got %d\n", result, l);
+ }
+
+ if (end != teststr + 5)
+ {
+ Fail("ERROR: Expected wcstol to give an end value of %p, got %p\n",
+ teststr + 5, end);
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/wcstol/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/wcstol/test2/testinfo.dat
new file mode 100644
index 0000000000..8dd1460010
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcstol/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 = wcstol
+Name = Positive Test for wcstol
+TYPE = DEFAULT
+EXE1 = test2
+Description
+= Tests wcstol with base 10 and a completely valid string.
diff --git a/src/pal/tests/palsuite/c_runtime/wcstol/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcstol/test3/CMakeLists.txt
new file mode 100644
index 0000000000..509feca08c
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcstol/test3/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test3.c
+)
+
+add_executable(paltest_wcstol_test3
+ ${SOURCES}
+)
+
+add_dependencies(paltest_wcstol_test3 coreclrpal)
+
+target_link_libraries(paltest_wcstol_test3
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/wcstol/test3/test3.c b/src/pal/tests/palsuite/c_runtime/wcstol/test3/test3.c
new file mode 100644
index 0000000000..8b5ce6943d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcstol/test3/test3.c
@@ -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: test3.c
+**
+** Purpose: Test #3 for the wcstol function. Tests an invalid string
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+
+
+/*
+ * Notes: wcstol should depend on the current locale's LC_NUMERIC category,
+ * this is not currently tested.
+ */
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ WCHAR str[] = {'Z',0};
+ WCHAR *end;
+ LONG l;
+
+ if (0 != PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ l = wcstol(str, &end, 10);
+
+ if (l != 0)
+ {
+ Fail("ERROR: Expected wcstol to return %d, got %d\n", 0, l);
+ }
+
+ if (end != str)
+ {
+ Fail("ERROR: Expected wcstol to give an end value of %p, got %p\n",
+ str + 3, end);
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/wcstol/test3/testinfo.dat b/src/pal/tests/palsuite/c_runtime/wcstol/test3/testinfo.dat
new file mode 100644
index 0000000000..0e851d8657
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcstol/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 = wcstol
+Name = Positive Test for wcstol
+TYPE = DEFAULT
+EXE1 = test3
+Description
+= Tests wcstol with a completely invalid string (base 10).
diff --git a/src/pal/tests/palsuite/c_runtime/wcstol/test4/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcstol/test4/CMakeLists.txt
new file mode 100644
index 0000000000..043c562102
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcstol/test4/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test4.c
+)
+
+add_executable(paltest_wcstol_test4
+ ${SOURCES}
+)
+
+add_dependencies(paltest_wcstol_test4 coreclrpal)
+
+target_link_libraries(paltest_wcstol_test4
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/wcstol/test4/test4.c b/src/pal/tests/palsuite/c_runtime/wcstol/test4/test4.c
new file mode 100644
index 0000000000..a5e65946e9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcstol/test4/test4.c
@@ -0,0 +1,77 @@
+// Licensed to the .NET Foundation under one or more 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 wcstol function. Tests the limits of the
+** conversions.
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+
+
+/*
+ * Notes: wcstol should depend on the current locale's LC_NUMERIC category,
+ * this is not currently tested.
+ */
+
+int __cdecl main(int argc, char *argv[])
+{
+ WCHAR maxstr[] = {'2','1','4','7','4','8','3','6','4','7',0};
+ LONG max = 2147483647;
+ WCHAR minstr[] = {'-','2','1','4','7','4','8','3','6','4','8',0};
+ LONG min = 0x80000000; /* putting -2147483648 gives a warning */
+ WCHAR *end;
+ LONG l;
+
+ if ( 0 != PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ errno = 0;
+
+ l = wcstol(maxstr, &end, 10);
+
+ if (l != max)
+ {
+ Fail("ERROR: Expected wcstol to return %d, got %d\n", max, l);
+ }
+ if (end != maxstr + 10)
+ {
+ Fail("ERROR: Expected wcstol to give an end value of %p, got %p\n",
+ maxstr + 10, end);
+ }
+ if (errno != 0)
+ {
+ Fail("ERROR: wcstol set errno to non-zero (%d)\n", errno);
+ }
+
+
+ l = wcstol(minstr, &end, 10);
+
+ if (l != min)
+ {
+ Fail("ERROR: Expected wcstol to return %d, got %d\n", min, l);
+ }
+ if (end != minstr + 11)
+ {
+ Fail("ERROR: Expected wcstol to give an end value of %p, got %p\n",
+ minstr + 11, end);
+ }
+ if (errno != 0)
+ {
+ Fail("ERROR: wcstol set errno to non-zero (%d)\n", errno);
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/wcstol/test4/testinfo.dat b/src/pal/tests/palsuite/c_runtime/wcstol/test4/testinfo.dat
new file mode 100644
index 0000000000..d2c5652e6e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcstol/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 = wcstol
+Name = Positive Test for wcstol
+TYPE = DEFAULT
+EXE1 = test4
+Description
+= Tests wcstol with base 10 and the highest and lowest possible values.
diff --git a/src/pal/tests/palsuite/c_runtime/wcstol/test5/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcstol/test5/CMakeLists.txt
new file mode 100644
index 0000000000..c887369880
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcstol/test5/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test5.c
+)
+
+add_executable(paltest_wcstol_test5
+ ${SOURCES}
+)
+
+add_dependencies(paltest_wcstol_test5 coreclrpal)
+
+target_link_libraries(paltest_wcstol_test5
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/wcstol/test5/test5.c b/src/pal/tests/palsuite/c_runtime/wcstol/test5/test5.c
new file mode 100644
index 0000000000..62f0a895a6
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcstol/test5/test5.c
@@ -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: test5.c
+**
+** Purpose: Test #5 for the wcstol function. Tests over and under flowing.
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+
+
+/*
+ * Notes: wcstol should depend on the current locale's LC_NUMERIC category,
+ * this is not currently tested.
+ */
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ WCHAR overstr[] = {'2','1','4','7','4','8','3','6','4','8',0};
+ WCHAR understr[] = {'-','2','1','4','7','4','8','3','6','4','9',0};
+ WCHAR *end;
+ LONG l;
+
+ if (0 != PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ errno = 0;
+
+ l = wcstol(overstr, &end, 10);
+
+ if (l != LONG_MAX)
+ {
+ Fail("ERROR: Expected wcstol to return %u, got %u\n", LONG_MAX, l);
+ }
+ if (end != overstr + 10)
+ {
+ Fail("ERROR: Expected wcstol to give an end value of %p, got %p\n",
+ overstr + 10, end);
+ }
+ if (errno != ERANGE)
+ {
+ Fail("ERROR: wcstol did not set errno to ERANGE (%d)\n", errno);
+ }
+
+
+ errno = 0;
+ l = wcstol(understr, &end, 10);
+
+ if (l != LONG_MIN)
+ {
+ Fail("ERROR: Expected wcstol to return %u, got %u\n", LONG_MIN, l);
+ }
+ if (end != understr + 11)
+ {
+ Fail("ERROR: Expected wcstol to give an end value of %p, got %p\n",
+ understr + 11, end);
+ }
+ if (errno != ERANGE)
+ {
+ Fail("ERROR: wcstol did not set errno to ERANGE (%d)\n", errno);
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/wcstol/test5/testinfo.dat b/src/pal/tests/palsuite/c_runtime/wcstol/test5/testinfo.dat
new file mode 100644
index 0000000000..18b4478e3a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcstol/test5/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 = wcstol
+Name = Positive Test for wcstol
+TYPE = DEFAULT
+EXE1 = test5
+Description
+= Tests wcstol (base 10) with underflowing and overflowing.
+= Chesks that errno gets set to ERANGE.
diff --git a/src/pal/tests/palsuite/c_runtime/wcstol/test6/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcstol/test6/CMakeLists.txt
new file mode 100644
index 0000000000..d328161f39
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcstol/test6/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test6.c
+)
+
+add_executable(paltest_wcstol_test6
+ ${SOURCES}
+)
+
+add_dependencies(paltest_wcstol_test6 coreclrpal)
+
+target_link_libraries(paltest_wcstol_test6
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/wcstol/test6/test6.c b/src/pal/tests/palsuite/c_runtime/wcstol/test6/test6.c
new file mode 100644
index 0000000000..14f6208231
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcstol/test6/test6.c
@@ -0,0 +1,86 @@
+// Licensed to the .NET Foundation under one or more 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 wcstol function. Tests strings with octal/hex
+** number specifers
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+
+
+/*
+ * Notes: wcstol should depend on the current locale's LC_NUMERIC category,
+ * this is not currently tested.
+ */
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ WCHAR test1[] = {'0','x','1','2', 0};
+ WCHAR test2[] = {'0','1','2',0};
+ WCHAR *end;
+ LONG l;
+
+ if (0 != PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ l = wcstol(test1, &end, 16);
+ if (l != 0x12)
+ {
+ Fail("ERROR: Expected wcstol to return %d, got %d\n", 0x12, l);
+ }
+ if (end != test1 + 4)
+ {
+ Fail("ERROR: Expected wcstol to give an end value of %p, got %p\n",
+ test1 + 4, end);
+ }
+
+ l = wcstol(test1, &end, 10);
+ if (l != 0)
+ {
+ Fail("ERROR: Expected wcstol to return %d, got %d\n", 0, l);
+ }
+ if (end != test1+1)
+ {
+ Fail("ERROR: Expected wcstol to give an end value of %p, got %p\n",
+ test1+1, end);
+ }
+
+ l = wcstol(test2, &end, 8);
+ if (l != 10)
+ {
+ Fail("ERROR: Expected wcstol to return %d, got %d\n", 10, l);
+ }
+ if (end != test2 + 3)
+ {
+ Fail("ERROR: Expected wcstol to give an end value of %p, got %p\n",
+ test2 + 3, end);
+ }
+
+ l = wcstol(test2, &end, 10);
+ if (l != 12)
+ {
+ Fail("ERROR: Expected wcstol to return %d, got %d\n", 12, l);
+ }
+
+ if (end != test2 + 3)
+ {
+ Fail("ERROR: Expected wcstol to give an end value of %p, got %p\n",
+ test2 + 3, end);
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/wcstol/test6/testinfo.dat b/src/pal/tests/palsuite/c_runtime/wcstol/test6/testinfo.dat
new file mode 100644
index 0000000000..0e10761e4d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcstol/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 = wcstol
+Name = Positive Test for wcstol
+TYPE = DEFAULT
+EXE1 = test6
+Description
+= Tests wcstol with hex and octal strings, with different bases.
diff --git a/src/pal/tests/palsuite/c_runtime/wcstoul/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcstoul/CMakeLists.txt
new file mode 100644
index 0000000000..7c20179353
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcstoul/CMakeLists.txt
@@ -0,0 +1,9 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+add_subdirectory(test2)
+add_subdirectory(test3)
+add_subdirectory(test4)
+add_subdirectory(test5)
+add_subdirectory(test6)
+
diff --git a/src/pal/tests/palsuite/c_runtime/wcstoul/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcstoul/test1/CMakeLists.txt
new file mode 100644
index 0000000000..b24523e93b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcstoul/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_wcstoul_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_wcstoul_test1 coreclrpal)
+
+target_link_libraries(paltest_wcstoul_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/wcstoul/test1/test1.c b/src/pal/tests/palsuite/c_runtime/wcstoul/test1/test1.c
new file mode 100644
index 0000000000..5274905e30
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcstoul/test1/test1.c
@@ -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: test1.c
+**
+** Purpose: Test #1 for the wcstoul function
+**
+**
+**==========================================================================*/
+#include <palsuite.h>
+
+/*
+ * Notes: wcstoul should depend on the current locale's LC_NUMERIC category,
+ * this is not currently tested.
+ */
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ WCHAR teststr[] = {'1','2','3','4','5',0};
+ WCHAR *end;
+ ULONG result = 27;
+ ULONG l;
+
+ if (0 != PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ l = wcstoul(teststr, &end, 4);
+
+ if (l != result)
+ {
+ Fail("ERROR: Expected wcstoul to return %u, got %u\n", result, l);
+ }
+
+ if (end != teststr + 3)
+ {
+ Fail("ERROR: Expected wcstoul to give an end value of %p, got %p\n",
+ teststr + 3, end);
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/wcstoul/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/wcstoul/test1/testinfo.dat
new file mode 100644
index 0000000000..af4fb7e55d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcstoul/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 = wcstoul
+Name = Positive Test for wcstoul
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Tests wcstoul with base 4 and a string that includes some invalid characters.
diff --git a/src/pal/tests/palsuite/c_runtime/wcstoul/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcstoul/test2/CMakeLists.txt
new file mode 100644
index 0000000000..e262078e34
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcstoul/test2/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test2.c
+)
+
+add_executable(paltest_wcstoul_test2
+ ${SOURCES}
+)
+
+add_dependencies(paltest_wcstoul_test2 coreclrpal)
+
+target_link_libraries(paltest_wcstoul_test2
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/wcstoul/test2/test2.c b/src/pal/tests/palsuite/c_runtime/wcstoul/test2/test2.c
new file mode 100644
index 0000000000..2ab2dbf5d1
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcstoul/test2/test2.c
@@ -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: test2.c
+**
+** Purpose: Test #2 for the wcstoul function
+**
+**
+**==========================================================================*/
+#include <palsuite.h>
+
+/*
+ * Notes: wcstoul should depend on the current locale's LC_NUMERIC category,
+ * this is not currently tested.
+ */
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ WCHAR teststr[] = {'1','2','3','4','5',0};
+ WCHAR *end;
+ ULONG result = 12345;
+ ULONG l;
+
+ if (0 != PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ l = wcstoul((wchar_t*)teststr, &end, 10);
+
+ if (l != result)
+ {
+ Fail("ERROR: Expected wcstoul to return %u, got %u\n", result, l);
+ }
+
+ if (end != teststr + 5)
+ {
+ Fail("ERROR: Expected wcstoul to give an end value of %p, got %p\n",
+ teststr + 5, end);
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/wcstoul/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/wcstoul/test2/testinfo.dat
new file mode 100644
index 0000000000..b7e301f423
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcstoul/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 = wcstoul
+Name = Positive Test for wcstoul
+TYPE = DEFAULT
+EXE1 = test2
+Description
+= Tests wcstoul with base 10 and a completely valid string.
diff --git a/src/pal/tests/palsuite/c_runtime/wcstoul/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcstoul/test3/CMakeLists.txt
new file mode 100644
index 0000000000..aae268ac59
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcstoul/test3/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test3.c
+)
+
+add_executable(paltest_wcstoul_test3
+ ${SOURCES}
+)
+
+add_dependencies(paltest_wcstoul_test3 coreclrpal)
+
+target_link_libraries(paltest_wcstoul_test3
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/wcstoul/test3/test3.c b/src/pal/tests/palsuite/c_runtime/wcstoul/test3/test3.c
new file mode 100644
index 0000000000..eac46615e2
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcstoul/test3/test3.c
@@ -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: test3.c
+**
+** Purpose: Test #3 for the wcstoul function
+**
+**
+**==========================================================================*/
+#include <palsuite.h>
+
+/*
+ * Notes: wcstoul should depend on the current locale's LC_NUMERIC category,
+ * this is not currently tested.
+ */
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ WCHAR str[] = {'Z',0};
+ WCHAR *end;
+ ULONG l;
+
+ if (0 != PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ l = wcstoul(str, &end, 10);
+
+ if (l != 0)
+ {
+ Fail("ERROR: Expected wcstoul to return %u, got %u\n", 0, l);
+ }
+
+ if (end != str)
+ {
+ Fail("ERROR: Expected wcstoul to give an end value of %p, got %p\n",
+ str, end);
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
+
diff --git a/src/pal/tests/palsuite/c_runtime/wcstoul/test3/testinfo.dat b/src/pal/tests/palsuite/c_runtime/wcstoul/test3/testinfo.dat
new file mode 100644
index 0000000000..f7f6302d79
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcstoul/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 = wcstoul
+Name = Positive Test for wcstoul
+TYPE = DEFAULT
+EXE1 = test3
+Description
+= Tests wcstoul with a completely invalid string (base 10).
diff --git a/src/pal/tests/palsuite/c_runtime/wcstoul/test4/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcstoul/test4/CMakeLists.txt
new file mode 100644
index 0000000000..bd8073023f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcstoul/test4/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test4.c
+)
+
+add_executable(paltest_wcstoul_test4
+ ${SOURCES}
+)
+
+add_dependencies(paltest_wcstoul_test4 coreclrpal)
+
+target_link_libraries(paltest_wcstoul_test4
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/wcstoul/test4/test4.c b/src/pal/tests/palsuite/c_runtime/wcstoul/test4/test4.c
new file mode 100644
index 0000000000..0261da4275
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcstoul/test4/test4.c
@@ -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: test4.c
+**
+** Purpose: Test #4 for the wcstoul function
+**
+**
+**==========================================================================*/
+#include <palsuite.h>
+
+/*
+ * Notes: wcstoul should depend on the current locale's LC_NUMERIC category,
+ * this is not currently tested.
+ */
+
+int __cdecl main(int argc, char *argv[])
+{
+ WCHAR maxstr[] = {'4','2','9','4','9','6','7','2','9','5',0};
+ ULONG max = 4294967295ul;
+ WCHAR *end;
+ ULONG l;
+
+ if (0 != PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ errno = 0;
+
+ l = wcstoul(maxstr, &end, 10);
+ if (l != max)
+ {
+ Fail("ERROR: Expected wcstoul to return %u, got %u\n", max, l);
+ }
+ if (end != maxstr + 10)
+ {
+ Fail("ERROR: Expected wcstoul to give an end value of %p, got %p\n",
+ maxstr + 10, end);
+ }
+ if (errno != 0)
+ {
+ Fail("ERROR: wcstoul set errno to non-zero (%d)\n", errno);
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/wcstoul/test4/testinfo.dat b/src/pal/tests/palsuite/c_runtime/wcstoul/test4/testinfo.dat
new file mode 100644
index 0000000000..301178be3a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcstoul/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 = wcstoul
+Name = Positive Test for wcstoul
+TYPE = DEFAULT
+EXE1 = test4
+Description
+= Tests wcstoul with base 10 and the highest possible value.
diff --git a/src/pal/tests/palsuite/c_runtime/wcstoul/test5/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcstoul/test5/CMakeLists.txt
new file mode 100644
index 0000000000..1451e6ad57
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcstoul/test5/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test5.c
+)
+
+add_executable(paltest_wcstoul_test5
+ ${SOURCES}
+)
+
+add_dependencies(paltest_wcstoul_test5 coreclrpal)
+
+target_link_libraries(paltest_wcstoul_test5
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/wcstoul/test5/test5.c b/src/pal/tests/palsuite/c_runtime/wcstoul/test5/test5.c
new file mode 100644
index 0000000000..00287cf7f4
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcstoul/test5/test5.c
@@ -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: test5.c
+**
+** Purpose: Test #5 for the wcstoul function
+**
+**
+**==========================================================================*/
+#include <palsuite.h>
+
+/*
+ * Notes: wcstoul should depend on the current locale's LC_NUMERIC category,
+ * this is not currently tested.
+ */
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ WCHAR overstr[] = {'4','2','9','4','9','6','7','2','9','6',0};
+ WCHAR understr[] = {'-','1',0};
+ WCHAR *end;
+ ULONG l;
+
+ if (0 != PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ errno = 0;
+ l = wcstoul(overstr, &end, 10);
+
+ if (l != ULONG_MAX)
+ {
+ Fail("ERROR: Expected wcstoul to return %u, got %u\n", ULONG_MAX, l);
+ }
+ if (end != overstr + 10)
+ {
+ Fail("ERROR: Expected wcstoul to give an end value of %p, got %p\n",
+ overstr + 10, end);
+ }
+ if (errno != ERANGE)
+ {
+ Fail("ERROR: wcstoul did not set errno to ERANGE (%d)\n", errno);
+ }
+
+ errno = 0;
+ l = wcstoul(understr, &end, 10);
+
+ if (l != ULONG_MAX)
+ {
+ Fail("ERROR: Expected wcstoul to return %u, got %u\n", ULONG_MAX, l);
+ }
+ if (end != understr + 2)
+ {
+ Fail("ERROR: Expected wcstoul to give an end value of %p, got %p\n",
+ understr + 2, end);
+ }
+ if (errno != 0)
+ {
+ Fail("ERROR: wcstoul set errno to non-zero (%d)\n", errno);
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/wcstoul/test5/testinfo.dat b/src/pal/tests/palsuite/c_runtime/wcstoul/test5/testinfo.dat
new file mode 100644
index 0000000000..bf7b2b6fe0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcstoul/test5/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 = wcstoul
+Name = Positive Test for wcstoul
+TYPE = DEFAULT
+EXE1 = test5
+Description
+= Tests wcstoul (base 10) with underflowing and overflowing.
+= Chesks that errno gets set to ERANGE.
diff --git a/src/pal/tests/palsuite/c_runtime/wcstoul/test6/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcstoul/test6/CMakeLists.txt
new file mode 100644
index 0000000000..15518bdcf8
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcstoul/test6/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test6.c
+)
+
+add_executable(paltest_wcstoul_test6
+ ${SOURCES}
+)
+
+add_dependencies(paltest_wcstoul_test6 coreclrpal)
+
+target_link_libraries(paltest_wcstoul_test6
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/wcstoul/test6/test6.c b/src/pal/tests/palsuite/c_runtime/wcstoul/test6/test6.c
new file mode 100644
index 0000000000..28397ec73f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcstoul/test6/test6.c
@@ -0,0 +1,83 @@
+// Licensed to the .NET Foundation under one or more 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 wcstoul function. Tests strings with octal/hex
+** number specifers
+**
+**
+**==========================================================================*/
+#include <palsuite.h>
+
+
+/*
+ * Notes: wcstoul should depend on the current locale's LC_NUMERIC category,
+ * this is not currently tested.
+ */
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ WCHAR test1[] = {'0','x','1','2', 0};
+ WCHAR test2[] = {'0','1','2',0};
+ WCHAR *end;
+ ULONG l;
+
+ if (0 != PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ l = wcstoul(test1, &end, 16);
+ if (l != 0x12)
+ {
+ Fail("ERROR: Expected wcstoul to return %u, got %u\n", 0x12, l);
+ }
+ if (end != test1 + 4)
+ {
+ Fail("ERROR: Expected wcstoul to give an end value of %p, got %p\n",
+ test1 + 4, end);
+ }
+
+ l = wcstoul(test1, &end, 10);
+ if (l != 0)
+ {
+ Fail("ERROR: Expected wcstoul to return %u, got %u\n", 0, l);
+ }
+ if (end != test1+1)
+ {
+ Fail("ERROR: Expected wcstoul to give an end value of %p, got %p\n",
+ test1+1, end);
+ }
+
+ l = wcstoul(test2, &end, 8);
+ if (l != 10)
+ {
+ Fail("ERROR: Expected wcstoul to return %u, got %u\n", 10, l);
+ }
+ if (end != test2 + 3)
+ {
+ Fail("ERROR: Expected wcstoul to give an end value of %p, got %p\n",
+ test2 + 3, end);
+ }
+
+ l = wcstoul(test2, &end, 10);
+ if (l != 12)
+ {
+ Fail("ERROR: Expected wcstoul to return %u, got %u\n", 12, l);
+ }
+
+ if (end != test2 + 3)
+ {
+ Fail("ERROR: Expected wcstoul to give an end value of %p, got %p\n",
+ test2 + 3, end);
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/wcstoul/test6/testinfo.dat b/src/pal/tests/palsuite/c_runtime/wcstoul/test6/testinfo.dat
new file mode 100644
index 0000000000..40e18d540d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcstoul/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 = wcstoul
+Name = Positive Test for wcstoul
+TYPE = DEFAULT
+EXE1 = test6
+Description
+= Tests wcstoul with hex and octal strings, with different bases.
diff --git a/src/pal/tests/palsuite/c_runtime/wprintf/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wprintf/CMakeLists.txt
new file mode 100644
index 0000000000..ef14ea5352
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wprintf/CMakeLists.txt
@@ -0,0 +1,5 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+add_subdirectory(test2)
+
diff --git a/src/pal/tests/palsuite/c_runtime/wprintf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wprintf/test1/CMakeLists.txt
new file mode 100644
index 0000000000..701bbe4160
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wprintf/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_wprintf_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_wprintf_test1 coreclrpal)
+
+target_link_libraries(paltest_wprintf_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/wprintf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/wprintf/test1/test1.c
new file mode 100644
index 0000000000..d99dc8cf93
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wprintf/test1/test1.c
@@ -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: Test #1 for the wprintf function. A single, basic, test
+** case with no formatting.
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../wprintf.h"
+
+int __cdecl main(int argc, char *argv[])
+{
+ char checkstr[] = "hello world";
+ WCHAR *wcheckstr;
+ int ret;
+
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ wcheckstr = convert(checkstr);
+
+ ret = wprintf(wcheckstr);
+
+ if (ret != wcslen(wcheckstr))
+ {
+ Fail("Expected wprintf to return %d, got %d.\n",
+ wcslen(wcheckstr), ret);
+
+ }
+
+ free(wcheckstr);
+ PAL_Terminate();
+ return PASS;
+}
+
diff --git a/src/pal/tests/palsuite/c_runtime/wprintf/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/wprintf/test1/testinfo.dat
new file mode 100644
index 0000000000..02946361b0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wprintf/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 = wprintf
+Name = Positive Test for wprintf
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= General test to see if wprintf works correctly
diff --git a/src/pal/tests/palsuite/c_runtime/wprintf/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wprintf/test2/CMakeLists.txt
new file mode 100644
index 0000000000..55c3d11913
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wprintf/test2/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test2.c
+)
+
+add_executable(paltest_wprintf_test2
+ ${SOURCES}
+)
+
+add_dependencies(paltest_wprintf_test2 coreclrpal)
+
+target_link_libraries(paltest_wprintf_test2
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/wprintf/test2/test2.c b/src/pal/tests/palsuite/c_runtime/wprintf/test2/test2.c
new file mode 100644
index 0000000000..254e98a394
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wprintf/test2/test2.c
@@ -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: test2.c
+**
+** Purpose: Test #2 for the wprintf function. Tests the string specifier
+** (%s).
+**
+**
+**==========================================================================*/
+
+
+#include <palsuite.h>
+#include "../wprintf.h"
+
+
+
+int __cdecl main(int argc, char *argv[])
+{
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ DoStrTest(u"foo %s", u"bar", u"foo bar");
+ DoStrTest(u"foo %ws", u"bar", u"foo bar");
+ DoStrTest(u"foo %ls", u"bar", u"foo bar");
+ DoStrTest(u"foo %ws", u"bar", u"foo bar");
+ DoStrTest(u"foo %Ls", u"bar", u"foo bar");
+ DoStrTest(u"foo %I64s", u"bar", u"foo bar");
+ DoStrTest(u"foo %5s", u"bar", u"foo bar");
+ DoStrTest(u"foo %.2s", u"bar", u"foo ba");
+ DoStrTest(u"foo %5.2s", u"bar", u"foo ba");
+ DoStrTest(u"foo %-5s", u"bar", u"foo bar ");
+ DoStrTest(u"foo %05s", u"bar", u"foo 00bar");
+
+ PAL_Terminate();
+ return PASS;
+}
+
diff --git a/src/pal/tests/palsuite/c_runtime/wprintf/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/wprintf/test2/testinfo.dat
new file mode 100644
index 0000000000..7808c069dd
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wprintf/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 = wprintf
+Name = Positive Test for wprintf
+TYPE = DEFAULT
+EXE1 = test2
+Description
+= Tests wprintf with strings
diff --git a/src/pal/tests/palsuite/c_runtime/wprintf/wprintf.h b/src/pal/tests/palsuite/c_runtime/wprintf/wprintf.h
new file mode 100644
index 0000000000..7d3caf1b02
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wprintf/wprintf.h
@@ -0,0 +1,171 @@
+// Licensed to the .NET Foundation under one or more 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: wprintf.h
+**
+** Purpose: Containts common testing functions for wprintf
+**
+**
+**==========================================================================*/
+
+#ifndef __wprintf_H__
+#define __wprintf_H__
+
+void DoStrTest(WCHAR *formatstr, WCHAR* param, WCHAR *checkstr)
+{
+ int ret;
+
+ ret = wprintf(formatstr, param);
+ if (ret != wcslen(checkstr))
+ {
+ Fail("DoStrTest:Expected wprintf to return %d, got %d.\n",
+ wcslen(checkstr), ret);
+ }
+}
+
+
+void DoPointerTest(WCHAR *formatstr, void* param, WCHAR* paramstr,
+ WCHAR *checkstr1)
+{
+ int ret;
+
+ ret = wprintf(formatstr, param);
+ if (ret != wcslen(checkstr1))
+ {
+ Fail("DoPointerTest:Expected wprintf to return %d, got %d.\n",
+ wcslen(checkstr1), ret);
+ }
+}
+
+void DoCountTest(WCHAR *formatstr, int param, WCHAR *checkstr)
+{
+ int ret;
+ int n = -1;
+
+ ret = wprintf(formatstr, &n);
+
+ if (n != param)
+ {
+ Fail("DoCountTest:Expected count parameter to resolve to %d, got %d\n", param, n);
+ }
+
+ if (ret != wcslen(checkstr))
+ {
+ Fail("DoCountTest:Expected wprintf to return %d, got %d.\n",
+ wcslen(checkstr), ret);
+ }
+}
+
+void DoShortCountTest(WCHAR *formatstr, int param, WCHAR *checkstr)
+{
+ int ret;
+ short int n = -1;
+
+ ret = wprintf(formatstr, &n);
+
+ if (n != param)
+ {
+ Fail("DoShortCountTest:Expected count parameter to resolve to %d, got %d\n", param, n);
+ }
+
+ if (ret != wcslen(checkstr))
+ {
+ Fail("DoShortCountTest:Expected wprintf to return %d, got %d.\n",
+ wcslen(checkstr), ret);
+ }
+}
+
+
+void DoCharTest(WCHAR *formatstr, WCHAR param, WCHAR *checkstr)
+{
+ int ret;
+
+ ret = wprintf(formatstr, param);
+ if (ret != wcslen(checkstr))
+ {
+ Fail("DoCharTest:Expected wprintf to return %d, got %d.\n",
+ wcslen(checkstr), ret);
+ }
+}
+
+void DoWCharTest(WCHAR *formatstr, WCHAR param, WCHAR *checkstr)
+{
+ int ret;
+
+ ret = wprintf(formatstr, param);
+ if (ret != wcslen(checkstr))
+ {
+ Fail("DoWCharTest:Expected wprintf to return %d, got %d.\n",
+ wcslen(checkstr), ret);
+ }
+}
+
+void DoNumTest(WCHAR *formatstr, int param, WCHAR *checkstr)
+{
+ int ret;
+
+ ret = wprintf(formatstr, param);
+ if (ret != wcslen(checkstr))
+ {
+ Fail("DoNumTest:Expected wprintf to return %d, got %d.\n",
+ wcslen(checkstr), ret);
+ }
+}
+
+void DoI64Test(WCHAR *formatstr, INT64 param, WCHAR *valuestr,
+ WCHAR *checkstr1)
+{
+ int ret;
+
+ ret = wprintf(formatstr, param);
+ if (ret != wcslen(checkstr1))
+ {
+ Fail("DoI64Test:Expected wprintf to return %d, got %d.\n",
+ wcslen(checkstr1), ret);
+ }
+}
+
+void DoDoubleTest(WCHAR *formatstr, double param,
+ WCHAR *checkstr1, WCHAR *checkstr2)
+{
+ int ret;
+
+ ret = wprintf(formatstr, param);
+ if (ret != wcslen(checkstr1) && ret != wcslen(checkstr2))
+ {
+ Fail("DoDoubleTest:Expected wprintf to return %d or %d, got %d.\n",
+ wcslen(checkstr1), wcslen(checkstr2), ret);
+ }
+}
+
+void DoArgumentPrecTest(WCHAR *formatstr, int precision, void *param,
+ WCHAR *paramstr, WCHAR *checkstr1, WCHAR *checkstr2)
+{
+ int ret;
+
+ ret = wprintf(formatstr, precision, param);
+ if (ret != wcslen(checkstr1) && ret != wcslen(checkstr2))
+ {
+ Fail("DoArgumentPrecTest:Expected wprintf to return %d or %d, got %d.\n",
+ wcslen(checkstr1), wcslen(checkstr2), ret);
+ }
+}
+
+void DoArgumentPrecDoubleTest(WCHAR *formatstr, int precision, double param,
+ WCHAR *checkstr1, WCHAR *checkstr2)
+{
+ int ret;
+
+ ret = wprintf(formatstr, precision, param);
+ if (ret != wcslen(checkstr1) && ret != wcslen(checkstr2))
+ {
+ Fail("DoArgumentPrecDoubleTest:Expected wprintf to return %d or %d, got %d.\n",
+ wcslen(checkstr1), wcslen(checkstr2), ret);
+ }
+}
+
+#endif
+