aboutsummaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/unit1398.c4
-rw-r--r--tests/unit/unit1399.c4
-rw-r--r--tests/unit/unit1604.c28
-rw-r--r--tests/unit/unit1650.c12
-rw-r--r--tests/unit/unit1652.c2
5 files changed, 27 insertions, 23 deletions
diff --git a/tests/unit/unit1398.c b/tests/unit/unit1398.c
index b7260195a..22cc837e2 100644
--- a/tests/unit/unit1398.c
+++ b/tests/unit/unit1398.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -74,7 +74,7 @@ fail_unless(!strcmp(output, " bu"), "wrong output");
/* output a number in a limited output */
rc = curl_msnprintf(output, 4, "%d", 10240);
-/* TODO: this should return 5 to be POSIX/snprintf compliant! */
+/* TODO: this should return 5 to be POSIX/msnprintf compliant! */
fail_unless(rc == 4, "return code should be 4");
fail_unless(!strcmp(output, "102"), "wrong output");
diff --git a/tests/unit/unit1399.c b/tests/unit/unit1399.c
index 897a34319..7383fbd86 100644
--- a/tests/unit/unit1399.c
+++ b/tests/unit/unit1399.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -63,7 +63,7 @@ static bool usec_matches_seconds(time_t time_usec, int expected_seconds)
static void expect_timer_seconds(struct Curl_easy *data, int seconds)
{
char msg[64];
- snprintf(msg, sizeof(msg), "about %d seconds should have passed", seconds);
+ msnprintf(msg, sizeof(msg), "about %d seconds should have passed", seconds);
fail_unless(usec_matches_seconds(data->progress.t_nslookup, seconds), msg);
fail_unless(usec_matches_seconds(data->progress.t_connect, seconds), msg);
fail_unless(usec_matches_seconds(data->progress.t_appconnect, seconds), msg);
diff --git a/tests/unit/unit1604.c b/tests/unit/unit1604.c
index fbfd2c423..c285ced43 100644
--- a/tests/unit/unit1604.c
+++ b/tests/unit/unit1604.c
@@ -46,11 +46,15 @@ static char *getflagstr(int flags)
{
char *buf = malloc(256);
if(buf) {
- snprintf(buf, 256, "%s,%s,%s,%s",
- ((flags & SANITIZE_ALLOW_COLONS) ? "SANITIZE_ALLOW_COLONS" : ""),
- ((flags & SANITIZE_ALLOW_PATH) ? "SANITIZE_ALLOW_PATH" : ""),
- ((flags & SANITIZE_ALLOW_RESERVED) ? "SANITIZE_ALLOW_RESERVED" : ""),
- ((flags & SANITIZE_ALLOW_TRUNCATE) ? "SANITIZE_ALLOW_TRUNCATE" : ""));
+ msnprintf(buf, 256, "%s,%s,%s,%s",
+ ((flags & SANITIZE_ALLOW_COLONS) ?
+ "SANITIZE_ALLOW_COLONS" : ""),
+ ((flags & SANITIZE_ALLOW_PATH) ?
+ "SANITIZE_ALLOW_PATH" : ""),
+ ((flags & SANITIZE_ALLOW_RESERVED) ?
+ "SANITIZE_ALLOW_RESERVED" : ""),
+ ((flags & SANITIZE_ALLOW_TRUNCATE) ?
+ "SANITIZE_ALLOW_TRUNCATE" : ""));
}
return buf;
}
@@ -59,13 +63,13 @@ static char *getcurlcodestr(int cc)
{
char *buf = malloc(256);
if(buf) {
- snprintf(buf, 256, "%s (%d)",
- (cc == SANITIZE_ERR_OK ? "SANITIZE_ERR_OK" :
- cc == SANITIZE_ERR_BAD_ARGUMENT ? "SANITIZE_ERR_BAD_ARGUMENT" :
- cc == SANITIZE_ERR_INVALID_PATH ? "SANITIZE_ERR_INVALID_PATH" :
- cc == SANITIZE_ERR_OUT_OF_MEMORY ? "SANITIZE_ERR_OUT_OF_MEMORY" :
- "unexpected error code - add name"),
- cc);
+ msnprintf(buf, 256, "%s (%d)",
+ (cc == SANITIZE_ERR_OK ? "SANITIZE_ERR_OK" :
+ cc == SANITIZE_ERR_BAD_ARGUMENT ? "SANITIZE_ERR_BAD_ARGUMENT" :
+ cc == SANITIZE_ERR_INVALID_PATH ? "SANITIZE_ERR_INVALID_PATH" :
+ cc == SANITIZE_ERR_OUT_OF_MEMORY ? "SANITIZE_ERR_OUT_OF_MEMORY":
+ "unexpected error code - add name"),
+ cc);
}
return buf;
}
diff --git a/tests/unit/unit1650.c b/tests/unit/unit1650.c
index ddf228f8d..4962bfac9 100644
--- a/tests/unit/unit1650.c
+++ b/tests/unit/unit1650.c
@@ -200,7 +200,7 @@ UNITTEST_START
a = &d.addr[u];
if(resp[i].type == DNS_TYPE_A) {
p = &a->ip.v4[0];
- snprintf(ptr, len, "%u.%u.%u.%u ", p[0], p[1], p[2], p[3]);
+ msnprintf(ptr, len, "%u.%u.%u.%u ", p[0], p[1], p[2], p[3]);
o = strlen(ptr);
len -= o;
ptr += o;
@@ -209,20 +209,20 @@ UNITTEST_START
int j;
for(j = 0; j < 16; j += 2) {
size_t l;
- snprintf(ptr, len, "%s%02x%02x", j?":":"", a->ip.v6[j],
+ msnprintf(ptr, len, "%s%02x%02x", j?":":"", a->ip.v6[j],
a->ip.v6[j + 1]);
l = strlen(ptr);
len -= l;
ptr += l;
}
- snprintf(ptr, len, " ");
+ msnprintf(ptr, len, " ");
len--;
ptr++;
}
}
for(u = 0; u < d.numcname; u++) {
size_t o;
- snprintf(ptr, len, "%s ", d.cname[u].alloc);
+ msnprintf(ptr, len, "%s ", d.cname[u].alloc);
o = strlen(ptr);
len -= o;
ptr += o;
@@ -271,8 +271,8 @@ UNITTEST_START
fail_if(d.numaddr != 1, "missing address");
a = &d.addr[0];
p = &a->ip.v4[0];
- snprintf((char *)buffer, sizeof(buffer),
- "%u.%u.%u.%u", p[0], p[1], p[2], p[3]);
+ msnprintf((char *)buffer, sizeof(buffer),
+ "%u.%u.%u.%u", p[0], p[1], p[2], p[3]);
if(rc || strcmp((char *)buffer, "127.0.0.1")) {
fprintf(stderr, "bad address decoded: %s, rc == %d\n", buffer, rc);
return 7;
diff --git a/tests/unit/unit1652.c b/tests/unit/unit1652.c
index 496ab3cb2..9693fe63a 100644
--- a/tests/unit/unit1652.c
+++ b/tests/unit/unit1652.c
@@ -80,7 +80,7 @@ unit_stop(void)
UNITTEST_START
/* Injecting a simple short string via a format */
-snprintf(input, sizeof(input), "Simple Test");
+msnprintf(input, sizeof(input), "Simple Test");
Curl_infof(data, "%s", input);
fail_unless(strcmp(result, input) == 0, "Simple string test");