]> git.scottworley.com Git - tl-append/blobdiff - tl-append-test.c
A space for test & implementation to share code
[tl-append] / tl-append-test.c
index ea42dc947fcf7fb94619fdacb74e029ed2d54398..6d037cb1cb57ad307ca53ca307fc603b67f0a40c 100644 (file)
@@ -5,6 +5,8 @@
 #include <string.h>
 #include <time.h>
 
 #include <string.h>
 #include <time.h>
 
+#include "common.h"
+
 typedef struct expectation {
   time_t a, b;
   const char *message;
 typedef struct expectation {
   time_t a, b;
   const char *message;
@@ -22,19 +24,8 @@ static ex_t expectation(time_t a, time_t b, const char *message) {
   return exp;
 }
 
   return exp;
 }
 
-static void die(const char *message) {
-  fputs(message, stderr);
-  fputc('\n', stderr);
-  exit(1);
-}
-
-static void die_err(const char *message) {
-  perror(message);
-  exit(1);
-}
-
 static void remove_logfile() {
 static void remove_logfile() {
-  if (remove("tl.log") != 0) {
+  if (remove(FILENAME) != 0) {
     if (errno != ENOENT) {
       die_err("Error removing log file");
     }
     if (errno != ENOENT) {
       die_err("Error removing log file");
     }
@@ -59,7 +50,7 @@ static ex_t write_to_tl_append(const char *content) {
 
 static void verify_log_contents(ex_t exps[]) {
 
 
 static void verify_log_contents(ex_t exps[]) {
 
-  FILE *f = fopen("tl.log", "r");
+  FILE *f = fopen(FILENAME, "r");
   if (f == NULL)
     die_err("Error opening log file");
   for (size_t i = 0; !is_end(exps[i]); i++) {
   if (f == NULL)
     die_err("Error opening log file");
   for (size_t i = 0; !is_end(exps[i]); i++) {