From e2a8f85a2f6d8d74788bb0be14a4e1b2ae57b887 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 7 Aug 2011 22:41:25 -0400 Subject: [PATCH] Task Refactoring - Task is no longer a map of string to Att. Att is itself a name/ value pair, so the name was redundant. Task is now a map of string to string. This brings the obsoletion of Att much closer. --- src/TDB.cpp | 3 +- src/Task.cpp | 132 ++++++++++++++++----------------- src/Task.h | 9 +-- src/columns/ColDescription.cpp | 32 ++++---- src/commands/CmdDenotate.cpp | 11 +-- src/commands/CmdEdit.cpp | 14 ++-- src/commands/CmdImport.cpp | 8 +- src/commands/CmdStatistics.cpp | 2 +- src/commands/Command.cpp | 1 - src/feedback.cpp | 12 +-- src/helpers.cpp | 16 ++-- src/rules.cpp | 2 +- test/t2.t.cpp | 6 +- 13 files changed, 120 insertions(+), 128 deletions(-) diff --git a/src/TDB.cpp b/src/TDB.cpp index 6812c77b1..0f122d8ec 100644 --- a/src/TDB.cpp +++ b/src/TDB.cpp @@ -836,8 +836,7 @@ void TDB::undo () view.addRow (); // Add rows to table showing diffs. - std::vector all; - Att::allNames (all); + std::vector all = context.getColumns (); // Now factor in the annotation attributes. Task::iterator it; diff --git a/src/Task.cpp b/src/Task.cpp index a3a4f746e..2d232fa0d 100644 --- a/src/Task.cpp +++ b/src/Task.cpp @@ -65,7 +65,7 @@ Task& Task::operator= (const Task& other) { if (this != &other) { - std::map ::operator= (other); + std::map ::operator= (other); id = other.id; urgency_value = other.urgency_value; @@ -76,17 +76,17 @@ Task& Task::operator= (const Task& other) } //////////////////////////////////////////////////////////////////////////////// -// The uuid and id attributes must be exempt for comparison. +// The uuid and id attributes must be exempt from comparison. bool Task::operator== (const Task& other) { if (size () != other.size ()) return false; - Task::iterator att; - for (att = this->begin (); att != this->end (); ++att) - if (att->second.name () != "uuid") - if (att->second.value () != other.get (att->second.name ())) - return false; + Task::iterator i; + for (i = this->begin (); i != this->end (); ++i) + if (i->first != "uuid" && + i->second != other.get (i->first)) + return false; return true; } @@ -170,12 +170,12 @@ bool Task::has (const std::string& name) const } //////////////////////////////////////////////////////////////////////////////// -std::vector Task::all () +std::vector Task::all () { - std::vector all; + std::vector all; Task::iterator i; for (i = this->begin (); i != this->end (); ++i) - all.push_back (i->second); + all.push_back (i->first); return all; } @@ -185,7 +185,7 @@ const std::string Task::get (const std::string& name) const { Task::const_iterator i = this->find (name); if (i != this->end ()) - return i->second.value (); + return i->second; return ""; } @@ -195,7 +195,7 @@ int Task::get_int (const std::string& name) const { Task::const_iterator i = this->find (name); if (i != this->end ()) - return atoi (i->second.value ().c_str ()); + return strtol (i->second.c_str (), NULL, 10); return 0; } @@ -205,7 +205,7 @@ unsigned long Task::get_ulong (const std::string& name) const { Task::const_iterator i = this->find (name); if (i != this->end ()) - return strtoul (i->second.value ().c_str (), NULL, 10); + return strtoul (i->second.c_str (), NULL, 10); return 0; } @@ -215,7 +215,7 @@ time_t Task::get_date (const std::string& name) const { Task::const_iterator i = this->find (name); if (i != this->end ()) - return (time_t) strtoul (i->second.value ().c_str (), NULL, 10); + return (time_t) strtoul (i->second.c_str (), NULL, 10); return 0; } @@ -225,7 +225,7 @@ time_t Task::get_duration (const std::string& name) const { Task::const_iterator i = this->find (name); if (i != this->end ()) - return (time_t) strtoul (i->second.value ().c_str (), NULL, 10); + return (time_t) strtoul (i->second.c_str (), NULL, 10); return 0; } @@ -233,16 +233,13 @@ time_t Task::get_duration (const std::string& name) const //////////////////////////////////////////////////////////////////////////////// void Task::set (const std::string& name, const std::string& value) { - (*this)[name] = Att (name, value); + (*this)[name] = value; } //////////////////////////////////////////////////////////////////////////////// void Task::set (const std::string& name, int value) { - std::stringstream svalue; - svalue << value; - - (*this)[name] = Att (name, svalue.str ()); + (*this)[name] = format (value); } //////////////////////////////////////////////////////////////////////////////// @@ -298,11 +295,17 @@ void Task::parse (const std::string& input) throw std::string (STRING_RECORD_EMPTY); Nibbler nl (line); - Att a; + std::string name; + std::string value; while (!nl.depleted ()) { - a.parse (nl); - (*this)[a.name ()] = a; + if (nl.getUntil (':', name) && + nl.skip (':') && + nl.getQuoted ('"', value)) + { + (*this)[name] = json::decode (value); + } + nl.skip (' '); } @@ -501,7 +504,7 @@ void Task::legacyParse (const std::string& line) //////////////////////////////////////////////////////////////////////////////// // The format is: // -// [ Att::composeF4 ... ] \n +// [ : ... ] \n // std::string Task::composeF4 () const { @@ -511,9 +514,11 @@ std::string Task::composeF4 () const Task::const_iterator it; for (it = this->begin (); it != this->end (); ++it) { - if (it->second.value () != "") + if (it->second != "") { - ff4 += (first ? "" : " ") + it->second.composeF4 (); + ff4 += (first ? "" : " ") + + it->first + + ":\"" + json::encode (it->second) + "\""; first = false; } } @@ -591,8 +596,7 @@ std::string Task::composeYAML () const out << " task:\n"; // Get all the supported attribute names. - std::vector names; - Att::allNames (names); + std::vector names = context.getColumns (); std::sort (names.begin (), names.end ()); // Only include non-trivial attributes. @@ -602,14 +606,14 @@ std::string Task::composeYAML () const if ((value = get (*name)) != "") out << " " << *name << ": " << value << "\n"; - // Now the annotations, which are not listed by the Att::allNames call. - std::vector annotations; + // Now the annotations, which are not listed in names. + std::map annotations; getAnnotations (annotations); - std::vector ::iterator a; + std::map ::iterator a; for (a = annotations.begin (); a != annotations.end (); ++a) out << " annotation:\n" - << " entry: " << a->name().substr (11) << "\n" - << " description: " << a->value () << "\n"; + << " entry: " << a->first.substr (11) << "\n" + << " description: " << a->second << "\n"; return out.str (); } @@ -624,9 +628,6 @@ std::string Task::composeJSON (bool include_id /*= false*/) const if (include_id) out << "\"id\":" << id << ","; - // Used for determining type. - Att att; - // First the non-annotations. int attributes_written = 0; int annotation_count = 0; @@ -636,18 +637,21 @@ std::string Task::composeJSON (bool include_id /*= false*/) const if (attributes_written) out << ","; + Column* column = context.columns[i->first]; + // Annotations are simply counted. - if (i->second.name ().substr (0, 11) == "annotation_") + if (i->first.substr (0, 11) == "annotation_") { ++annotation_count; } // Date fields are written as ISO 8601. - else if (att.type (i->second.name ()) == "date") + else if (column && + column->type () == "date") { - Date d (i->second.value ()); + Date d (i->second); out << "\"" - << i->second.name () + << i->second << "\":\"" << d.toISO () << "\""; @@ -656,10 +660,10 @@ std::string Task::composeJSON (bool include_id /*= false*/) const } // Tags are converted to an array. - else if (i->second.name () == "tags") + else if (i->first == "tags") { std::vector tags; - split (tags, i->second.value (), ','); + split (tags, i->second, ','); out << "\"tags\":["; @@ -679,9 +683,9 @@ std::string Task::composeJSON (bool include_id /*= false*/) const else { out << "\"" - << i->second.name () + << i->first << "\":\"" - << json::encode (i->second.value ()) + << json::encode (i->second) << "\""; ++attributes_written; @@ -697,16 +701,16 @@ std::string Task::composeJSON (bool include_id /*= false*/) const int annotations_written = 0; for (i = this->begin (); i != this->end (); ++i) { - if (i->second.name ().substr (0, 11) == "annotation_") + if (i->first.substr (0, 11) == "annotation_") { if (annotations_written) out << ","; - Date d (i->second.name ().substr (11)); + Date d (i->first.substr (11)); out << "{\"entry\":\"" << d.toISO () << "\",\"description\":\"" - << json::encode (i->second.value ()) + << json::encode (i->second) << "\"}"; ++annotations_written; @@ -721,25 +725,25 @@ std::string Task::composeJSON (bool include_id /*= false*/) const } //////////////////////////////////////////////////////////////////////////////// -void Task::getAnnotations (std::vector & annotations) const +void Task::getAnnotations (std::map & annotations) const { annotations.clear (); Task::const_iterator ci; for (ci = this->begin (); ci != this->end (); ++ci) if (ci->first.substr (0, 11) == "annotation_") - annotations.push_back (ci->second); + annotations.insert (*ci); } //////////////////////////////////////////////////////////////////////////////// -void Task::setAnnotations (const std::vector & annotations) +void Task::setAnnotations (const std::map & annotations) { // Erase old annotations. removeAnnotations (); - std::vector ::const_iterator ci; + std::map ::const_iterator ci; for (ci = annotations.begin (); ci != annotations.end (); ++ci) - (*this)[ci->name ()] = *ci; + this->insert (*ci); recalc_urgency = true; } @@ -753,7 +757,7 @@ void Task::addAnnotation (const std::string& description) std::stringstream s; s << "annotation_" << time (NULL); - (*this)[s.str ()] = Att (s.str (), description); + (*this)[s.str ()] = description; } //////////////////////////////////////////////////////////////////////////////// @@ -922,7 +926,7 @@ void Task::substitute ( { // Get the data to modify. std::string description = get ("description"); - std::vector annotations; + std::map annotations; getAnnotations (annotations); bool sensitive = context.config.getBoolean ("search.case.sensitive"); @@ -962,22 +966,19 @@ void Task::substitute ( if (changes == 0 || global) { // Perform all subs on annotations. - std::vector ::iterator it; + std::map ::iterator it; for (it = annotations.begin (); it != annotations.end (); ++it) { - std::string annotation = it->value (); - start.clear (); end.clear (); - if (rx.match (start, end, annotation)) + if (rx.match (start, end, it->second)) { int skew = 0; int limit = global ? (int) start.size () : 1; for (int i = 0; i < limit && i < RX_MAX_MATCHES; ++i) { - annotation.replace (start[i + skew], end[i] - start[i], to); + it->second.replace (start[i + skew], end[i] - start[i], to); skew += to.length () - (end[i] - start[i]); - it->value (annotation); ++changes; } } @@ -1007,19 +1008,16 @@ void Task::substitute ( { // Perform all subs on annotations. counter = 0; - std::vector ::iterator i; + std::map ::iterator i; for (i = annotations.begin (); i != annotations.end (); ++i) { pos = 0; - std::string annotation = i->value (); - while ((pos = ::find (annotation, from, pos, sensitive)) != std::string::npos) + while ((pos = ::find (i->first, from, pos, sensitive)) != std::string::npos) { - annotation.replace (pos, from.length (), to); + i->second.replace (pos, from.length (), to); pos += to.length (); ++changes; - i->value (annotation); - if (! global) break; @@ -1314,7 +1312,7 @@ float Task::urgency_blocked () const //////////////////////////////////////////////////////////////////////////////// float Task::urgency_annotations () const { - std::vector annos; + std::map annos; getAnnotations (annos); if (annos.size () >= 3) return 1.0; diff --git a/src/Task.h b/src/Task.h index 7155ae2ae..8a5a56352 100644 --- a/src/Task.h +++ b/src/Task.h @@ -32,9 +32,8 @@ #include #include #include -#include -class Task : public std::map +class Task : public std::map { public: Task (); // Default constructor @@ -67,7 +66,7 @@ public: void setStart (); bool has (const std::string&) const; - std::vector all (); + std::vector all (); const std::string get (const std::string&) const; int get_int (const std::string&) const; unsigned long get_ulong (const std::string&) const; @@ -87,8 +86,8 @@ public: void getTags (std::vector&) const; void removeTag (const std::string&); - void getAnnotations (std::vector &) const; - void setAnnotations (const std::vector &); + void getAnnotations (std::map &) const; + void setAnnotations (const std::map &); void addAnnotation (const std::string&); void removeAnnotations (); diff --git a/src/columns/ColDescription.cpp b/src/columns/ColDescription.cpp index f490ce2cb..3220b4ca0 100644 --- a/src/columns/ColDescription.cpp +++ b/src/columns/ColDescription.cpp @@ -106,12 +106,12 @@ void ColumnDescription::measure (Task& task, int& minimum, int& maximum) minimum = max (min_desc, min_anno); maximum = description.length (); - std::vector annos; + std::map annos; task.getAnnotations (annos); - std::vector ::iterator i; + std::map ::iterator i; for (i = annos.begin (); i != annos.end (); i++) { - int len = min_anno + 1 + i->value ().length (); + int len = min_anno + 1 + i->second.length (); if (len > maximum) maximum = len; } @@ -136,11 +136,11 @@ void ColumnDescription::measure (Task& task, int& minimum, int& maximum) minimum = max (min_desc, min_anno); maximum = description.length (); - std::vector annos; + std::map annos; task.getAnnotations (annos); - std::vector ::iterator i; + std::map ::iterator i; for (i = annos.begin (); i != annos.end (); i++) - maximum += i->value ().length () + minimum + 1; + maximum += i->second.length () + minimum + 1; } // The te... @@ -153,7 +153,7 @@ void ColumnDescription::measure (Task& task, int& minimum, int& maximum) // The text [2] else if (_style == "count") { - std::vector annos; + std::map annos; task.getAnnotations (annos); // + ' ' + '[' + + ']' @@ -182,7 +182,7 @@ void ColumnDescription::render ( { int indent = context.config.getInteger ("indent.annotation"); - std::vector annos; + std::map annos; task.getAnnotations (annos); if (annos.size ()) { @@ -190,11 +190,11 @@ void ColumnDescription::render ( if (format == "") format = context.config.get ("dateformat"); - std::vector ::iterator i; + std::map ::iterator i; for (i = annos.begin (); i != annos.end (); i++) { - Date dt (atoi (i->name ().substr (11).c_str ())); - description += "\n" + std::string (indent, ' ') + dt.toString (format) + " " + i->value (); + Date dt (strtol (i->first.substr (11).c_str (), NULL, 10)); + description += "\n" + std::string (indent, ' ') + dt.toString (format) + " " + i->second; } } @@ -220,7 +220,7 @@ void ColumnDescription::render ( // This is a description ... else if (_style == "oneline") { - std::vector annos; + std::map annos; task.getAnnotations (annos); if (annos.size ()) { @@ -228,11 +228,11 @@ void ColumnDescription::render ( if (format == "") format = context.config.get ("dateformat"); - std::vector ::iterator i; + std::map ::iterator i; for (i = annos.begin (); i != annos.end (); i++) { - Date dt (atoi (i->name ().substr (11).c_str ())); - description += " " + dt.toString (format) + " " + i->value (); + Date dt (atoi (i->first.substr (11).c_str ())); + description += " " + dt.toString (format) + " " + i->second; } } @@ -257,7 +257,7 @@ void ColumnDescription::render ( // This is a description [2] else if (_style == "count") { - std::vector annos; + std::map annos; task.getAnnotations (annos); if (annos.size ()) diff --git a/src/commands/CmdDenotate.cpp b/src/commands/CmdDenotate.cpp index 8b65a8798..4a0101a98 100644 --- a/src/commands/CmdDenotate.cpp +++ b/src/commands/CmdDenotate.cpp @@ -86,19 +86,18 @@ int CmdDenotate::execute (std::string& output) { Task before (*task); - std::vector annotations; + std::map annotations; task->getAnnotations (annotations); if (annotations.size () == 0) throw std::string (STRING_CMD_DENO_NONE); - std::vector ::iterator i; + std::map ::iterator i; std::string anno; bool match = false; for (i = annotations.begin (); i != annotations.end (); ++i) { - anno = i->value (); - if (anno == pattern) + if (i->second == pattern) { match = true; annotations.erase (i); @@ -110,9 +109,7 @@ int CmdDenotate::execute (std::string& output) { for (i = annotations.begin (); i != annotations.end (); ++i) { - anno = i->value (); - std::string::size_type loc = find (anno, pattern, sensitive); - + std::string::size_type loc = find (i->second, pattern, sensitive); if (loc != std::string::npos) { annotations.erase (i); diff --git a/src/commands/CmdEdit.cpp b/src/commands/CmdEdit.cpp index fdbace39b..fe2c9f5b2 100644 --- a/src/commands/CmdEdit.cpp +++ b/src/commands/CmdEdit.cpp @@ -199,14 +199,14 @@ std::string CmdEdit::formatTask (Task task) << "# The ' -- ' separator between the date and text field should not be removed.\n" << "# A \"blank slot\" for adding an annotation follows for your convenience.\n"; - std::vector annotations; + std::map annotations; task.getAnnotations (annotations); - std::vector ::iterator anno; + std::map ::iterator anno; for (anno = annotations.begin (); anno != annotations.end (); ++anno) { - Date dt (strtol (anno->name ().substr (11).c_str (), NULL, 10)); + Date dt (strtol (anno->first.substr (11).c_str (), NULL, 10)); before << " Annotation: " << dt.toString (context.config.get ("dateformat.annotation")) - << " -- " << anno->value () << "\n"; + << " -- " << anno->second << "\n"; } Date now; @@ -252,7 +252,7 @@ void CmdEdit::parseTask (Task& task, const std::string& after) { if (value != "") { - if (Att::validNameValue ("priority", "", value)) + if (context.columns["priority"]->validate (value)) { context.footnote ("Priority modified."); task.set ("priority", value); @@ -541,7 +541,7 @@ void CmdEdit::parseTask (Task& task, const std::string& after) } // Annotations - std::vector annotations; + std::map annotations; std::string::size_type found = 0; while ((found = after.find ("\n Annotation:", found)) != std::string::npos) { @@ -567,7 +567,7 @@ void CmdEdit::parseTask (Task& task, const std::string& after) std::stringstream name; name << "annotation_" << when.toEpoch (); std::string text = trim (value.substr (gap + 4), "\t "); - annotations.push_back (Att (name.str (), text)); + annotations.insert (std::make_pair (name.str (), text)); } } } diff --git a/src/commands/CmdImport.cpp b/src/commands/CmdImport.cpp index d65c3bafd..4078c598d 100644 --- a/src/commands/CmdImport.cpp +++ b/src/commands/CmdImport.cpp @@ -137,7 +137,7 @@ int CmdImport::execute (std::string& output) // 'description' values and must be converted. if (i->first == "annotations") { - std::vector annos; + std::map annos; json::array* atts = (json::array*)i->second; json_array_iter annotations; @@ -151,7 +151,7 @@ int CmdImport::execute (std::string& output) std::string name = "annotation_" + Date (when->_data).toEpochString (); - annos.push_back (Att (name, what->_data)); + annos.insert (std::make_pair (name, what->_data)); } task.setAnnotations (annos); @@ -336,14 +336,14 @@ void CmdImport::decorateTask (Task& task) std::string defaultPriority = context.config.get ("default.priority"); if (!task.has ("priority") && defaultPriority != "" && - Att::validNameValue ("priority", "", defaultPriority)) + context.columns["priority"]->validate (defaultPriority)) task.set ("priority", defaultPriority); // Override with default.due, if not specified. std::string defaultDue = context.config.get ("default.due"); if (!task.has ("due") && defaultDue != "" && - Att::validNameValue ("due", "", defaultDue)) + context.columns["due"]->validate (defaultDue)) task.set ("due", defaultDue); } diff --git a/src/commands/CmdStatistics.cpp b/src/commands/CmdStatistics.cpp index 947e0878c..b994455f3 100644 --- a/src/commands/CmdStatistics.cpp +++ b/src/commands/CmdStatistics.cpp @@ -133,7 +133,7 @@ int CmdStatistics::execute (std::string& output) descLength += task->get ("description").length (); - std::vector annotations; + std::map annotations; task->getAnnotations (annotations); annotationsT += annotations.size (); diff --git a/src/commands/Command.cpp b/src/commands/Command.cpp index e986d1f01..f8bbf3db5 100644 --- a/src/commands/Command.cpp +++ b/src/commands/Command.cpp @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include diff --git a/src/feedback.cpp b/src/feedback.cpp index 4a320d7b8..5328427d5 100644 --- a/src/feedback.cpp +++ b/src/feedback.cpp @@ -30,7 +30,6 @@ #include #include #include -#include #include #include #include @@ -45,7 +44,7 @@ bool taskDiff (const Task& before, const Task& after) // Attributes are all there is, so figure the different attribute names // between before and after. std::vector beforeAtts; - std::map ::const_iterator att; + Task::const_iterator att; for (att = before.begin (); att != before.end (); ++att) beforeAtts.push_back (att->first); @@ -76,7 +75,7 @@ std::string taskDifferences (const Task& before, const Task& after) // Attributes are all there is, so figure the different attribute names // between before and after. std::vector beforeAtts; - std::map ::const_iterator att; + Task::const_iterator att; for (att = before.begin (); att != before.end (); ++att) beforeAtts.push_back (att->first); @@ -166,7 +165,7 @@ std::string taskInfoDifferences (const Task& before, const Task& after) // Attributes are all there is, so figure the different attribute names // between before and after. std::vector beforeAtts; - std::map ::const_iterator att; + Task::const_iterator att; for (att = before.begin (); att != before.end (); ++att) beforeAtts.push_back (att->first); @@ -283,8 +282,9 @@ std::string taskInfoDifferences (const Task& before, const Task& after) //////////////////////////////////////////////////////////////////////////////// std::string renderAttribute (const std::string& name, const std::string& value) { - Att a; - if (a.type (name) == "date" && + Column* col = context.columns[name]; + if (col && + col->type () == "date" && value != "") { Date d ((time_t)strtol (value.c_str (), NULL, 10)); diff --git a/src/helpers.cpp b/src/helpers.cpp index 324cea64f..55aa6c970 100644 --- a/src/helpers.cpp +++ b/src/helpers.cpp @@ -57,7 +57,7 @@ std::string getFullDescription (Task& task, const std::string& report) std::string desc = task.get ("description"); std::string annotationDetails; - std::vector annotations; + std::map annotations; task.getAnnotations (annotations); if (annotations.size () != 0) @@ -76,25 +76,27 @@ std::string getFullDescription (Task& task, const std::string& report) { if (annotations.size () > 1) desc = "+" + desc; - Att anno (annotations.back()); - Date dt (atoi (anno.name ().substr (11).c_str ())); + + std::map ::iterator i = annotations.begin (); + + Date dt (strtol (i->first.substr (11).c_str (), NULL, 10)); std::string format = context.config.get ("dateformat.annotation"); if (format == "") format = context.config.get ("dateformat"); std::string when = dt.toString (format); - desc += "\n" + when + " " + anno.value (); + desc += "\n" + when + " " + i->second; } else { - std::vector ::iterator anno; + std::map ::iterator anno; for (anno = annotations.begin (); anno != annotations.end (); ++anno) { - Date dt (atoi (anno->name ().substr (11).c_str ())); + Date dt (strtol (anno->first.substr (11).c_str (), NULL, 10)); std::string format = context.config.get ("dateformat.annotation"); if (format == "") format = context.config.get ("dateformat"); std::string when = dt.toString (format); - desc += "\n" + when + " " + anno->value (); + desc += "\n" + when + " " + anno->second; } } } diff --git a/src/rules.cpp b/src/rules.cpp index fca01babb..6fcd1f9e3 100644 --- a/src/rules.cpp +++ b/src/rules.cpp @@ -194,7 +194,7 @@ static void colorizeKeyword (Task& task, const std::string& rule, Color& c) for (it = task.begin (); it != task.end (); ++it) { if (it->first.substr (0, 11) == "annotation_" && - find (it->second.value (), rule.substr (14), sensitive) != std::string::npos) + find (it->second, rule.substr (14), sensitive) != std::string::npos) { c.blend (gsColor[rule]); return; diff --git a/test/t2.t.cpp b/test/t2.t.cpp index dc6e61ec4..acd2ba367 100644 --- a/test/t2.t.cpp +++ b/test/t2.t.cpp @@ -35,7 +35,7 @@ Context context; //////////////////////////////////////////////////////////////////////////////// int main (int argc, char** argv) { - UnitTest t (21); + UnitTest t (20); // (blank) bool good = true; @@ -105,9 +105,7 @@ int main (int argc, char** argv) t.is (task.composeF4 (), "[name:\"value\"]\n", "Task::remove"); // Task::all - std::vector all = task.all (); - t.is (all.size (), (size_t)1, "Task::all size"); - t.is (all[0].name (), "name", "Task::all[0].name ()"); + t.is (task.size (), (size_t)1, "Task::all size"); return 0; }