From 573d059fc002343f280945a6a58482c7e018566c Mon Sep 17 00:00:00 2001 From: Charles Date: Fri, 1 Nov 2019 17:18:40 +0100 Subject: Basic testing framework --- helper.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 helper.c (limited to 'helper.c') diff --git a/helper.c b/helper.c new file mode 100644 index 0000000..1c16409 --- /dev/null +++ b/helper.c @@ -0,0 +1,27 @@ +#include +#include "header.h" + +void print_buf_ko(char *msg) +{ + print_ko(); + printf("ft_printf(%s) has wrong output\n", msg); + printf("actual: \"%s\"", origin_buf); + printf("expected: \"%s\"", user_buf); +} + +void print_ret_ko(char *msg) +{ + print_ko(); + printf("ft_printf(%s) has wrong return value\n", msg); + printf("actual: %d", origin_ret); + printf("expected: %d", user_ret); +} + +void print_signaled_ko(char *msg) +{ + print_ko(); + printf("ft_printf(\"%s\") has been signaled (segfault and friends)\n", msg); +} + +inline void print_ok(void) { printf("\033[32m[OK]\033[0m\n"); } +inline void print_ko(void) { printf("\033[31m[KO]\033[0m "); } -- cgit