Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Tests: don't use %zu placeholder in printf statements

It's not supported by msvcrt.
  • Loading branch information...
commit 2e5e1165ce7491a0de9bea512f3ca25be9461e0a 1 parent 42d3533
@piscisaureus piscisaureus authored
Showing with 21 additions and 16 deletions.
  1. +3 −1 test/test-get-memory.c
  2. +18 −15 test/test-platform-output.c
View
4 test/test-get-memory.c
@@ -26,7 +26,9 @@ TEST_IMPL(get_memory) {
uint64_t free_mem = uv_get_free_memory();
uint64_t total_mem = uv_get_total_memory();
- printf("free_mem=%zu, total_mem=%zu\n", (size_t)free_mem, (size_t)total_mem);
+ printf("free_mem=%llu, total_mem=%llu\n",
+ (unsigned long long) free_mem,
+ (unsigned long long) total_mem);
ASSERT(free_mem > 0);
ASSERT(total_mem > 0);
View
33 test/test-platform-output.c
@@ -36,39 +36,42 @@ TEST_IMPL(platform_output) {
err = uv_get_process_title(buffer, sizeof(buffer));
ASSERT(UV_OK == err.code);
- fprintf(stderr, "uv_get_process_title: %s\n", buffer);
+ printf("uv_get_process_title: %s\n", buffer);
err = uv_resident_set_memory(&rss);
ASSERT(UV_OK == err.code);
- fprintf(stderr, "uv_resident_set_memory: %zu\n", rss);
+ printf("uv_resident_set_memory: %llu\n", (unsigned long long) rss);
err = uv_uptime(&uptime);
ASSERT(UV_OK == err.code);
ASSERT(uptime > 0);
- fprintf(stderr, "uv_uptime: %f\n", uptime);
+ printf("uv_uptime: %f\n", uptime);
err = uv_cpu_info(&cpus, &count);
ASSERT(UV_OK == err.code);
- fprintf(stderr, "uv_cpu_info:\n");
+ printf("uv_cpu_info:\n");
for (i = 0; i < count; i++) {
- fprintf(stderr, " model: %s\n", cpus[i].model);
- fprintf(stderr, " speed: %d\n", cpus[i].speed);
- fprintf(stderr, " times.sys: %zu\n", (size_t)cpus[i].cpu_times.sys);
- fprintf(stderr, " times.user: %zu\n", (size_t)cpus[i].cpu_times.user);
- fprintf(stderr, " times.idle: %zu\n", (size_t)cpus[i].cpu_times.idle);
- fprintf(stderr, " times.irq: %zu\n", (size_t)cpus[i].cpu_times.irq);
- fprintf(stderr, " times.nice: %zu\n", (size_t)cpus[i].cpu_times.nice);
+ printf(" model: %s\n", cpus[i].model);
+ printf(" speed: %d\n", cpus[i].speed);
+ printf(" times.sys: %llu\n", (unsigned long long) cpus[i].cpu_times.sys);
+ printf(" times.user: %llu\n",
+ (unsigned long long) cpus[i].cpu_times.user);
+ printf(" times.idle: %llu\n",
+ (unsigned long long) cpus[i].cpu_times.idle);
+ printf(" times.irq: %llu\n", (unsigned long long) cpus[i].cpu_times.irq);
+ printf(" times.nice: %llu\n",
+ (unsigned long long) cpus[i].cpu_times.nice);
}
uv_free_cpu_info(cpus, count);
err = uv_interface_addresses(&interfaces, &count);
ASSERT(UV_OK == err.code);
- fprintf(stderr, "uv_interface_addresses:\n");
+ printf("uv_interface_addresses:\n");
for (i = 0; i < count; i++) {
- fprintf(stderr, " name: %s\n", interfaces[i].name);
- fprintf(stderr, " internal: %d\n", interfaces[i].is_internal);
+ printf(" name: %s\n", interfaces[i].name);
+ printf(" internal: %d\n", interfaces[i].is_internal);
if (interfaces[i].address.address4.sin_family == AF_INET) {
uv_ip4_name(&interfaces[i].address.address4, buffer, sizeof(buffer));
@@ -76,7 +79,7 @@ TEST_IMPL(platform_output) {
uv_ip6_name(&interfaces[i].address.address6, buffer, sizeof(buffer));
}
- fprintf(stderr, " address: %s\n", buffer);
+ printf(" address: %s\n", buffer);
}
uv_free_interface_addresses(interfaces, count);
Please sign in to comment.
Something went wrong with that request. Please try again.