int main()
{
char buf[100];
- char *expected;
- char test_fmt_str[] = "header %d, %s, %03d, '%3$*d'";
- char escaped_test_fmt_str[] = "header %%d, %%s, %%03d, '%%3$*d'";
+ const char expected_str[] = "header 9999, hello, 005, ' 9'";
+ const char test_fmt_str[] = "header %d, %s, %03d, '%*d'";
plan_tests(1);
- expected = "header 9999, hello, 005, ' 9'";
- ust_safe_snprintf(buf, 99, test_fmt_str, 9999, "hello", 5, 9);
+ ust_safe_snprintf(buf, 99, test_fmt_str, 9999, "hello", 5, 5, 9);
- char test_desc_fmt_str[] = "Got expected output string with format string \"%s\"";
- char test_desc[sizeof(escaped_test_fmt_str) + sizeof(test_desc_fmt_str) - 1];
- sprintf(test_desc, test_desc_fmt_str, escaped_test_fmt_str);
- ok(strcmp(buf, expected) == 0, test_desc);
+ ok(strcmp(buf, expected_str) == 0, "Got expected output string with format string \"%s\"", test_fmt_str);
return exit_status();
}
* Copyright (C) 2015 Antoine Busque <abusque@efficios.com>
*/
+#include <inttypes.h>
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
ret = lttng_ust_elf_get_memsz(elf, &memsz);
ok(ret == 0, "lttng_ust_elf_get_memsz returned successfully");
ok(memsz == exp_memsz,
- "memsz - expected: %lu, got: %lu",
+ "memsz - expected: %" PRIu64 ", got: %" PRIu64,
exp_memsz, memsz);
ret = lttng_ust_elf_get_build_id(elf, &build_id, &build_id_len,
ok(ret == 0, "lttng_ust_elf_get_build_id returned successfully");
ok(has_build_id == 1, "build id marked as found");
ok(build_id_len == BUILD_ID_LEN,
- "build_id_len - expected: %u, got: %u",
+ "build_id_len - expected: %u, got: %zu",
BUILD_ID_LEN, build_id_len);
ok(memcmp(build_id, exp_build_id, build_id_len) == 0,
"build_id has expected value");