From 55cb80162c90cec500360f01b344b47b335c5f24 Mon Sep 17 00:00:00 2001 From: Peter Evans Date: Sun, 7 Jan 2018 15:06:07 -0600 Subject: [PATCH] Add missing tests --- tests/log.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/log.c b/tests/log.c index e87af83..11e1b21 100644 --- a/tests/log.c +++ b/tests/log.c @@ -5,6 +5,28 @@ #include "log.h" +/* Test(log, stream) */ +/* + * This test works for both log_stream() and log_open(). + */ +Test(log, open) +{ + log_open(stdin); + cr_assert_eq(log_stream(), stdin); + log_open(stdout); + cr_assert_eq(log_stream(), stdout); +} + +Test(log, close) +{ + FILE *fp; + + fp = fopen("/tmp/test.log.txt", "w"); + log_open(fp); + + cr_assert_eq(log_close(), 0); +} + Test(log, write) { char message[] = "we write the logs"; char message_buffer[128];