From c092b027a6a6bfde5159e867deff1c27c7761f7c Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 29 Jan 2012 17:41:47 -0500 Subject: [PATCH] Code Cleanup - Removed 'synch_key' tests and file I/O. Soon, soon... --- src/TDB2.cpp | 14 +++++++------- src/TDB2.h | 2 +- src/commands/CmdStatistics.cpp | 3 ++- test/tdb2.t.cpp | 14 +++++++------- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/TDB2.cpp b/src/TDB2.cpp index 742269384..065f581d9 100644 --- a/src/TDB2.cpp +++ b/src/TDB2.cpp @@ -477,8 +477,8 @@ void TDB2::set_location (const std::string& location) undo.target (location + "/undo.data"); /* backlog.target (location + "/backlog.data"); -*/ synch_key.target (location + "/synch.key"); +*/ } //////////////////////////////////////////////////////////////////////////////// @@ -558,8 +558,8 @@ void TDB2::commit () undo.commit (); /* backlog.commit (); -*/ synch_key.commit (); +*/ context.timer_commit.stop (); } @@ -1797,11 +1797,11 @@ bool TDB2::read_only () { return pending._read_only || completed._read_only || - undo._read_only || -/* + undo._read_only /*|| backlog._read_only || + synch_key._read_only */ - synch_key._read_only; + ; } //////////////////////////////////////////////////////////////////////////////// @@ -1812,8 +1812,8 @@ void TDB2::clear () undo.clear (); /* backlog.clear (); -*/ synch_key.clear (); +*/ _location = ""; _id = 1; @@ -1829,8 +1829,8 @@ void TDB2::dump () context.debug (undo.dump ()); /* context.debug (backlog.dump ()); -*/ context.debug (synch_key.dump ()); +*/ context.debug (""); } } diff --git a/src/TDB2.h b/src/TDB2.h index bbb324779..2404c79c3 100644 --- a/src/TDB2.h +++ b/src/TDB2.h @@ -129,7 +129,7 @@ public: TF2 completed; TF2 undo; // TF2 backlog; - TF2 synch_key; +// TF2 synch_key; private: std::string _location; diff --git a/src/commands/CmdStatistics.cpp b/src/commands/CmdStatistics.cpp index b1b83accf..198f28125 100644 --- a/src/commands/CmdStatistics.cpp +++ b/src/commands/CmdStatistics.cpp @@ -66,8 +66,9 @@ int CmdStatistics::execute (std::string& output) /* // TODO Re-enable this once 2.1 has taskd support. + context.tdb2.backlog._file.size () + + context.tdb2.synch_key._file.size () */ - + context.tdb2.synch_key._file.size (); + ; // Count the undo transactions. std::vector undoTxns = context.tdb2.undo.get_lines (); diff --git a/test/tdb2.t.cpp b/test/tdb2.t.cpp index 2f7339377..38f693d5b 100644 --- a/test/tdb2.t.cpp +++ b/test/tdb2.t.cpp @@ -39,7 +39,7 @@ int main (int argc, char** argv) /* UnitTest t (15); */ - UnitTest t (12); + UnitTest t (9); try { @@ -65,16 +65,16 @@ int main (int argc, char** argv) std::vector undo = context.tdb2.undo.get_lines (); /* std::vector backlog = context.tdb2.backlog.get_tasks (); -*/ std::vector synch_key = context.tdb2.synch_key.get_lines (); +*/ t.is ((int) pending.size (), 0, "TDB2 Read empty pending"); t.is ((int) completed.size (), 0, "TDB2 Read empty completed"); t.is ((int) undo.size (), 0, "TDB2 Read empty undo"); /* t.is ((int) backlog.size (), 0, "TDB2 Read empty backlog"); -*/ t.is ((int) synch_key.size (), 0, "TDB2 Read empty synch.key"); +*/ // Add a task. Task task ("[description:\"description\" name:\"value\"]"); @@ -85,16 +85,16 @@ int main (int argc, char** argv) undo = context.tdb2.undo.get_lines (); /* backlog = context.tdb2.backlog.get_tasks (); -*/ synch_key = context.tdb2.synch_key.get_lines (); +*/ t.is ((int) pending.size (), 1, "TDB2 after add, 1 pending task"); t.is ((int) completed.size (), 0, "TDB2 after add, 0 completed tasks"); t.is ((int) undo.size (), 3, "TDB2 after add, 3 undo lines"); /* t.is ((int) backlog.size (), 1, "TDB2 after add, 1 backlog task"); -*/ t.is ((int) synch_key.size (), 0, "TDB2 after add, 0 synch.key"); +*/ task.set ("description", "This is a test"); context.tdb2.modify (task); @@ -104,16 +104,16 @@ int main (int argc, char** argv) undo = context.tdb2.undo.get_lines (); /* backlog = context.tdb2.backlog.get_tasks (); -*/ synch_key = context.tdb2.synch_key.get_lines (); +*/ t.is ((int) pending.size (), 1, "TDB2 after add, 1 pending task"); t.is ((int) completed.size (), 0, "TDB2 after add, 0 completed tasks"); t.is ((int) undo.size (), 7, "TDB2 after add, 7 undo lines"); /* t.is ((int) backlog.size (), 2, "TDB2 after add, 2 backlog task"); -*/ t.is ((int) synch_key.size (), 0, "TDB2 after add, 0 synch.key"); +*/ context.tdb2.commit ();