mirror of
https://github.com/curl/curl.git
synced 2026-04-14 15:01:47 +03:00
parent
3e40ccb875
commit
879209fc88
1 changed files with 25 additions and 0 deletions
|
|
@ -40,6 +40,31 @@ static CURLcode test_unit1398(const char *arg)
|
|||
|
||||
/* #define curl_msnprintf snprintf */
|
||||
|
||||
/* negative precision is treated as if omitted */
|
||||
rc = curl_msnprintf(output, sizeof(output), "%.*s", -1, str);
|
||||
fail_unless(rc == 3, "return code should be 3");
|
||||
fail_unless(!strcmp(output, "bug"), "wrong output");
|
||||
|
||||
rc = curl_msnprintf(output, sizeof(output), "%.*s", -1, "0123456789");
|
||||
fail_unless(rc == 10, "return code should be 10");
|
||||
fail_unless(!strcmp(output, "0123456789"), "wrong output");
|
||||
|
||||
rc = curl_msnprintf(output, sizeof(output), "%.*s", 0, "0123456789");
|
||||
fail_unless(rc == 0, "return code should be 0");
|
||||
fail_unless(!strcmp(output, ""), "wrong output");
|
||||
|
||||
rc = curl_msnprintf(output, sizeof(output), "%.*s", -2, str);
|
||||
fail_unless(rc == 3, "return code should be 3");
|
||||
fail_unless(!strcmp(output, "bug"), "wrong output");
|
||||
|
||||
rc = curl_msnprintf(output, sizeof(output), "%.*d", -3, 10000);
|
||||
fail_unless(rc == 5, "return code should be 5");
|
||||
fail_unless(!strcmp(output, "10000"), "wrong output");
|
||||
|
||||
rc = curl_msnprintf(output, sizeof(output), "%.*d", 0, 1234567);
|
||||
fail_unless(rc == 7, "return code should be 0");
|
||||
fail_unless(!strcmp(output, "1234567"), "wrong output");
|
||||
|
||||
/* without a trailing zero */
|
||||
rc = curl_msnprintf(output, 4, "%.*s", width, buf);
|
||||
fail_unless(rc == 3, "return code should be 3");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue