diff options
| author | Charles <sircharlesaze@gmail.com> | 2019-11-01 17:18:40 +0100 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2019-11-01 17:18:40 +0100 |
| commit | 573d059fc002343f280945a6a58482c7e018566c (patch) | |
| tree | 9e5920fe7dc454d5a3017a126bb90ee78fb39a9c /helper.c | |
| download | ft_printf_test-573d059fc002343f280945a6a58482c7e018566c.tar.gz ft_printf_test-573d059fc002343f280945a6a58482c7e018566c.tar.bz2 ft_printf_test-573d059fc002343f280945a6a58482c7e018566c.zip | |
Basic testing framework
Diffstat (limited to 'helper.c')
| -rw-r--r-- | helper.c | 27 |
1 files changed, 27 insertions, 0 deletions
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 <stdio.h> +#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 "); } |
