From f4dd6cbb40057ef1e19d45a7e0eb4c40c0a2d778 Mon Sep 17 00:00:00 2001 From: Mathis Rosenhauer Date: Thu, 29 Nov 2012 15:24:16 +0100 Subject: [PATCH] Check coloring --- tests/Makefile.am | 1 + tests/check_aec.c | 4 ++-- tests/check_aec.h | 4 +++- tests/check_buffer_sizes.c | 4 ++-- tests/check_code_options.c | 14 +++++++------- 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index 2821b0d..37fceab 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,3 +1,4 @@ +AUTOMAKE_OPTIONS = color-tests AM_CPPFLAGS = -I$(top_srcdir)/src TESTS = check_code_options check_buffer_sizes check_LTLIBRARIES = libcheck_aec.la diff --git a/tests/check_aec.c b/tests/check_aec.c index ac1d915..57c57fd 100644 --- a/tests/check_aec.c +++ b/tests/check_aec.c @@ -173,7 +173,7 @@ int encode_decode_small(struct test_state *state) } if (memcmp(state->ubuf, state->obuf, state->ibuf_len)) { - printf("FAIL: Uncompressed output differs from input.\n"); + printf("\n%s: Uncompressed output differs from input.\n", CHECK_FAIL); printf("\nuncompressed buf"); for (i = 0; i < 80; i++) { @@ -243,7 +243,7 @@ int encode_decode_large(struct test_state *state) } if (memcmp(state->ubuf, state->obuf, state->ibuf_len)) { - printf("FAIL: Uncompressed output differs from input.\n"); + printf("\n%s: Uncompressed output differs from input.\n", CHECK_FAIL); printf("\nuncompressed buf"); for (i = 0; i < 80; i++) { diff --git a/tests/check_aec.h b/tests/check_aec.h index 62a0a30..a7a307d 100644 --- a/tests/check_aec.h +++ b/tests/check_aec.h @@ -22,5 +22,7 @@ int update_state(struct test_state *state); int encode_decode_small(struct test_state *state); int encode_decode_large(struct test_state *state); -#define CHECK_OK "" +#define CHECK_PASS "PASS" +#define CHECK_FAIL "FAIL" + #endif /* CHECK_AEC_H */ diff --git a/tests/check_buffer_sizes.c b/tests/check_buffer_sizes.c index abcf5db..7448baf 100644 --- a/tests/check_buffer_sizes.c +++ b/tests/check_buffer_sizes.c @@ -65,14 +65,14 @@ int check_rsi(struct test_state *state) if (status) return status; - printf ("OK\n"); + printf ("%s\n", CHECK_PASS); printf("Checking short rsi ... "); status = check_block_sizes_short(state); if (status) return status; - printf ("OK\n"); + printf ("%s\n", CHECK_PASS); return 0; } diff --git a/tests/check_code_options.c b/tests/check_code_options.c index d16954d..dc6bebf 100644 --- a/tests/check_code_options.c +++ b/tests/check_code_options.c @@ -25,8 +25,8 @@ int check_block_sizes(struct test_state *state, int id, int id_len) return status; if ((state->cbuf[0] >> (8 - id_len)) != id) { - printf("FAIL: Unexpected block of size %i created ID:%x.\n", - bs, state->cbuf[0] >> (8 - id_len)); + printf("%s: Unexpected block of size %i created ID:%x.\n", + CHECK_FAIL, bs, state->cbuf[0] >> (8 - id_len)); return 99; } } @@ -45,7 +45,7 @@ int check_zero(struct test_state *state) if (status) return status; - printf ("OK\n"); + printf ("%s\n", CHECK_PASS); return 0; } @@ -70,7 +70,7 @@ int check_splitting(struct test_state *state, int k) if (status) return status; - printf ("OK\n"); + printf ("%s\n", CHECK_PASS); return 0; } @@ -95,7 +95,7 @@ int check_uncompressed(struct test_state *state) if (status) return status; - printf ("OK\n"); + printf ("%s\n", CHECK_PASS); return 0; } @@ -120,7 +120,7 @@ int check_fs(struct test_state *state) if (status) return status; - printf ("OK\n"); + printf ("%s\n", CHECK_PASS); return 0; } @@ -149,7 +149,7 @@ int check_se(struct test_state *state) if (status) return status; - printf ("OK\n"); + printf ("%s\n", CHECK_PASS); return 0; } -- 2.7.4