From f7e9b46c69f454a1976b5ff471cc907756c01a7c Mon Sep 17 00:00:00 2001 From: Andy Spencer Date: Sun, 16 Jun 2013 21:05:26 +0000 Subject: [PATCH] Make testing code build time configurable --- cals/ical.c | 4 ++-- config.mk.example | 2 +- src/cal.c | 16 ++++++++++------ src/date.c | 5 ----- views/events.c | 2 -- 5 files changed, 13 insertions(+), 16 deletions(-) diff --git a/cals/ical.c b/cals/ical.c index 2862e72..981d08d 100644 --- a/cals/ical.c +++ b/cals/ical.c @@ -372,8 +372,8 @@ void ical_test(void) icalarray_free(array); /* Print */ - //ical_printr(comp, 0); - //print_events(events); + ical_printr(comp, 0); + print_events(events); print_todos(todos); (void)print_events; diff --git a/config.mk.example b/config.mk.example index 1c23c70..72d298a 100644 --- a/config.mk.example +++ b/config.mk.example @@ -1,5 +1,5 @@ PREFIX ?= /usr -CFLAGS ?= -g -Wall -Werror --std=c99 +CFLAGS ?= -g -Wall -Werror --std=c99 -DDEBUG_CALS default: all run-lackey #default: all run-test diff --git a/src/cal.c b/src/cal.c index 62b21ac..565432c 100644 --- a/src/cal.c +++ b/src/cal.c @@ -112,6 +112,7 @@ void cal_init(void) cal_load(YEAR, MONTH, DAY, 1); /* Debug */ +#ifdef DEBUG_CALS for (event_t *e = EVENTS; e; e = e->next) debug("event: %04d-%02d-%02d %02d:%02d: %s - %s", e->start.year, e->start.month, e->start.day, @@ -120,6 +121,7 @@ void cal_init(void) debug("todo: %04d-%02d-%02d %02d:%02d: %s - %s", e->start.year, e->start.month, e->start.day, e->start.hour, e->start.min, e->name, e->desc); +#endif } /* Load events and todos */ @@ -170,12 +172,14 @@ void cal_load(year_t year, month_t month, day_t day, int days) ical_todos(start, end)); /* Verify events and todos*/ - //for (event_t *cur = EVENTS; cur; cur = cur->next) - // if (!cur->cal) - // error("Missing cal in event '%s'", cur->name); - //for (todo_t *cur = TODOS; cur; cur = cur->next) - // if (!cur->cal) - // error("Missing cal in todo '%s'", cur->name); +#ifdef DEBUG_CALS + for (event_t *cur = EVENTS; cur; cur = cur->next) + if (!cur->cal) + error("Missing cal in event '%s'", cur->name); + for (todo_t *cur = TODOS; cur; cur = cur->next) + if (!cur->cal) + error("Missing cal in todo '%s'", cur->name); +#endif } /* Config parser */ diff --git a/src/date.c b/src/date.c index 2210496..f171928 100644 --- a/src/date.c +++ b/src/date.c @@ -36,11 +36,6 @@ void date_init(void) YEAR = tm->tm_year+1900; MONTH = tm->tm_mon; DAY = tm->tm_mday-1; - - /* Testing */ - //YEAR = 2008; - //MONTH = OCT; - //DAY = 21; } /* Time functions */ diff --git a/views/events.c b/views/events.c index e254ffb..56d6aab 100644 --- a/views/events.c +++ b/views/events.c @@ -15,8 +15,6 @@ * along with this program. If not, see . */ -#define DEBUG - #include #include "util.h" -- 2.43.2