40 #if (SIZEOF_CURL_OFF_T > SIZEOF_LONG) 41 # define MPRNT_SUFFIX_CURL_OFF_T LL 43 # define MPRNT_SUFFIX_CURL_OFF_T L 48 # define MPRNT_OFF_T_C_HELPER2(Val,Suffix) Val ## Suffix 50 # define MPRNT_OFF_T_C_HELPER2(Val,Suffix) ValSuffix 52 #define MPRNT_OFF_T_C_HELPER1(Val,Suffix) MPRNT_OFF_T_C_HELPER2(Val,Suffix) 53 #define MPRNT_OFF_T_C(Val) MPRNT_OFF_T_C_HELPER1(Val,MPRNT_SUFFIX_CURL_OFF_T) 57 #define USHORT_TESTS_ARRSZ 1 + 100 58 #define SSHORT_TESTS_ARRSZ 1 + 100 59 #define UINT_TESTS_ARRSZ 1 + 100 60 #define SINT_TESTS_ARRSZ 1 + 100 61 #define ULONG_TESTS_ARRSZ 1 + 100 62 #define SLONG_TESTS_ARRSZ 1 + 100 63 #define COFFT_TESTS_ARRSZ 1 + 100 127 int num_ushort_tests;
130 #if (SIZEOF_SHORT == 1) 145 num_ushort_tests =
i;
147 #elif (SIZEOF_SHORT == 2) 166 num_ushort_tests =
i;
168 #elif (SIZEOF_SHORT == 4) 200 num_ushort_tests =
i;
204 for(i = 1; i <= num_ushort_tests; i++) {
206 for(j = 0; j<
BUFSZ; j++)
214 strlen(
us_test[i].expected))) {
215 printf(
"unsigned short test #%.2d: Failed (Expected: %s Got: %s)\n",
223 printf(
"All curl_mprintf() unsigned short tests OK!\n");
225 printf(
"Some curl_mprintf() unsigned short tests Failed!\n");
234 int num_sshort_tests;
237 #if (SIZEOF_SHORT == 1) 260 num_sshort_tests =
i;
262 #elif (SIZEOF_SHORT == 2) 303 num_sshort_tests =
i;
305 #elif (SIZEOF_SHORT == 4) 370 num_sshort_tests =
i;
374 for(i = 1; i <= num_sshort_tests; i++) {
376 for(j = 0; j<
BUFSZ; j++)
384 strlen(
ss_test[i].expected))) {
385 printf(
"signed short test #%.2d: Failed (Expected: %s Got: %s)\n",
393 printf(
"All curl_mprintf() signed short tests OK!\n");
395 printf(
"Some curl_mprintf() signed short tests Failed!\n");
407 #if (SIZEOF_INT == 2) 428 #elif (SIZEOF_INT == 4) 462 #elif (SIZEOF_INT == 8) 524 for(i = 1; i <= num_uint_tests; i++) {
526 for(j = 0; j<
BUFSZ; j++)
534 strlen(
ui_test[i].expected))) {
535 printf(
"unsigned int test #%.2d: Failed (Expected: %s Got: %s)\n",
543 printf(
"All curl_mprintf() unsigned int tests OK!\n");
545 printf(
"Some curl_mprintf() unsigned int tests Failed!\n");
557 #if (SIZEOF_INT == 2) 600 #elif (SIZEOF_INT == 4) 667 #elif (SIZEOF_INT == 8) 752 for(i = 1; i <= num_sint_tests; i++) {
754 for(j = 0; j<
BUFSZ; j++)
762 strlen(
si_test[i].expected))) {
763 printf(
"signed int test #%.2d: Failed (Expected: %s Got: %s)\n",
771 printf(
"All curl_mprintf() signed int tests OK!\n");
773 printf(
"Some curl_mprintf() signed int tests Failed!\n");
785 #if (SIZEOF_LONG == 2) 806 #elif (SIZEOF_LONG == 4) 840 #elif (SIZEOF_LONG == 8) 901 for(i = 1; i <= num_ulong_tests; i++) {
903 for(j = 0; j<
BUFSZ; j++)
911 strlen(
ul_test[i].expected))) {
912 printf(
"unsigned long test #%.2d: Failed (Expected: %s Got: %s)\n",
920 printf(
"All curl_mprintf() unsigned long tests OK!\n");
922 printf(
"Some curl_mprintf() unsigned long tests Failed!\n");
934 #if (SIZEOF_LONG == 2) 977 #elif (SIZEOF_LONG == 4) 1042 num_slong_tests =
i;
1044 #elif (SIZEOF_LONG == 8) 1125 num_slong_tests =
i;
1129 for(i = 1; i <= num_slong_tests; i++) {
1131 for(j = 0; j<
BUFSZ; j++)
1139 strlen(
sl_test[i].expected))) {
1140 printf(
"signed long test #%.2d: Failed (Expected: %s Got: %s)\n",
1148 printf(
"All curl_mprintf() signed long tests OK!\n");
1150 printf(
"Some curl_mprintf() signed long tests Failed!\n");
1159 int num_cofft_tests;
1162 #if (SIZEOF_CURL_OFF_T == 2) 1203 num_cofft_tests =
i;
1205 #elif (SIZEOF_CURL_OFF_T == 4) 1270 num_cofft_tests =
i;
1272 #elif (SIZEOF_CURL_OFF_T == 8) 1353 num_cofft_tests =
i;
1357 for(i = 1; i <= num_cofft_tests; i++) {
1359 for(j = 0; j<
BUFSZ; j++)
1368 strlen(
co_test[i].expected))) {
1369 printf(
"curl_off_t test #%.2d: Failed (Expected: %s Got: %s)\n",
1377 printf(
"All curl_mprintf() curl_off_t tests OK!\n");
1379 printf(
"Some curl_mprintf() curl_off_t tests Failed!\n");
1386 if(strcmp(buf, buf2)) {
1388 printf(
"sprintf line %d failed:\nwe '%s'\nsystem: '%s'\n",
1389 linenumber, buf, buf2);
1394 #define string_check(x,y) _string_check(__LINE__, x, y) 1398 size_t buflen = strlen(buf);
1401 printf(
"sprintf strlen:%d failed:\nwe '%d'\nsystem: '%d'\n",
1402 linenumber, buflen, len);
1408 #define strlen_check(x,y) _strlen_check(__LINE__, x, y) 1440 printf(
"All curl_mprintf() strings tests OK!\n");
1442 printf(
"Some curl_mprintf() string tests Failed!\n");
1455 "%d%d%d%d%d%d%d%d%d%d" 1456 "%d%d%d%d%d%d%d%d%d%d" 1457 "%d%d%d%d%d%d%d%d%d%d" 1458 "%d%d%d%d%d%d%d%d%d%d" 1459 "%d%d%d%d%d%d%d%d%d%d" 1460 "%d%d%d%d%d%d%d%d%d%d" 1461 "%d%d%d%d%d%d%d%d%d%d" 1462 "%d%d%d%d%d%d%d%d%d%d" 1463 "%d%d%d%d%d%d%d%d%d%d" 1464 "%d%d%d%d%d%d%d%d%d%d" 1465 "%d%d%d%d%d%d%d%d%d%d" 1466 "%d%d%d%d%d%d%d%d%d%d" 1469 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
1470 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
1471 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
1472 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
1473 0, 1, 2, 3, 4, 5, 6, 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 8, 9,
1533 0, 1, 2, 3, 4, 5, 6, 7, 8);
1536 printf(
"curl_mprintf() returned %d and not -1!\n", rc);
1543 printf(
"Some curl_mprintf() weird arguments tests failed!\n");
1550 #define MAXIMIZE -1.7976931348623157081452E+308 1626 123456789123456789123456789.2987654);
1655 printf(
"All float strings tests OK!\n");
1657 printf(
"test_float_formatting Failed!\n");
1668 #ifdef HAVE_SETLOCALE 1673 setlocale(LC_NUMERIC,
"C");
static int test_signed_short_formatting(void)
#define SLONG_TESTS_ARRSZ
static int test_weird_arguments(void)
#define USHORT_TESTS_ARRSZ
static struct sigint_st si_test[SINT_TESTS_ARRSZ]
static int test_float_formatting(void)
#define SSHORT_TESTS_ARRSZ
#define MPRNT_OFF_T_C(Val)
static struct sigshort_st ss_test[SSHORT_TESTS_ARRSZ]
#define COFFT_TESTS_ARRSZ
CURL_EXTERN int curl_msprintf(char *buffer, const char *format,...)
#define TEST_ERR_MAJOR_BAD
static int test_curl_off_t_formatting(void)
static int _strlen_check(int linenumber, char *buf, size_t len)
static int test_unsigned_long_formatting(void)
static struct curloff_st co_test[COFFT_TESTS_ARRSZ]
CURL_TYPEOF_CURL_OFF_T curl_off_t
static struct siglong_st sl_test[SLONG_TESTS_ARRSZ]
CURL_EXTERN int curl_msnprintf(char *buffer, size_t maxlength, const char *format,...)
static int _string_check(int linenumber, char *buf, const char *buf2)
static int test_string_formatting(void)
static struct unslong_st ul_test[ULONG_TESTS_ARRSZ]
static int test_unsigned_int_formatting(void)
static struct unsint_st ui_test[UINT_TESTS_ARRSZ]
static int test_signed_long_formatting(void)
#define strlen_check(x, y)
static int test_unsigned_short_formatting(void)
#define ULONG_TESTS_ARRSZ
static struct unsshort_st us_test[USHORT_TESTS_ARRSZ]
#define string_check(x, y)
static int test_signed_int_formatting(void)
#define CURL_FORMAT_CURL_OFF_T