From 6d8cb5181fb37725f4064afa0413956ad404def6 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Tue, 10 Mar 2009 15:40:48 -0400 Subject: [PATCH] Bug Fix - unit test tdb.t - Fixed two failing unit tests in tdb.t.cpp, which were both due to incorrect test logic, rather than a TDB bug. --- src/TDB.cpp | 4 ++++ src/tests/tdb.t.cpp | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/TDB.cpp b/src/TDB.cpp index c77febb7a..0ab4ed10a 100644 --- a/src/TDB.cpp +++ b/src/TDB.cpp @@ -398,6 +398,8 @@ bool TDB::readLockedFile ( } //////////////////////////////////////////////////////////////////////////////// +// Scans the pending tasks for any that are completed or deleted, and if so, +// moves them to the completed.data file. Returns a count of tasks moved. int TDB::gc () { int count = 0; @@ -415,7 +417,9 @@ int TDB::gc () // Some tasks stay in the pending file. if (it->getStatus () == T::pending || it->getStatus () == T::recurring) + { pending.push_back (*it); + } // Others are transferred to the completed file. else diff --git a/src/tests/tdb.t.cpp b/src/tests/tdb.t.cpp index 3676f6517..c874c00fa 100644 --- a/src/tests/tdb.t.cpp +++ b/src/tests/tdb.t.cpp @@ -99,10 +99,9 @@ int main (int argc, char** argv) // Add a new task. T t2; - t2.setId (2); + t2.setId (1); t2.setAttribute ("project", "p2"); t2.setDescription ("task 2"); - t.diag (t2.compose ()); t.ok (tdb.addT (t2), "TDB::addT t2"); // Delete task.