From c90f21d1d5526f87035fcf34ad40feb3348558c6 Mon Sep 17 00:00:00 2001 From: Jonas Suhr Christensen Date: Fri, 4 May 2012 11:33:45 +0200 Subject: Added test --- src/tasktree.cc | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/tasktree.cc b/src/tasktree.cc index 0a9ad46..c66e665 100644 --- a/src/tasktree.cc +++ b/src/tasktree.cc @@ -267,27 +267,42 @@ void TaskTree::toStdOut() { #ifdef TEST_TASKTREE //Additional dependency files -//deps: +//deps: debug.cc log.cc //Required cflags (autoconf vars may be used) -//cflags: +//cflags: -I.. //Required link options (autoconf vars may be used) //libs: #include "test.h" #include +#define ROOT_ID 0 +#define LOSTFOUND_ID 1 +#define FINISHED_ID 2 +#define BACKLOG_ID 3 +#define PROJECTS_ID 4 +#define FIRST_TASK_ID 10 + TEST_BEGIN; TaskTree tree; task_t t; -try { - tree.insertAsChild(-1, t); - } - catch(std::exeception& e) { - } - -// TODO: Put some testcode here (see test.h for usable macros). -TEST_TRUE(false, "No tests yet!"); +t.title = "root"; +tree.insertAsChild(0, ROOT_ID, t); + +t.title = "Finished"; +tree.insertAsChild(ROOT_ID, FINISHED_ID, t); + +t.title = "Backlog"; +tree.insertAsChild(ROOT_ID, BACKLOG_ID, t); + +t.title = "Lost+Found"; +tree.insertAsChild(ROOT_ID, LOSTFOUND_ID, t); + +t.title = "Projects"; +tree.insertAsChild(ROOT_ID, PROJECTS_ID, t); + +TEST_EQUAL_INT(5, tree.bfs(0).size(), "Testing BFS function"); TEST_END; -- cgit v1.2.3