diff --git a/src/A3.cpp b/src/A3.cpp index ada273c3d..cd439f83f 100644 --- a/src/A3.cpp +++ b/src/A3.cpp @@ -1397,7 +1397,7 @@ bool A3::is_attmod (Nibbler& n, Arg& arg) n.getQuoted ('\'', value) || // TODO Need more things recognized before it falls through to getUntilEOS. // n.getDate (context.config.get ("dateformat"), date) || -// need Duration too. +// need OldDuration too. n.getUntilWS (value) || n.getName (value) || n.getUntilEOS (value) || // Redundant? @@ -1599,7 +1599,7 @@ bool A3::is_duration (Nibbler& n, std::string& result) double d; std::string unit; - std::vector units = Duration::get_units (); + std::vector units = OldDuration::get_units (); if (n.getUnsignedNumber (d) && n.getOneOf (units, unit)) diff --git a/src/E9.cpp b/src/E9.cpp index 91e90d60b..b8f8de89e 100644 --- a/src/E9.cpp +++ b/src/E9.cpp @@ -179,9 +179,9 @@ void E9::eval (const Task& task, std::vector & value_stack) if (Date::valid (operand._raw, _dateformat)) operand._value = Date (operand._raw, _dateformat).toEpochString (); - else if (Duration::valid (operand._raw)) + else if (OldDuration::valid (operand._raw)) { - Duration dur (operand._raw); + OldDuration dur (operand._raw); Date now; now += (int)(time_t) dur; operand._value = now.toEpochString (); @@ -196,7 +196,7 @@ void E9::eval (const Task& task, std::vector & value_stack) { operand._category = Arg::cat_literal; operand._value = (operand._raw != "") - ? (std::string)Duration (operand._raw) + ? (std::string)OldDuration (operand._raw) : ""; } else @@ -343,8 +343,8 @@ void E9::operator_lt (Arg& result, Arg& left, Arg& right) result._value = "false"; else { - Duration left_duration (left._value); - Duration right_duration (right._value); + OldDuration left_duration (left._value); + OldDuration right_duration (right._value); result._value = (left_duration < right_duration) ? "true" @@ -408,8 +408,8 @@ void E9::operator_lte (Arg& result, Arg& left, Arg& right) result._value = "false"; else { - Duration left_duration (left._value); - Duration right_duration (right._value); + OldDuration left_duration (left._value); + OldDuration right_duration (right._value); result._value = (left_duration <= right_duration) ? "true" @@ -473,8 +473,8 @@ void E9::operator_gte (Arg& result, Arg& left, Arg& right) result._value = "false"; else { - Duration left_duration (left._value); - Duration right_duration (right._value); + OldDuration left_duration (left._value); + OldDuration right_duration (right._value); result._value = (left_duration >= right_duration) ? "true" @@ -537,8 +537,8 @@ void E9::operator_gt (Arg& result, Arg& left, Arg& right) result._value = "false"; else { - Duration left_duration (left._value); - Duration right_duration (right._value); + OldDuration left_duration (left._value); + OldDuration right_duration (right._value); result._value = result._value = (left_duration > right_duration) ? "true" @@ -807,7 +807,7 @@ const Arg E9::coerce (const Arg& input, const Arg::type type) } // TODO Date - // TODO Duration + // TODO OldDuration else { result = input; diff --git a/src/OldDuration.cpp b/src/OldDuration.cpp index 981f026a2..a6259109d 100644 --- a/src/OldDuration.cpp +++ b/src/OldDuration.cpp @@ -98,21 +98,21 @@ static const char* durations[] = extern Context context; //////////////////////////////////////////////////////////////////////////////// -Duration::Duration () +OldDuration::OldDuration () : _secs (0) , _negative (false) { } //////////////////////////////////////////////////////////////////////////////// -Duration::Duration (const Duration& other) +OldDuration::OldDuration (const OldDuration& other) { _secs = other._secs; _negative = other._negative; } //////////////////////////////////////////////////////////////////////////////// -Duration::Duration (time_t input) +OldDuration::OldDuration (time_t input) { if (input < 0) { @@ -127,7 +127,7 @@ Duration::Duration (time_t input) } //////////////////////////////////////////////////////////////////////////////// -Duration::Duration (const std::string& input) +OldDuration::OldDuration (const std::string& input) : _secs (0) , _negative (false) { @@ -146,13 +146,13 @@ Duration::Duration (const std::string& input) } //////////////////////////////////////////////////////////////////////////////// -Duration::operator time_t () const +OldDuration::operator time_t () const { return _secs; } //////////////////////////////////////////////////////////////////////////////// -Duration::operator std::string () const +OldDuration::operator std::string () const { std::stringstream s; s << (_negative ? - (long) _secs : (long) _secs); @@ -160,7 +160,7 @@ Duration::operator std::string () const } //////////////////////////////////////////////////////////////////////////////// -Duration& Duration::operator= (const Duration& other) +OldDuration& OldDuration::operator= (const OldDuration& other) { if (this != &other) { @@ -172,14 +172,14 @@ Duration& Duration::operator= (const Duration& other) } //////////////////////////////////////////////////////////////////////////////// -Duration Duration::operator- (const Duration& other) +OldDuration OldDuration::operator- (const OldDuration& other) { int left = _secs * ( _negative ? -1 : 1); int right = other._secs * (other._negative ? -1 : 1); left -= right; - Duration result; + OldDuration result; result._secs = abs (left); result._negative = left < 0; @@ -187,14 +187,14 @@ Duration Duration::operator- (const Duration& other) } //////////////////////////////////////////////////////////////////////////////// -Duration Duration::operator+ (const Duration& other) +OldDuration OldDuration::operator+ (const OldDuration& other) { int left = _secs * ( _negative ? -1 : 1); int right = other._secs * (other._negative ? -1 : 1); left += right; - Duration result; + OldDuration result; result._secs = abs (left); result._negative = left < 0; @@ -202,7 +202,7 @@ Duration Duration::operator+ (const Duration& other) } //////////////////////////////////////////////////////////////////////////////// -Duration& Duration::operator-= (const Duration& other) +OldDuration& OldDuration::operator-= (const OldDuration& other) { int left = _secs * ( _negative ? -1 : 1); int right = other._secs * (other._negative ? -1 : 1); @@ -216,7 +216,7 @@ Duration& Duration::operator-= (const Duration& other) } //////////////////////////////////////////////////////////////////////////////// -Duration& Duration::operator+= (const Duration& other) +OldDuration& OldDuration::operator+= (const OldDuration& other) { int left = _secs * ( _negative ? -1 : 1); int right = other._secs * (other._negative ? -1 : 1); @@ -230,7 +230,7 @@ Duration& Duration::operator+= (const Duration& other) } //////////////////////////////////////////////////////////////////////////////// -std::string Duration::format () const +std::string OldDuration::format () const { char formatted[24]; float days = (float) _secs / 86400.0; @@ -268,7 +268,7 @@ std::string Duration::format () const } //////////////////////////////////////////////////////////////////////////////// -std::string Duration::formatCompact () const +std::string OldDuration::formatCompact () const { char formatted[24]; float days = (float) _secs / 86400.0; @@ -286,7 +286,7 @@ std::string Duration::formatCompact () const } //////////////////////////////////////////////////////////////////////////////// -std::string Duration::formatPrecise () const +std::string OldDuration::formatPrecise () const { char formatted[24]; @@ -303,7 +303,7 @@ std::string Duration::formatPrecise () const //////////////////////////////////////////////////////////////////////////////// -std::string Duration::formatSeconds () const +std::string OldDuration::formatSeconds () const { char formatted[24]; sprintf (formatted, "%s%llusec", (_negative ? "-" : ""), (unsigned long long)_secs); @@ -311,7 +311,7 @@ std::string Duration::formatSeconds () const } //////////////////////////////////////////////////////////////////////////////// -bool Duration::operator< (const Duration& other) +bool OldDuration::operator< (const OldDuration& other) { long left = (long) ( _negative ? -_secs : _secs); long right = (long) (other._negative ? -other._secs : other._secs); @@ -320,7 +320,7 @@ bool Duration::operator< (const Duration& other) } //////////////////////////////////////////////////////////////////////////////// -bool Duration::operator<= (const Duration& other) +bool OldDuration::operator<= (const OldDuration& other) { long left = (long) ( _negative ? -_secs : _secs); long right = (long) (other._negative ? -other._secs : other._secs); @@ -329,7 +329,7 @@ bool Duration::operator<= (const Duration& other) } //////////////////////////////////////////////////////////////////////////////// -bool Duration::operator> (const Duration& other) +bool OldDuration::operator> (const OldDuration& other) { long left = (long) ( _negative ? -_secs : _secs); long right = (long) (other._negative ? -other._secs : other._secs); @@ -338,7 +338,7 @@ bool Duration::operator> (const Duration& other) } //////////////////////////////////////////////////////////////////////////////// -bool Duration::operator>= (const Duration& other) +bool OldDuration::operator>= (const OldDuration& other) { long left = (long) ( _negative ? -_secs : _secs); long right = (long) (other._negative ? -other._secs : other._secs); @@ -347,18 +347,18 @@ bool Duration::operator>= (const Duration& other) } //////////////////////////////////////////////////////////////////////////////// -Duration::~Duration () +OldDuration::~OldDuration () { } //////////////////////////////////////////////////////////////////////////////// -bool Duration::negative () const +bool OldDuration::negative () const { return _negative; } //////////////////////////////////////////////////////////////////////////////// -bool Duration::valid (const std::string& input) +bool OldDuration::valid (const std::string& input) { std::string lower_input = lowerCase (input); @@ -396,7 +396,7 @@ bool Duration::valid (const std::string& input) } //////////////////////////////////////////////////////////////////////////////// -void Duration::parse (const std::string& input) +void OldDuration::parse (const std::string& input) { std::string lower_input = lowerCase (input); @@ -508,7 +508,7 @@ void Duration::parse (const std::string& input) } //////////////////////////////////////////////////////////////////////////////// -const std::vector Duration::get_units () +const std::vector OldDuration::get_units () { std::vector units; for (unsigned int i = 0; i < NUM_DURATIONS; ++i) diff --git a/src/OldDuration.h b/src/OldDuration.h index 33b9dd5ac..4021a16dd 100644 --- a/src/OldDuration.h +++ b/src/OldDuration.h @@ -25,30 +25,30 @@ // //////////////////////////////////////////////////////////////////////////////// -#ifndef INCLUDED_DURATION -#define INCLUDED_DURATION +#ifndef INCLUDED_OLD_DURATION +#define INCLUDED_OLD_DURATION #include #include #include -class Duration +class OldDuration { public: - Duration (); // Default constructor - Duration (const Duration&); // Copy constructor - Duration (time_t); // Constructor - Duration (const std::string&); // Parse - bool operator< (const Duration&); - bool operator<= (const Duration&); - bool operator> (const Duration&); - bool operator>= (const Duration&); - Duration& operator= (const Duration&); - Duration operator- (const Duration&); - Duration operator+ (const Duration&); - Duration& operator-= (const Duration&); - Duration& operator+= (const Duration&); - ~Duration (); // Destructor + OldDuration (); // Default constructor + OldDuration (const OldDuration&); // Copy constructor + OldDuration (time_t); // Constructor + OldDuration (const std::string&); // Parse + bool operator< (const OldDuration&); + bool operator<= (const OldDuration&); + bool operator> (const OldDuration&); + bool operator>= (const OldDuration&); + OldDuration& operator= (const OldDuration&); + OldDuration operator- (const OldDuration&); + OldDuration operator+ (const OldDuration&); + OldDuration& operator-= (const OldDuration&); + OldDuration& operator+= (const OldDuration&); + ~OldDuration (); // Destructor operator time_t () const; operator std::string () const; diff --git a/src/Task.cpp b/src/Task.cpp index bf3e5681b..2091deefd 100644 --- a/src/Task.cpp +++ b/src/Task.cpp @@ -1287,7 +1287,7 @@ void Task::validate (bool applyDefault /* = true */) // Recur durations must be valid. if (has ("recur")) { - Duration d; + OldDuration d; if (! d.valid (get ("recur"))) throw std::string (format (STRING_TASK_VALID_RECUR, get ("recur"))); } diff --git a/src/columns/ColDate.cpp b/src/columns/ColDate.cpp index abb48e790..ae4217cb4 100644 --- a/src/columns/ColDate.cpp +++ b/src/columns/ColDate.cpp @@ -56,7 +56,7 @@ ColumnDate::ColumnDate () _examples.push_back (format (now.toJulian (), 13, 12)); _examples.push_back (now.toEpochString ()); _examples.push_back (now.toISO ()); - _examples.push_back (Duration (Date () - now).formatCompact ()); + _examples.push_back (OldDuration (Date () - now).formatCompact ()); } //////////////////////////////////////////////////////////////////////////////// @@ -99,7 +99,7 @@ void ColumnDate::measure (Task& task, unsigned int& minimum, unsigned int& maxim { Date date ((time_t) strtol (task.get (_name).c_str (), NULL, 10)); Date now; - minimum = maximum = Duration (now - date).format ().length (); + minimum = maximum = OldDuration (now - date).format ().length (); } else if (_style == "julian") { @@ -116,7 +116,7 @@ void ColumnDate::measure (Task& task, unsigned int& minimum, unsigned int& maxim else if (_style == "age") { Date now; - minimum = maximum = Duration (now - date).formatCompact ().length (); + minimum = maximum = OldDuration (now - date).formatCompact ().length (); } else throw format (STRING_COLUMN_BAD_FORMAT, _name, _style); @@ -159,7 +159,7 @@ void ColumnDate::render ( lines.push_back ( color.colorize ( rightJustify ( - Duration (now - date).format (), width))); + OldDuration (now - date).format (), width))); } else if (_style == "julian") { @@ -193,7 +193,7 @@ void ColumnDate::render ( lines.push_back ( color.colorize ( leftJustify ( - Duration (now - date).formatCompact (), width))); + OldDuration (now - date).formatCompact (), width))); } } } diff --git a/src/columns/ColDue.cpp b/src/columns/ColDue.cpp index fb892f1d6..0528b24f4 100644 --- a/src/columns/ColDue.cpp +++ b/src/columns/ColDue.cpp @@ -45,7 +45,7 @@ ColumnDue::ColumnDue () Date now; now += 125; - _examples.push_back (Duration (now - Date ()).formatCompact ()); + _examples.push_back (OldDuration (now - Date ()).formatCompact ()); } //////////////////////////////////////////////////////////////////////////////// diff --git a/src/columns/ColRecur.cpp b/src/columns/ColRecur.cpp index fa92a339d..843f8909f 100644 --- a/src/columns/ColRecur.cpp +++ b/src/columns/ColRecur.cpp @@ -81,7 +81,7 @@ void ColumnRecur::measure (Task& task, unsigned int& minimum, unsigned int& maxi if (_style == "default" || _style == "duration") { - minimum = maximum = Duration (task.get ("recur")).formatCompact ().length (); + minimum = maximum = OldDuration (task.get ("recur")).formatCompact ().length (); } else if (_style == "indicator") { @@ -105,7 +105,7 @@ void ColumnRecur::render ( lines.push_back ( color.colorize ( rightJustify ( - Duration (task.get ("recur")).formatCompact (), + OldDuration (task.get ("recur")).formatCompact (), width))); } else if (_style == "indicator") diff --git a/src/columns/ColScheduled.cpp b/src/columns/ColScheduled.cpp index dbd7a2c45..91180546c 100644 --- a/src/columns/ColScheduled.cpp +++ b/src/columns/ColScheduled.cpp @@ -45,7 +45,7 @@ ColumnScheduled::ColumnScheduled () Date now; now += 125; - _examples.push_back (Duration (now - Date ()).formatCompact ()); + _examples.push_back (OldDuration (now - Date ()).formatCompact ()); } //////////////////////////////////////////////////////////////////////////////// diff --git a/src/columns/ColUDA.cpp b/src/columns/ColUDA.cpp index acb58841c..839916bb8 100644 --- a/src/columns/ColUDA.cpp +++ b/src/columns/ColUDA.cpp @@ -102,7 +102,7 @@ void ColumnUDA::measure (Task& task, unsigned int& minimum, unsigned int& maximu } else if (_type == "duration") { - minimum = maximum = utf8_width (Duration (value).formatCompact ()); + minimum = maximum = utf8_width (OldDuration (value).formatCompact ()); } else if (_type == "string") { @@ -155,7 +155,7 @@ void ColumnUDA::render ( lines.push_back ( color.colorize ( rightJustify ( - Duration (value).formatCompact (), + OldDuration (value).formatCompact (), width))); } else if (_type == "string") diff --git a/src/commands/CmdBurndown.cpp b/src/commands/CmdBurndown.cpp index f76abff70..55d97d425 100644 --- a/src/commands/CmdBurndown.cpp +++ b/src/commands/CmdBurndown.cpp @@ -933,7 +933,7 @@ void Chart::calculateRates (std::vector & sequence) int remaining_days = (int) (current_pending / (fix_rate - find_rate)); Date now; - Duration delta (remaining_days * 86400); + OldDuration delta (remaining_days * 86400); now += delta; completion = now.toString (context.config.get ("dateformat")) diff --git a/src/commands/CmdEdit.cpp b/src/commands/CmdEdit.cpp index 57df4e2d1..4bbb948f5 100644 --- a/src/commands/CmdEdit.cpp +++ b/src/commands/CmdEdit.cpp @@ -149,7 +149,7 @@ std::string CmdEdit::formatDuration ( std::string value = task.get (attribute); if (value.length ()) { - Duration dur (value); + OldDuration dur (value); value = dur.formatSeconds (); } @@ -534,7 +534,7 @@ void CmdEdit::parseTask (Task& task, const std::string& after, const std::string { if (value != "") { - Duration d; + OldDuration d; if (d.valid (value)) { context.footnote (STRING_EDIT_RECUR_MOD); @@ -710,7 +710,7 @@ void CmdEdit::parseTask (Task& task, const std::string& after, const std::string } else if (type == "duration") { - Duration d (value); + OldDuration d (value); task.set (col->first, (time_t) d); } } diff --git a/src/commands/CmdInfo.cpp b/src/commands/CmdInfo.cpp index 7612f25dd..3db4a9bdc 100644 --- a/src/commands/CmdInfo.cpp +++ b/src/commands/CmdInfo.cpp @@ -293,7 +293,7 @@ int CmdInfo::execute (std::string& output) if (created.length ()) { Date dt (strtol (created.c_str (), NULL, 10)); - age = Duration (now - dt).format (); + age = OldDuration (now - dt).format (); } view.set (row, 1, entry + " (" + age + ")"); @@ -311,7 +311,7 @@ int CmdInfo::execute (std::string& output) Date mod (task->get_date ("modified")); - std::string age = Duration (now - mod).format (); + std::string age = OldDuration (now - mod).format (); view.set (row, 1, Date (task->get_date ("modified")).toString (dateformat) + " (" + age + ")"); } @@ -337,7 +337,7 @@ int CmdInfo::execute (std::string& output) if (type == "date") value = Date (value).toString (dateformat); else if (type == "duration") - value = Duration (value).formatCompact (); + value = OldDuration (value).formatCompact (); view.set (row, 1, value); } @@ -433,7 +433,7 @@ int CmdInfo::execute (std::string& output) { row = journal.addRow (); journal.set (row, 0, STRING_CMD_INFO_TOTAL_ACTIVE); - journal.set (row, 1, Duration (total_time).formatPrecise (), + journal.set (row, 1, OldDuration (total_time).formatPrecise (), (context.color () ? Color ("bold") : Color ())); } } diff --git a/src/commands/CmdStats.cpp b/src/commands/CmdStats.cpp index afd22a88e..ec76a9e90 100644 --- a/src/commands/CmdStats.cpp +++ b/src/commands/CmdStats.cpp @@ -238,35 +238,35 @@ int CmdStats::execute (std::string& output) row = view.addRow (); view.set (row, 0, STRING_CMD_STATS_USED_FOR); - view.set (row, 1, Duration (latest - earliest).format ()); + view.set (row, 1, OldDuration (latest - earliest).format ()); } if (totalT) { row = view.addRow (); view.set (row, 0, STRING_CMD_STATS_ADD_EVERY); - view.set (row, 1, Duration (((latest - earliest) / totalT)).format ()); + view.set (row, 1, OldDuration (((latest - earliest) / totalT)).format ()); } if (completedT) { row = view.addRow (); view.set (row, 0, STRING_CMD_STATS_COMP_EVERY); - view.set (row, 1, Duration ((latest - earliest) / completedT).format ()); + view.set (row, 1, OldDuration ((latest - earliest) / completedT).format ()); } if (deletedT) { row = view.addRow (); view.set (row, 0, STRING_CMD_STATS_DEL_EVERY); - view.set (row, 1, Duration ((latest - earliest) / deletedT).format ()); + view.set (row, 1, OldDuration ((latest - earliest) / deletedT).format ()); } if (pendingT || completedT) { row = view.addRow (); view.set (row, 0, STRING_CMD_STATS_AVG_PEND); - view.set (row, 1, Duration ((int) ((daysPending / (pendingT + completedT)) * 86400)).format ()); + view.set (row, 1, OldDuration ((int) ((daysPending / (pendingT + completedT)) * 86400)).format ()); } if (totalT) diff --git a/src/commands/CmdSummary.cpp b/src/commands/CmdSummary.cpp index 2466b587e..5b5ed6aac 100644 --- a/src/commands/CmdSummary.cpp +++ b/src/commands/CmdSummary.cpp @@ -159,7 +159,7 @@ int CmdSummary::execute (std::string& output) view.set (row, 1, countPending[i->first]); if (counter[i->first]) - view.set (row, 2, Duration ((int) (sumEntry[i->first] / (double)counter[i->first])).format ()); + view.set (row, 2, OldDuration ((int) (sumEntry[i->first] / (double)counter[i->first])).format ()); int c = countCompleted[i->first]; int p = countPending[i->first]; diff --git a/src/commands/Command.cpp b/src/commands/Command.cpp index e3d2939ee..bd68267fb 100644 --- a/src/commands/Command.cpp +++ b/src/commands/Command.cpp @@ -552,7 +552,7 @@ void Command::modify_task ( long l = (long) strtod (result.c_str (), NULL); if (labs (l) < 5 * 365 * 86400) { - Duration dur (value); + OldDuration dur (value); Date now; now += l; task.set (name, now.toEpochString ()); @@ -564,7 +564,7 @@ void Command::modify_task ( } } - // Durations too. + // OldDurations too. else if (name == "recur" || column->type () == "duration") { @@ -577,7 +577,7 @@ void Command::modify_task ( std::string result = e.evalExpression (task); context.debug (std::string ("Eval '") + value + "' --> '" + result + "'"); - Duration d (value); + OldDuration d (value); // Deliberately storing the 'raw' value, which is necessary for // durations like 'weekday'.. diff --git a/src/feedback.cpp b/src/feedback.cpp index 0730ca856..ea238c2ed 100644 --- a/src/feedback.cpp +++ b/src/feedback.cpp @@ -207,7 +207,7 @@ std::string taskInfoDifferences (const Task& before, const Task& after, const st else if (*name == "start") { out << format (STRING_FEEDBACK_ATT_DEL_DUR, ucFirst (*name), - Duration(current_timestamp - last_timestamp).formatPrecise()) + OldDuration(current_timestamp - last_timestamp).formatPrecise()) << "\n"; } else diff --git a/src/recur.cpp b/src/recur.cpp index bbd66266c..a4ba01bbc 100644 --- a/src/recur.cpp +++ b/src/recur.cpp @@ -337,7 +337,7 @@ Date getNextRecurrence (Date& current, std::string& period) // If the period is an 'easy' one, add it to current, and we're done. // If it throws an error, the duration was not recognized. int secs = 0; - Duration du (period); + OldDuration du (period); secs = du; return current + secs; diff --git a/src/sort.cpp b/src/sort.cpp index a3c8de676..51ae312d3 100644 --- a/src/sort.cpp +++ b/src/sort.cpp @@ -218,8 +218,8 @@ static bool sort_compare (int left, int right) if (left_string == right_string) continue; - Duration left_duration (left_string); - Duration right_duration (right_string); + OldDuration left_duration (left_string); + OldDuration right_duration (right_string); return ascending ? (left_duration < right_duration) : (left_duration > right_duration); } @@ -269,8 +269,8 @@ static bool sort_compare (int left, int right) if (left_string == right_string) continue; - Duration left_duration (left_string); - Duration right_duration (right_string); + OldDuration left_duration (left_string); + OldDuration right_duration (right_string); return ascending ? (left_duration < right_duration) : (left_duration > right_duration); } diff --git a/test/old_duration.t.cpp b/test/old_duration.t.cpp index caf6a9c53..d7871ca09 100644 --- a/test/old_duration.t.cpp +++ b/test/old_duration.t.cpp @@ -42,7 +42,7 @@ Context context; int convertDuration (const std::string& input) { - try { Duration d (input); return ((int) d) / 86400; } + try { OldDuration d (input); return ((int) d) / 86400; } catch (...) {} return 0; } @@ -51,485 +51,485 @@ int main (int argc, char** argv) { UnitTest t (644); - Duration d; + OldDuration d; // std::string format (); - d = Duration (0); t.is (d.format (), "-", "0 -> -"); // 1 - d = Duration (1); t.is (d.format (), "1 sec", "1 -> 1 sec"); - d = Duration (2); t.is (d.format (), "2 secs", "2 -> 2 secs"); - d = Duration (59); t.is (d.format (), "59 secs", "59 -> 59 secs"); - d = Duration (60); t.is (d.format (), "1 min", "60 -> 1 min"); - d = Duration (119); t.is (d.format (), "1 min", "119 -> 1 min"); - d = Duration (120); t.is (d.format (), "2 mins", "120 -> 2 mins"); - d = Duration (121); t.is (d.format (), "2 mins", "121 -> 2 mins"); - d = Duration (3599); t.is (d.format (), "59 mins", "3599 -> 59 mins"); - d = Duration (3600); t.is (d.format (), "1 hr", "3600 -> 1 hr"); - d = Duration (3601); t.is (d.format (), "1 hr", "3601 -> 1 hr"); - d = Duration (86399); t.is (d.format (), "23 hrs", "86399 -> 23 hrs"); - d = Duration (86400); t.is (d.format (), "1 day", "86400 -> 1 day"); - d = Duration (86401); t.is (d.format (), "1 day", "86401 -> 1 day"); - d = Duration (14 * 86400 - 1); t.is (d.format (), "1 wk", "14 days - 1 sec -> 1 wk"); - d = Duration (14 * 86400); t.is (d.format (), "2 wks", "14 days -> 2 wks"); - d = Duration (14 * 86400 + 1); t.is (d.format (), "2 wks", "14 days + 1 sec -> 2 wks"); - d = Duration (85 * 86400 - 1); t.is (d.format (), "2 mths", "85 days - 1 sec -> 2 mths"); - d = Duration (85 * 86400); t.is (d.format (), "2 mths", "85 days -> 2 mths"); - d = Duration (85 * 86400 + 1); t.is (d.format (), "2 mths", "85 days + 1 sec -> 2 mths"); - d = Duration (365 * 86400 - 1); t.is (d.format (), "12 mths", "365 days - 1 sec -> 12 mths"); - d = Duration (365 * 86400); t.is (d.format (), "1.0 yrs", "365 days -> 1.0 yrs"); - d = Duration (365 * 86400 + 1); t.is (d.format (), "1.0 yrs", "365 days + 1 sec -> 1.0 yrs"); + d = OldDuration (0); t.is (d.format (), "-", "0 -> -"); // 1 + d = OldDuration (1); t.is (d.format (), "1 sec", "1 -> 1 sec"); + d = OldDuration (2); t.is (d.format (), "2 secs", "2 -> 2 secs"); + d = OldDuration (59); t.is (d.format (), "59 secs", "59 -> 59 secs"); + d = OldDuration (60); t.is (d.format (), "1 min", "60 -> 1 min"); + d = OldDuration (119); t.is (d.format (), "1 min", "119 -> 1 min"); + d = OldDuration (120); t.is (d.format (), "2 mins", "120 -> 2 mins"); + d = OldDuration (121); t.is (d.format (), "2 mins", "121 -> 2 mins"); + d = OldDuration (3599); t.is (d.format (), "59 mins", "3599 -> 59 mins"); + d = OldDuration (3600); t.is (d.format (), "1 hr", "3600 -> 1 hr"); + d = OldDuration (3601); t.is (d.format (), "1 hr", "3601 -> 1 hr"); + d = OldDuration (86399); t.is (d.format (), "23 hrs", "86399 -> 23 hrs"); + d = OldDuration (86400); t.is (d.format (), "1 day", "86400 -> 1 day"); + d = OldDuration (86401); t.is (d.format (), "1 day", "86401 -> 1 day"); + d = OldDuration (14 * 86400 - 1); t.is (d.format (), "1 wk", "14 days - 1 sec -> 1 wk"); + d = OldDuration (14 * 86400); t.is (d.format (), "2 wks", "14 days -> 2 wks"); + d = OldDuration (14 * 86400 + 1); t.is (d.format (), "2 wks", "14 days + 1 sec -> 2 wks"); + d = OldDuration (85 * 86400 - 1); t.is (d.format (), "2 mths", "85 days - 1 sec -> 2 mths"); + d = OldDuration (85 * 86400); t.is (d.format (), "2 mths", "85 days -> 2 mths"); + d = OldDuration (85 * 86400 + 1); t.is (d.format (), "2 mths", "85 days + 1 sec -> 2 mths"); + d = OldDuration (365 * 86400 - 1); t.is (d.format (), "12 mths", "365 days - 1 sec -> 12 mths"); + d = OldDuration (365 * 86400); t.is (d.format (), "1.0 yrs", "365 days -> 1.0 yrs"); + d = OldDuration (365 * 86400 + 1); t.is (d.format (), "1.0 yrs", "365 days + 1 sec -> 1.0 yrs"); // std::string formatCompact (); - d = Duration (0); t.is (d.formatCompact (), "", "0 ->"); // 24 - d = Duration (1), t.is (d.formatCompact (), "1s", "1 -> 1s"); - d = Duration (2), t.is (d.formatCompact (), "2s", "2 -> 2s"); - d = Duration (59), t.is (d.formatCompact (), "59s", "59 -> 59s"); - d = Duration (60), t.is (d.formatCompact (), "1m", "60 -> 1m"); - d = Duration (119), t.is (d.formatCompact (), "1m", "119 -> 1m"); - d = Duration (120), t.is (d.formatCompact (), "2m", "120 -> 2m"); - d = Duration (121), t.is (d.formatCompact (), "2m", "121 -> 2m"); - d = Duration (3599), t.is (d.formatCompact (), "59m", "3599 -> 59m"); - d = Duration (3600), t.is (d.formatCompact (), "1h", "3600 -> 1h"); - d = Duration (3601), t.is (d.formatCompact (), "1h", "3601 -> 1h"); - d = Duration (86399), t.is (d.formatCompact (), "23h", "86399 -> 23h"); - d = Duration (86400), t.is (d.formatCompact (), "1d", "86400 -> 1d"); - d = Duration (86401), t.is (d.formatCompact (), "1d", "86401 -> 1d"); - d = Duration (14 * 86400 - 1), t.is (d.formatCompact (), "1wk", "14 days - 1 sec -> 1wk"); - d = Duration (14 * 86400), t.is (d.formatCompact (), "2wk", "14 days -> 2wk"); - d = Duration (14 * 86400 + 1), t.is (d.formatCompact (), "2wk", "14 days + 1 sec -> 2wk"); - d = Duration (85 * 86400 - 1), t.is (d.formatCompact (), "2mo", "85 days - 1 sec -> 2mo"); - d = Duration (85 * 86400), t.is (d.formatCompact (), "2mo", "85 days -> 2mo"); - d = Duration (85 * 86400 + 1), t.is (d.formatCompact (), "2mo", "85 days + 1 sec -> 2mo"); - d = Duration (365 * 86400 - 1), t.is (d.formatCompact (), "12mo", "365 days - 1 sec -> 12mo"); - d = Duration (365 * 86400), t.is (d.formatCompact (), "1.0y", "365 days -> 1.0y"); - d = Duration (365 * 86400 + 1), t.is (d.formatCompact (), "1.0y", "365 days + 1 sec -> 1.0y"); + d = OldDuration (0); t.is (d.formatCompact (), "", "0 ->"); // 24 + d = OldDuration (1), t.is (d.formatCompact (), "1s", "1 -> 1s"); + d = OldDuration (2), t.is (d.formatCompact (), "2s", "2 -> 2s"); + d = OldDuration (59), t.is (d.formatCompact (), "59s", "59 -> 59s"); + d = OldDuration (60), t.is (d.formatCompact (), "1m", "60 -> 1m"); + d = OldDuration (119), t.is (d.formatCompact (), "1m", "119 -> 1m"); + d = OldDuration (120), t.is (d.formatCompact (), "2m", "120 -> 2m"); + d = OldDuration (121), t.is (d.formatCompact (), "2m", "121 -> 2m"); + d = OldDuration (3599), t.is (d.formatCompact (), "59m", "3599 -> 59m"); + d = OldDuration (3600), t.is (d.formatCompact (), "1h", "3600 -> 1h"); + d = OldDuration (3601), t.is (d.formatCompact (), "1h", "3601 -> 1h"); + d = OldDuration (86399), t.is (d.formatCompact (), "23h", "86399 -> 23h"); + d = OldDuration (86400), t.is (d.formatCompact (), "1d", "86400 -> 1d"); + d = OldDuration (86401), t.is (d.formatCompact (), "1d", "86401 -> 1d"); + d = OldDuration (14 * 86400 - 1), t.is (d.formatCompact (), "1wk", "14 days - 1 sec -> 1wk"); + d = OldDuration (14 * 86400), t.is (d.formatCompact (), "2wk", "14 days -> 2wk"); + d = OldDuration (14 * 86400 + 1), t.is (d.formatCompact (), "2wk", "14 days + 1 sec -> 2wk"); + d = OldDuration (85 * 86400 - 1), t.is (d.formatCompact (), "2mo", "85 days - 1 sec -> 2mo"); + d = OldDuration (85 * 86400), t.is (d.formatCompact (), "2mo", "85 days -> 2mo"); + d = OldDuration (85 * 86400 + 1), t.is (d.formatCompact (), "2mo", "85 days + 1 sec -> 2mo"); + d = OldDuration (365 * 86400 - 1), t.is (d.formatCompact (), "12mo", "365 days - 1 sec -> 12mo"); + d = OldDuration (365 * 86400), t.is (d.formatCompact (), "1.0y", "365 days -> 1.0y"); + d = OldDuration (365 * 86400 + 1), t.is (d.formatCompact (), "1.0y", "365 days + 1 sec -> 1.0y"); // std::string formatPrecise (); - d = Duration (0); t.is (d.formatPrecise (), "0:00:00", "0 -> 0:00:00"); // 47 - d = Duration (1); t.is (d.formatPrecise (), "0:00:01", "1 -> 0:00:01"); - d = Duration (2); t.is (d.formatPrecise (), "0:00:02", "2 -> 0:00:02"); - d = Duration (59); t.is (d.formatPrecise (), "0:00:59", "59 -> 0:00:59"); - d = Duration (60); t.is (d.formatPrecise (), "0:01:00", "60 -> 0:01;00"); - d = Duration (119); t.is (d.formatPrecise (), "0:01:59", "119 -> 0:01:59"); - d = Duration (120); t.is (d.formatPrecise (), "0:02:00", "120 -> 0:02:00"); - d = Duration (121); t.is (d.formatPrecise (), "0:02:01", "121 -> 0:02:01"); - d = Duration (3599); t.is (d.formatPrecise (), "0:59:59", "3599 -> 0:59:59"); - d = Duration (3600); t.is (d.formatPrecise (), "1:00:00", "3600 -> 1:00:00"); - d = Duration (3601); t.is (d.formatPrecise (), "1:00:01", "3601 -> 1:00:01"); - d = Duration (86399); t.is (d.formatPrecise (), "23:59:59", "86399 -> 23:59:59"); - d = Duration (86400); t.is (d.formatPrecise (), "1d 0:00:00", "86400 -> 1d 0:00:00"); - d = Duration (86401); t.is (d.formatPrecise (), "1d 0:00:01", "86401 -> 1d 0:00:01"); - d = Duration (14 * 86400 - 1); t.is (d.formatPrecise (), "13d 23:59:59", "(14 x 86400) - 1 sec -> 13d 23:59:59"); - d = Duration (14 * 86400); t.is (d.formatPrecise (), "14d 0:00:00", "(14 x 86400) -> 14d 0:00:00"); - d = Duration (14 * 86400 + 1); t.is (d.formatPrecise (), "14d 0:00:01", "(14 x 86400) + 1 -> 14d 0:00:01"); - d = Duration (365 * 86400 - 1); t.is (d.formatPrecise (), "364d 23:59:59", "365 days - 1 sec -> 364d 23:59:59"); - d = Duration (365 * 86400); t.is (d.formatPrecise (), "365d 0:00:00", "365 days -> 365d 0:00:00"); - d = Duration (365 * 86400 + 1); t.is (d.formatPrecise (), "365d 0:00:01", "365 days + 1 sec -> 365d 0:00:01"); + d = OldDuration (0); t.is (d.formatPrecise (), "0:00:00", "0 -> 0:00:00"); // 47 + d = OldDuration (1); t.is (d.formatPrecise (), "0:00:01", "1 -> 0:00:01"); + d = OldDuration (2); t.is (d.formatPrecise (), "0:00:02", "2 -> 0:00:02"); + d = OldDuration (59); t.is (d.formatPrecise (), "0:00:59", "59 -> 0:00:59"); + d = OldDuration (60); t.is (d.formatPrecise (), "0:01:00", "60 -> 0:01;00"); + d = OldDuration (119); t.is (d.formatPrecise (), "0:01:59", "119 -> 0:01:59"); + d = OldDuration (120); t.is (d.formatPrecise (), "0:02:00", "120 -> 0:02:00"); + d = OldDuration (121); t.is (d.formatPrecise (), "0:02:01", "121 -> 0:02:01"); + d = OldDuration (3599); t.is (d.formatPrecise (), "0:59:59", "3599 -> 0:59:59"); + d = OldDuration (3600); t.is (d.formatPrecise (), "1:00:00", "3600 -> 1:00:00"); + d = OldDuration (3601); t.is (d.formatPrecise (), "1:00:01", "3601 -> 1:00:01"); + d = OldDuration (86399); t.is (d.formatPrecise (), "23:59:59", "86399 -> 23:59:59"); + d = OldDuration (86400); t.is (d.formatPrecise (), "1d 0:00:00", "86400 -> 1d 0:00:00"); + d = OldDuration (86401); t.is (d.formatPrecise (), "1d 0:00:01", "86401 -> 1d 0:00:01"); + d = OldDuration (14 * 86400 - 1); t.is (d.formatPrecise (), "13d 23:59:59", "(14 x 86400) - 1 sec -> 13d 23:59:59"); + d = OldDuration (14 * 86400); t.is (d.formatPrecise (), "14d 0:00:00", "(14 x 86400) -> 14d 0:00:00"); + d = OldDuration (14 * 86400 + 1); t.is (d.formatPrecise (), "14d 0:00:01", "(14 x 86400) + 1 -> 14d 0:00:01"); + d = OldDuration (365 * 86400 - 1); t.is (d.formatPrecise (), "364d 23:59:59", "365 days - 1 sec -> 364d 23:59:59"); + d = OldDuration (365 * 86400); t.is (d.formatPrecise (), "365d 0:00:00", "365 days -> 365d 0:00:00"); + d = OldDuration (365 * 86400 + 1); t.is (d.formatPrecise (), "365d 0:00:01", "365 days + 1 sec -> 365d 0:00:01"); // Iterate for a whole year. Why? Just to see where the boundaries are, // so that changes can be made with some reference point. - d = Duration ( 1*86400); t.is (d.formatCompact (), "1d", "1*86400 -> 1d"); // 67 - d = Duration ( 2*86400); t.is (d.formatCompact (), "2d", "2*86400 -> 2d"); - d = Duration ( 3*86400); t.is (d.formatCompact (), "3d", "3*86400 -> 3d"); - d = Duration ( 4*86400); t.is (d.formatCompact (), "4d", "4*86400 -> 4d"); - d = Duration ( 5*86400); t.is (d.formatCompact (), "5d", "5*86400 -> 5d"); - d = Duration ( 6*86400); t.is (d.formatCompact (), "6d", "6*86400 -> 6d"); - d = Duration ( 7*86400); t.is (d.formatCompact (), "7d", "7*86400 -> 7d"); - d = Duration ( 8*86400); t.is (d.formatCompact (), "8d", "8*86400 -> 8d"); - d = Duration ( 9*86400); t.is (d.formatCompact (), "9d", "9*86400 -> 9d"); - d = Duration ( 10*86400); t.is (d.formatCompact (), "10d", "10*86400 -> 10d"); + d = OldDuration ( 1*86400); t.is (d.formatCompact (), "1d", "1*86400 -> 1d"); // 67 + d = OldDuration ( 2*86400); t.is (d.formatCompact (), "2d", "2*86400 -> 2d"); + d = OldDuration ( 3*86400); t.is (d.formatCompact (), "3d", "3*86400 -> 3d"); + d = OldDuration ( 4*86400); t.is (d.formatCompact (), "4d", "4*86400 -> 4d"); + d = OldDuration ( 5*86400); t.is (d.formatCompact (), "5d", "5*86400 -> 5d"); + d = OldDuration ( 6*86400); t.is (d.formatCompact (), "6d", "6*86400 -> 6d"); + d = OldDuration ( 7*86400); t.is (d.formatCompact (), "7d", "7*86400 -> 7d"); + d = OldDuration ( 8*86400); t.is (d.formatCompact (), "8d", "8*86400 -> 8d"); + d = OldDuration ( 9*86400); t.is (d.formatCompact (), "9d", "9*86400 -> 9d"); + d = OldDuration ( 10*86400); t.is (d.formatCompact (), "10d", "10*86400 -> 10d"); - d = Duration ( 11*86400); t.is (d.formatCompact (), "11d", "11*86400 -> 11d"); - d = Duration ( 12*86400); t.is (d.formatCompact (), "12d", "12*86400 -> 12d"); - d = Duration ( 13*86400); t.is (d.formatCompact (), "1wk", "13*86400 -> 1wk"); - d = Duration ( 14*86400); t.is (d.formatCompact (), "2wk", "14*86400 -> 2wk"); - d = Duration ( 15*86400); t.is (d.formatCompact (), "2wk", "15*86400 -> 2wk"); - d = Duration ( 16*86400); t.is (d.formatCompact (), "2wk", "16*86400 -> 2wk"); - d = Duration ( 17*86400); t.is (d.formatCompact (), "2wk", "17*86400 -> 2wk"); - d = Duration ( 18*86400); t.is (d.formatCompact (), "2wk", "18*86400 -> 2wk"); - d = Duration ( 19*86400); t.is (d.formatCompact (), "2wk", "19*86400 -> 2wk"); - d = Duration ( 20*86400); t.is (d.formatCompact (), "2wk", "20*86400 -> 2wk"); + d = OldDuration ( 11*86400); t.is (d.formatCompact (), "11d", "11*86400 -> 11d"); + d = OldDuration ( 12*86400); t.is (d.formatCompact (), "12d", "12*86400 -> 12d"); + d = OldDuration ( 13*86400); t.is (d.formatCompact (), "1wk", "13*86400 -> 1wk"); + d = OldDuration ( 14*86400); t.is (d.formatCompact (), "2wk", "14*86400 -> 2wk"); + d = OldDuration ( 15*86400); t.is (d.formatCompact (), "2wk", "15*86400 -> 2wk"); + d = OldDuration ( 16*86400); t.is (d.formatCompact (), "2wk", "16*86400 -> 2wk"); + d = OldDuration ( 17*86400); t.is (d.formatCompact (), "2wk", "17*86400 -> 2wk"); + d = OldDuration ( 18*86400); t.is (d.formatCompact (), "2wk", "18*86400 -> 2wk"); + d = OldDuration ( 19*86400); t.is (d.formatCompact (), "2wk", "19*86400 -> 2wk"); + d = OldDuration ( 20*86400); t.is (d.formatCompact (), "2wk", "20*86400 -> 2wk"); - d = Duration ( 21*86400); t.is (d.formatCompact (), "3wk", "21*86400 -> 3wk"); - d = Duration ( 22*86400); t.is (d.formatCompact (), "3wk", "22*86400 -> 3wk"); - d = Duration ( 23*86400); t.is (d.formatCompact (), "3wk", "23*86400 -> 3wk"); - d = Duration ( 24*86400); t.is (d.formatCompact (), "3wk", "24*86400 -> 3wk"); - d = Duration ( 25*86400); t.is (d.formatCompact (), "3wk", "25*86400 -> 3wk"); - d = Duration ( 26*86400); t.is (d.formatCompact (), "3wk", "26*86400 -> 3wk"); - d = Duration ( 27*86400); t.is (d.formatCompact (), "3wk", "27*86400 -> 3wk"); - d = Duration ( 28*86400); t.is (d.formatCompact (), "4wk", "28*86400 -> 4wk"); - d = Duration ( 29*86400); t.is (d.formatCompact (), "4wk", "29*86400 -> 4wk"); - d = Duration ( 30*86400); t.is (d.formatCompact (), "4wk", "30*86400 -> 4wk"); + d = OldDuration ( 21*86400); t.is (d.formatCompact (), "3wk", "21*86400 -> 3wk"); + d = OldDuration ( 22*86400); t.is (d.formatCompact (), "3wk", "22*86400 -> 3wk"); + d = OldDuration ( 23*86400); t.is (d.formatCompact (), "3wk", "23*86400 -> 3wk"); + d = OldDuration ( 24*86400); t.is (d.formatCompact (), "3wk", "24*86400 -> 3wk"); + d = OldDuration ( 25*86400); t.is (d.formatCompact (), "3wk", "25*86400 -> 3wk"); + d = OldDuration ( 26*86400); t.is (d.formatCompact (), "3wk", "26*86400 -> 3wk"); + d = OldDuration ( 27*86400); t.is (d.formatCompact (), "3wk", "27*86400 -> 3wk"); + d = OldDuration ( 28*86400); t.is (d.formatCompact (), "4wk", "28*86400 -> 4wk"); + d = OldDuration ( 29*86400); t.is (d.formatCompact (), "4wk", "29*86400 -> 4wk"); + d = OldDuration ( 30*86400); t.is (d.formatCompact (), "4wk", "30*86400 -> 4wk"); - d = Duration ( 31*86400); t.is (d.formatCompact (), "4wk", "31*86400 -> 4wk"); - d = Duration ( 32*86400); t.is (d.formatCompact (), "4wk", "32*86400 -> 4wk"); - d = Duration ( 33*86400); t.is (d.formatCompact (), "4wk", "33*86400 -> 4wk"); - d = Duration ( 34*86400); t.is (d.formatCompact (), "4wk", "34*86400 -> 4wk"); - d = Duration ( 35*86400); t.is (d.formatCompact (), "5wk", "35*86400 -> 5wk"); - d = Duration ( 36*86400); t.is (d.formatCompact (), "5wk", "36*86400 -> 5wk"); - d = Duration ( 37*86400); t.is (d.formatCompact (), "5wk", "37*86400 -> 5wk"); - d = Duration ( 38*86400); t.is (d.formatCompact (), "5wk", "38*86400 -> 5wk"); - d = Duration ( 39*86400); t.is (d.formatCompact (), "5wk", "39*86400 -> 5wk"); - d = Duration ( 40*86400); t.is (d.formatCompact (), "5wk", "40*86400 -> 5wk"); + d = OldDuration ( 31*86400); t.is (d.formatCompact (), "4wk", "31*86400 -> 4wk"); + d = OldDuration ( 32*86400); t.is (d.formatCompact (), "4wk", "32*86400 -> 4wk"); + d = OldDuration ( 33*86400); t.is (d.formatCompact (), "4wk", "33*86400 -> 4wk"); + d = OldDuration ( 34*86400); t.is (d.formatCompact (), "4wk", "34*86400 -> 4wk"); + d = OldDuration ( 35*86400); t.is (d.formatCompact (), "5wk", "35*86400 -> 5wk"); + d = OldDuration ( 36*86400); t.is (d.formatCompact (), "5wk", "36*86400 -> 5wk"); + d = OldDuration ( 37*86400); t.is (d.formatCompact (), "5wk", "37*86400 -> 5wk"); + d = OldDuration ( 38*86400); t.is (d.formatCompact (), "5wk", "38*86400 -> 5wk"); + d = OldDuration ( 39*86400); t.is (d.formatCompact (), "5wk", "39*86400 -> 5wk"); + d = OldDuration ( 40*86400); t.is (d.formatCompact (), "5wk", "40*86400 -> 5wk"); - d = Duration ( 41*86400); t.is (d.formatCompact (), "5wk", "41*86400 -> 5wk"); - d = Duration ( 42*86400); t.is (d.formatCompact (), "6wk", "42*86400 -> 6wk"); - d = Duration ( 43*86400); t.is (d.formatCompact (), "6wk", "43*86400 -> 6wk"); - d = Duration ( 44*86400); t.is (d.formatCompact (), "6wk", "44*86400 -> 6wk"); - d = Duration ( 45*86400); t.is (d.formatCompact (), "6wk", "45*86400 -> 6wk"); - d = Duration ( 46*86400); t.is (d.formatCompact (), "6wk", "46*86400 -> 6wk"); - d = Duration ( 47*86400); t.is (d.formatCompact (), "6wk", "47*86400 -> 6wk"); - d = Duration ( 48*86400); t.is (d.formatCompact (), "6wk", "48*86400 -> 6wk"); - d = Duration ( 49*86400); t.is (d.formatCompact (), "7wk", "49*86400 -> 7wk"); - d = Duration ( 50*86400); t.is (d.formatCompact (), "7wk", "50*86400 -> 7wk"); + d = OldDuration ( 41*86400); t.is (d.formatCompact (), "5wk", "41*86400 -> 5wk"); + d = OldDuration ( 42*86400); t.is (d.formatCompact (), "6wk", "42*86400 -> 6wk"); + d = OldDuration ( 43*86400); t.is (d.formatCompact (), "6wk", "43*86400 -> 6wk"); + d = OldDuration ( 44*86400); t.is (d.formatCompact (), "6wk", "44*86400 -> 6wk"); + d = OldDuration ( 45*86400); t.is (d.formatCompact (), "6wk", "45*86400 -> 6wk"); + d = OldDuration ( 46*86400); t.is (d.formatCompact (), "6wk", "46*86400 -> 6wk"); + d = OldDuration ( 47*86400); t.is (d.formatCompact (), "6wk", "47*86400 -> 6wk"); + d = OldDuration ( 48*86400); t.is (d.formatCompact (), "6wk", "48*86400 -> 6wk"); + d = OldDuration ( 49*86400); t.is (d.formatCompact (), "7wk", "49*86400 -> 7wk"); + d = OldDuration ( 50*86400); t.is (d.formatCompact (), "7wk", "50*86400 -> 7wk"); - d = Duration ( 51*86400); t.is (d.formatCompact (), "7wk", "51*86400 -> 7wk"); - d = Duration ( 52*86400); t.is (d.formatCompact (), "7wk", "52*86400 -> 7wk"); - d = Duration ( 53*86400); t.is (d.formatCompact (), "7wk", "53*86400 -> 7wk"); - d = Duration ( 54*86400); t.is (d.formatCompact (), "7wk", "54*86400 -> 7wk"); - d = Duration ( 55*86400); t.is (d.formatCompact (), "7wk", "55*86400 -> 7wk"); - d = Duration ( 56*86400); t.is (d.formatCompact (), "8wk", "56*86400 -> 8wk"); - d = Duration ( 57*86400); t.is (d.formatCompact (), "8wk", "57*86400 -> 8wk"); - d = Duration ( 58*86400); t.is (d.formatCompact (), "8wk", "58*86400 -> 8wk"); - d = Duration ( 59*86400); t.is (d.formatCompact (), "8wk", "59*86400 -> 8wk"); - d = Duration ( 60*86400); t.is (d.formatCompact (), "8wk", "60*86400 -> 8wk"); + d = OldDuration ( 51*86400); t.is (d.formatCompact (), "7wk", "51*86400 -> 7wk"); + d = OldDuration ( 52*86400); t.is (d.formatCompact (), "7wk", "52*86400 -> 7wk"); + d = OldDuration ( 53*86400); t.is (d.formatCompact (), "7wk", "53*86400 -> 7wk"); + d = OldDuration ( 54*86400); t.is (d.formatCompact (), "7wk", "54*86400 -> 7wk"); + d = OldDuration ( 55*86400); t.is (d.formatCompact (), "7wk", "55*86400 -> 7wk"); + d = OldDuration ( 56*86400); t.is (d.formatCompact (), "8wk", "56*86400 -> 8wk"); + d = OldDuration ( 57*86400); t.is (d.formatCompact (), "8wk", "57*86400 -> 8wk"); + d = OldDuration ( 58*86400); t.is (d.formatCompact (), "8wk", "58*86400 -> 8wk"); + d = OldDuration ( 59*86400); t.is (d.formatCompact (), "8wk", "59*86400 -> 8wk"); + d = OldDuration ( 60*86400); t.is (d.formatCompact (), "8wk", "60*86400 -> 8wk"); - d = Duration ( 61*86400); t.is (d.formatCompact (), "8wk", "61*86400 -> 8wk"); - d = Duration ( 62*86400); t.is (d.formatCompact (), "8wk", "62*86400 -> 8wk"); - d = Duration ( 63*86400); t.is (d.formatCompact (), "9wk", "63*86400 -> 9wk"); - d = Duration ( 64*86400); t.is (d.formatCompact (), "9wk", "64*86400 -> 9wk"); - d = Duration ( 65*86400); t.is (d.formatCompact (), "9wk", "65*86400 -> 9wk"); - d = Duration ( 66*86400); t.is (d.formatCompact (), "9wk", "66*86400 -> 9wk"); - d = Duration ( 67*86400); t.is (d.formatCompact (), "9wk", "67*86400 -> 9wk"); - d = Duration ( 68*86400); t.is (d.formatCompact (), "9wk", "68*86400 -> 9wk"); - d = Duration ( 69*86400); t.is (d.formatCompact (), "9wk", "69*86400 -> 9wk"); - d = Duration ( 70*86400); t.is (d.formatCompact (), "10wk", "70*86400 -> 10wk"); + d = OldDuration ( 61*86400); t.is (d.formatCompact (), "8wk", "61*86400 -> 8wk"); + d = OldDuration ( 62*86400); t.is (d.formatCompact (), "8wk", "62*86400 -> 8wk"); + d = OldDuration ( 63*86400); t.is (d.formatCompact (), "9wk", "63*86400 -> 9wk"); + d = OldDuration ( 64*86400); t.is (d.formatCompact (), "9wk", "64*86400 -> 9wk"); + d = OldDuration ( 65*86400); t.is (d.formatCompact (), "9wk", "65*86400 -> 9wk"); + d = OldDuration ( 66*86400); t.is (d.formatCompact (), "9wk", "66*86400 -> 9wk"); + d = OldDuration ( 67*86400); t.is (d.formatCompact (), "9wk", "67*86400 -> 9wk"); + d = OldDuration ( 68*86400); t.is (d.formatCompact (), "9wk", "68*86400 -> 9wk"); + d = OldDuration ( 69*86400); t.is (d.formatCompact (), "9wk", "69*86400 -> 9wk"); + d = OldDuration ( 70*86400); t.is (d.formatCompact (), "10wk", "70*86400 -> 10wk"); - d = Duration ( 71*86400); t.is (d.formatCompact (), "10wk", "71*86400 -> 10wk"); - d = Duration ( 72*86400); t.is (d.formatCompact (), "10wk", "72*86400 -> 10wk"); - d = Duration ( 73*86400); t.is (d.formatCompact (), "10wk", "73*86400 -> 10wk"); - d = Duration ( 74*86400); t.is (d.formatCompact (), "10wk", "74*86400 -> 10wk"); - d = Duration ( 75*86400); t.is (d.formatCompact (), "10wk", "75*86400 -> 10wk"); - d = Duration ( 76*86400); t.is (d.formatCompact (), "10wk", "76*86400 -> 10wk"); - d = Duration ( 77*86400); t.is (d.formatCompact (), "11wk", "77*86400 -> 11wk"); - d = Duration ( 78*86400); t.is (d.formatCompact (), "11wk", "78*86400 -> 11wk"); - d = Duration ( 79*86400); t.is (d.formatCompact (), "11wk", "79*86400 -> 11wk"); - d = Duration ( 80*86400); t.is (d.formatCompact (), "11wk", "80*86400 -> 11wk"); + d = OldDuration ( 71*86400); t.is (d.formatCompact (), "10wk", "71*86400 -> 10wk"); + d = OldDuration ( 72*86400); t.is (d.formatCompact (), "10wk", "72*86400 -> 10wk"); + d = OldDuration ( 73*86400); t.is (d.formatCompact (), "10wk", "73*86400 -> 10wk"); + d = OldDuration ( 74*86400); t.is (d.formatCompact (), "10wk", "74*86400 -> 10wk"); + d = OldDuration ( 75*86400); t.is (d.formatCompact (), "10wk", "75*86400 -> 10wk"); + d = OldDuration ( 76*86400); t.is (d.formatCompact (), "10wk", "76*86400 -> 10wk"); + d = OldDuration ( 77*86400); t.is (d.formatCompact (), "11wk", "77*86400 -> 11wk"); + d = OldDuration ( 78*86400); t.is (d.formatCompact (), "11wk", "78*86400 -> 11wk"); + d = OldDuration ( 79*86400); t.is (d.formatCompact (), "11wk", "79*86400 -> 11wk"); + d = OldDuration ( 80*86400); t.is (d.formatCompact (), "11wk", "80*86400 -> 11wk"); - d = Duration ( 81*86400); t.is (d.formatCompact (), "11wk", "81*86400 -> 11wk"); - d = Duration ( 82*86400); t.is (d.formatCompact (), "11wk", "82*86400 -> 11wk"); - d = Duration ( 83*86400); t.is (d.formatCompact (), "11wk", "83*86400 -> 11wk"); - d = Duration ( 84*86400); t.is (d.formatCompact (), "2mo", "84*86400 -> 2mo"); - d = Duration ( 85*86400); t.is (d.formatCompact (), "2mo", "85*86400 -> 2mo"); - d = Duration ( 86*86400); t.is (d.formatCompact (), "2mo", "86*86400 -> 2mo"); - d = Duration ( 87*86400); t.is (d.formatCompact (), "2mo", "87*86400 -> 2mo"); - d = Duration ( 88*86400); t.is (d.formatCompact (), "2mo", "88*86400 -> 2mo"); - d = Duration ( 89*86400); t.is (d.formatCompact (), "2mo", "89*86400 -> 2mo"); - d = Duration ( 90*86400); t.is (d.formatCompact (), "3mo", "90*86400 -> 3mo"); + d = OldDuration ( 81*86400); t.is (d.formatCompact (), "11wk", "81*86400 -> 11wk"); + d = OldDuration ( 82*86400); t.is (d.formatCompact (), "11wk", "82*86400 -> 11wk"); + d = OldDuration ( 83*86400); t.is (d.formatCompact (), "11wk", "83*86400 -> 11wk"); + d = OldDuration ( 84*86400); t.is (d.formatCompact (), "2mo", "84*86400 -> 2mo"); + d = OldDuration ( 85*86400); t.is (d.formatCompact (), "2mo", "85*86400 -> 2mo"); + d = OldDuration ( 86*86400); t.is (d.formatCompact (), "2mo", "86*86400 -> 2mo"); + d = OldDuration ( 87*86400); t.is (d.formatCompact (), "2mo", "87*86400 -> 2mo"); + d = OldDuration ( 88*86400); t.is (d.formatCompact (), "2mo", "88*86400 -> 2mo"); + d = OldDuration ( 89*86400); t.is (d.formatCompact (), "2mo", "89*86400 -> 2mo"); + d = OldDuration ( 90*86400); t.is (d.formatCompact (), "3mo", "90*86400 -> 3mo"); - d = Duration ( 91*86400); t.is (d.formatCompact (), "3mo", "91*86400 -> 3mo"); - d = Duration ( 92*86400); t.is (d.formatCompact (), "3mo", "92*86400 -> 3mo"); - d = Duration ( 93*86400); t.is (d.formatCompact (), "3mo", "93*86400 -> 3mo"); - d = Duration ( 94*86400); t.is (d.formatCompact (), "3mo", "94*86400 -> 3mo"); - d = Duration ( 95*86400); t.is (d.formatCompact (), "3mo", "95*86400 -> 3mo"); - d = Duration ( 96*86400); t.is (d.formatCompact (), "3mo", "96*86400 -> 3mo"); - d = Duration ( 97*86400); t.is (d.formatCompact (), "3mo", "97*86400 -> 3mo"); - d = Duration ( 98*86400); t.is (d.formatCompact (), "3mo", "98*86400 -> 3mo"); - d = Duration ( 99*86400); t.is (d.formatCompact (), "3mo", "99*86400 -> 3mo"); - d = Duration (100*86400); t.is (d.formatCompact (), "3mo", "100*86400 -> 3mo"); + d = OldDuration ( 91*86400); t.is (d.formatCompact (), "3mo", "91*86400 -> 3mo"); + d = OldDuration ( 92*86400); t.is (d.formatCompact (), "3mo", "92*86400 -> 3mo"); + d = OldDuration ( 93*86400); t.is (d.formatCompact (), "3mo", "93*86400 -> 3mo"); + d = OldDuration ( 94*86400); t.is (d.formatCompact (), "3mo", "94*86400 -> 3mo"); + d = OldDuration ( 95*86400); t.is (d.formatCompact (), "3mo", "95*86400 -> 3mo"); + d = OldDuration ( 96*86400); t.is (d.formatCompact (), "3mo", "96*86400 -> 3mo"); + d = OldDuration ( 97*86400); t.is (d.formatCompact (), "3mo", "97*86400 -> 3mo"); + d = OldDuration ( 98*86400); t.is (d.formatCompact (), "3mo", "98*86400 -> 3mo"); + d = OldDuration ( 99*86400); t.is (d.formatCompact (), "3mo", "99*86400 -> 3mo"); + d = OldDuration (100*86400); t.is (d.formatCompact (), "3mo", "100*86400 -> 3mo"); - d = Duration (101*86400); t.is (d.formatCompact (), "3mo", "101*86400 -> 3mo"); - d = Duration (102*86400); t.is (d.formatCompact (), "3mo", "102*86400 -> 3mo"); - d = Duration (103*86400); t.is (d.formatCompact (), "3mo", "103*86400 -> 3mo"); - d = Duration (104*86400); t.is (d.formatCompact (), "3mo", "104*86400 -> 3mo"); - d = Duration (105*86400); t.is (d.formatCompact (), "3mo", "105*86400 -> 3mo"); - d = Duration (106*86400); t.is (d.formatCompact (), "3mo", "106*86400 -> 3mo"); - d = Duration (107*86400); t.is (d.formatCompact (), "3mo", "107*86400 -> 3mo"); - d = Duration (108*86400); t.is (d.formatCompact (), "3mo", "108*86400 -> 3mo"); - d = Duration (109*86400); t.is (d.formatCompact (), "3mo", "109*86400 -> 3mo"); - d = Duration (110*86400); t.is (d.formatCompact (), "3mo", "110*86400 -> 3mo"); + d = OldDuration (101*86400); t.is (d.formatCompact (), "3mo", "101*86400 -> 3mo"); + d = OldDuration (102*86400); t.is (d.formatCompact (), "3mo", "102*86400 -> 3mo"); + d = OldDuration (103*86400); t.is (d.formatCompact (), "3mo", "103*86400 -> 3mo"); + d = OldDuration (104*86400); t.is (d.formatCompact (), "3mo", "104*86400 -> 3mo"); + d = OldDuration (105*86400); t.is (d.formatCompact (), "3mo", "105*86400 -> 3mo"); + d = OldDuration (106*86400); t.is (d.formatCompact (), "3mo", "106*86400 -> 3mo"); + d = OldDuration (107*86400); t.is (d.formatCompact (), "3mo", "107*86400 -> 3mo"); + d = OldDuration (108*86400); t.is (d.formatCompact (), "3mo", "108*86400 -> 3mo"); + d = OldDuration (109*86400); t.is (d.formatCompact (), "3mo", "109*86400 -> 3mo"); + d = OldDuration (110*86400); t.is (d.formatCompact (), "3mo", "110*86400 -> 3mo"); - d = Duration (111*86400); t.is (d.formatCompact (), "3mo", "111*86400 -> 3mo"); - d = Duration (112*86400); t.is (d.formatCompact (), "3mo", "112*86400 -> 3mo"); - d = Duration (113*86400); t.is (d.formatCompact (), "3mo", "113*86400 -> 3mo"); - d = Duration (114*86400); t.is (d.formatCompact (), "3mo", "114*86400 -> 3mo"); - d = Duration (115*86400); t.is (d.formatCompact (), "3mo", "115*86400 -> 3mo"); - d = Duration (116*86400); t.is (d.formatCompact (), "3mo", "116*86400 -> 3mo"); - d = Duration (117*86400); t.is (d.formatCompact (), "3mo", "117*86400 -> 3mo"); - d = Duration (118*86400); t.is (d.formatCompact (), "3mo", "118*86400 -> 3mo"); - d = Duration (119*86400); t.is (d.formatCompact (), "3mo", "119*86400 -> 3mo"); - d = Duration (120*86400); t.is (d.formatCompact (), "4mo", "120*86400 -> 4mo"); + d = OldDuration (111*86400); t.is (d.formatCompact (), "3mo", "111*86400 -> 3mo"); + d = OldDuration (112*86400); t.is (d.formatCompact (), "3mo", "112*86400 -> 3mo"); + d = OldDuration (113*86400); t.is (d.formatCompact (), "3mo", "113*86400 -> 3mo"); + d = OldDuration (114*86400); t.is (d.formatCompact (), "3mo", "114*86400 -> 3mo"); + d = OldDuration (115*86400); t.is (d.formatCompact (), "3mo", "115*86400 -> 3mo"); + d = OldDuration (116*86400); t.is (d.formatCompact (), "3mo", "116*86400 -> 3mo"); + d = OldDuration (117*86400); t.is (d.formatCompact (), "3mo", "117*86400 -> 3mo"); + d = OldDuration (118*86400); t.is (d.formatCompact (), "3mo", "118*86400 -> 3mo"); + d = OldDuration (119*86400); t.is (d.formatCompact (), "3mo", "119*86400 -> 3mo"); + d = OldDuration (120*86400); t.is (d.formatCompact (), "4mo", "120*86400 -> 4mo"); - d = Duration (121*86400); t.is (d.formatCompact (), "4mo", "121*86400 -> 4mo"); - d = Duration (122*86400); t.is (d.formatCompact (), "4mo", "122*86400 -> 4mo"); - d = Duration (123*86400); t.is (d.formatCompact (), "4mo", "123*86400 -> 4mo"); - d = Duration (124*86400); t.is (d.formatCompact (), "4mo", "124*86400 -> 4mo"); - d = Duration (125*86400); t.is (d.formatCompact (), "4mo", "125*86400 -> 4mo"); - d = Duration (126*86400); t.is (d.formatCompact (), "4mo", "126*86400 -> 4mo"); - d = Duration (127*86400); t.is (d.formatCompact (), "4mo", "127*86400 -> 4mo"); - d = Duration (128*86400); t.is (d.formatCompact (), "4mo", "128*86400 -> 4mo"); - d = Duration (129*86400); t.is (d.formatCompact (), "4mo", "129*86400 -> 4mo"); - d = Duration (130*86400); t.is (d.formatCompact (), "4mo", "130*86400 -> 4mo"); + d = OldDuration (121*86400); t.is (d.formatCompact (), "4mo", "121*86400 -> 4mo"); + d = OldDuration (122*86400); t.is (d.formatCompact (), "4mo", "122*86400 -> 4mo"); + d = OldDuration (123*86400); t.is (d.formatCompact (), "4mo", "123*86400 -> 4mo"); + d = OldDuration (124*86400); t.is (d.formatCompact (), "4mo", "124*86400 -> 4mo"); + d = OldDuration (125*86400); t.is (d.formatCompact (), "4mo", "125*86400 -> 4mo"); + d = OldDuration (126*86400); t.is (d.formatCompact (), "4mo", "126*86400 -> 4mo"); + d = OldDuration (127*86400); t.is (d.formatCompact (), "4mo", "127*86400 -> 4mo"); + d = OldDuration (128*86400); t.is (d.formatCompact (), "4mo", "128*86400 -> 4mo"); + d = OldDuration (129*86400); t.is (d.formatCompact (), "4mo", "129*86400 -> 4mo"); + d = OldDuration (130*86400); t.is (d.formatCompact (), "4mo", "130*86400 -> 4mo"); - d = Duration (131*86400); t.is (d.formatCompact (), "4mo", "131*86400 -> 4mo"); - d = Duration (132*86400); t.is (d.formatCompact (), "4mo", "132*86400 -> 4mo"); - d = Duration (133*86400); t.is (d.formatCompact (), "4mo", "133*86400 -> 4mo"); - d = Duration (134*86400); t.is (d.formatCompact (), "4mo", "134*86400 -> 4mo"); - d = Duration (135*86400); t.is (d.formatCompact (), "4mo", "135*86400 -> 4mo"); - d = Duration (136*86400); t.is (d.formatCompact (), "4mo", "136*86400 -> 4mo"); - d = Duration (137*86400); t.is (d.formatCompact (), "4mo", "137*86400 -> 4mo"); - d = Duration (138*86400); t.is (d.formatCompact (), "4mo", "138*86400 -> 4mo"); - d = Duration (139*86400); t.is (d.formatCompact (), "4mo", "139*86400 -> 4mo"); - d = Duration (140*86400); t.is (d.formatCompact (), "4mo", "140*86400 -> 4mo"); + d = OldDuration (131*86400); t.is (d.formatCompact (), "4mo", "131*86400 -> 4mo"); + d = OldDuration (132*86400); t.is (d.formatCompact (), "4mo", "132*86400 -> 4mo"); + d = OldDuration (133*86400); t.is (d.formatCompact (), "4mo", "133*86400 -> 4mo"); + d = OldDuration (134*86400); t.is (d.formatCompact (), "4mo", "134*86400 -> 4mo"); + d = OldDuration (135*86400); t.is (d.formatCompact (), "4mo", "135*86400 -> 4mo"); + d = OldDuration (136*86400); t.is (d.formatCompact (), "4mo", "136*86400 -> 4mo"); + d = OldDuration (137*86400); t.is (d.formatCompact (), "4mo", "137*86400 -> 4mo"); + d = OldDuration (138*86400); t.is (d.formatCompact (), "4mo", "138*86400 -> 4mo"); + d = OldDuration (139*86400); t.is (d.formatCompact (), "4mo", "139*86400 -> 4mo"); + d = OldDuration (140*86400); t.is (d.formatCompact (), "4mo", "140*86400 -> 4mo"); - d = Duration (141*86400); t.is (d.formatCompact (), "4mo", "141*86400 -> 4mo"); - d = Duration (142*86400); t.is (d.formatCompact (), "4mo", "142*86400 -> 4mo"); - d = Duration (143*86400); t.is (d.formatCompact (), "4mo", "143*86400 -> 4mo"); - d = Duration (144*86400); t.is (d.formatCompact (), "4mo", "144*86400 -> 4mo"); - d = Duration (145*86400); t.is (d.formatCompact (), "4mo", "145*86400 -> 4mo"); - d = Duration (146*86400); t.is (d.formatCompact (), "4mo", "146*86400 -> 4mo"); - d = Duration (147*86400); t.is (d.formatCompact (), "4mo", "147*86400 -> 4mo"); - d = Duration (148*86400); t.is (d.formatCompact (), "4mo", "148*86400 -> 4mo"); - d = Duration (149*86400); t.is (d.formatCompact (), "4mo", "149*86400 -> 4mo"); - d = Duration (150*86400); t.is (d.formatCompact (), "5mo", "150*86400 -> 5mo"); + d = OldDuration (141*86400); t.is (d.formatCompact (), "4mo", "141*86400 -> 4mo"); + d = OldDuration (142*86400); t.is (d.formatCompact (), "4mo", "142*86400 -> 4mo"); + d = OldDuration (143*86400); t.is (d.formatCompact (), "4mo", "143*86400 -> 4mo"); + d = OldDuration (144*86400); t.is (d.formatCompact (), "4mo", "144*86400 -> 4mo"); + d = OldDuration (145*86400); t.is (d.formatCompact (), "4mo", "145*86400 -> 4mo"); + d = OldDuration (146*86400); t.is (d.formatCompact (), "4mo", "146*86400 -> 4mo"); + d = OldDuration (147*86400); t.is (d.formatCompact (), "4mo", "147*86400 -> 4mo"); + d = OldDuration (148*86400); t.is (d.formatCompact (), "4mo", "148*86400 -> 4mo"); + d = OldDuration (149*86400); t.is (d.formatCompact (), "4mo", "149*86400 -> 4mo"); + d = OldDuration (150*86400); t.is (d.formatCompact (), "5mo", "150*86400 -> 5mo"); - d = Duration (151*86400); t.is (d.formatCompact (), "5mo", "151*86400 -> 5mo"); - d = Duration (152*86400); t.is (d.formatCompact (), "5mo", "152*86400 -> 5mo"); - d = Duration (153*86400); t.is (d.formatCompact (), "5mo", "153*86400 -> 5mo"); - d = Duration (154*86400); t.is (d.formatCompact (), "5mo", "154*86400 -> 5mo"); - d = Duration (155*86400); t.is (d.formatCompact (), "5mo", "155*86400 -> 5mo"); - d = Duration (156*86400); t.is (d.formatCompact (), "5mo", "156*86400 -> 5mo"); - d = Duration (157*86400); t.is (d.formatCompact (), "5mo", "157*86400 -> 5mo"); - d = Duration (158*86400); t.is (d.formatCompact (), "5mo", "158*86400 -> 5mo"); - d = Duration (159*86400); t.is (d.formatCompact (), "5mo", "159*86400 -> 5mo"); - d = Duration (160*86400); t.is (d.formatCompact (), "5mo", "160*86400 -> 5mo"); + d = OldDuration (151*86400); t.is (d.formatCompact (), "5mo", "151*86400 -> 5mo"); + d = OldDuration (152*86400); t.is (d.formatCompact (), "5mo", "152*86400 -> 5mo"); + d = OldDuration (153*86400); t.is (d.formatCompact (), "5mo", "153*86400 -> 5mo"); + d = OldDuration (154*86400); t.is (d.formatCompact (), "5mo", "154*86400 -> 5mo"); + d = OldDuration (155*86400); t.is (d.formatCompact (), "5mo", "155*86400 -> 5mo"); + d = OldDuration (156*86400); t.is (d.formatCompact (), "5mo", "156*86400 -> 5mo"); + d = OldDuration (157*86400); t.is (d.formatCompact (), "5mo", "157*86400 -> 5mo"); + d = OldDuration (158*86400); t.is (d.formatCompact (), "5mo", "158*86400 -> 5mo"); + d = OldDuration (159*86400); t.is (d.formatCompact (), "5mo", "159*86400 -> 5mo"); + d = OldDuration (160*86400); t.is (d.formatCompact (), "5mo", "160*86400 -> 5mo"); - d = Duration (161*86400); t.is (d.formatCompact (), "5mo", "161*86400 -> 5mo"); - d = Duration (162*86400); t.is (d.formatCompact (), "5mo", "162*86400 -> 5mo"); - d = Duration (163*86400); t.is (d.formatCompact (), "5mo", "163*86400 -> 5mo"); - d = Duration (164*86400); t.is (d.formatCompact (), "5mo", "164*86400 -> 5mo"); - d = Duration (165*86400); t.is (d.formatCompact (), "5mo", "165*86400 -> 5mo"); - d = Duration (166*86400); t.is (d.formatCompact (), "5mo", "166*86400 -> 5mo"); - d = Duration (167*86400); t.is (d.formatCompact (), "5mo", "167*86400 -> 5mo"); - d = Duration (168*86400); t.is (d.formatCompact (), "5mo", "168*86400 -> 5mo"); - d = Duration (169*86400); t.is (d.formatCompact (), "5mo", "169*86400 -> 5mo"); - d = Duration (170*86400); t.is (d.formatCompact (), "5mo", "170*86400 -> 5mo"); + d = OldDuration (161*86400); t.is (d.formatCompact (), "5mo", "161*86400 -> 5mo"); + d = OldDuration (162*86400); t.is (d.formatCompact (), "5mo", "162*86400 -> 5mo"); + d = OldDuration (163*86400); t.is (d.formatCompact (), "5mo", "163*86400 -> 5mo"); + d = OldDuration (164*86400); t.is (d.formatCompact (), "5mo", "164*86400 -> 5mo"); + d = OldDuration (165*86400); t.is (d.formatCompact (), "5mo", "165*86400 -> 5mo"); + d = OldDuration (166*86400); t.is (d.formatCompact (), "5mo", "166*86400 -> 5mo"); + d = OldDuration (167*86400); t.is (d.formatCompact (), "5mo", "167*86400 -> 5mo"); + d = OldDuration (168*86400); t.is (d.formatCompact (), "5mo", "168*86400 -> 5mo"); + d = OldDuration (169*86400); t.is (d.formatCompact (), "5mo", "169*86400 -> 5mo"); + d = OldDuration (170*86400); t.is (d.formatCompact (), "5mo", "170*86400 -> 5mo"); - d = Duration (171*86400); t.is (d.formatCompact (), "5mo", "171*86400 -> 5mo"); - d = Duration (172*86400); t.is (d.formatCompact (), "5mo", "172*86400 -> 5mo"); - d = Duration (173*86400); t.is (d.formatCompact (), "5mo", "173*86400 -> 5mo"); - d = Duration (174*86400); t.is (d.formatCompact (), "5mo", "174*86400 -> 5mo"); - d = Duration (175*86400); t.is (d.formatCompact (), "5mo", "175*86400 -> 5mo"); - d = Duration (176*86400); t.is (d.formatCompact (), "5mo", "176*86400 -> 5mo"); - d = Duration (177*86400); t.is (d.formatCompact (), "5mo", "177*86400 -> 5mo"); - d = Duration (178*86400); t.is (d.formatCompact (), "5mo", "178*86400 -> 5mo"); - d = Duration (179*86400); t.is (d.formatCompact (), "5mo", "179*86400 -> 5mo"); - d = Duration (180*86400); t.is (d.formatCompact (), "6mo", "180*86400 -> 6mo"); + d = OldDuration (171*86400); t.is (d.formatCompact (), "5mo", "171*86400 -> 5mo"); + d = OldDuration (172*86400); t.is (d.formatCompact (), "5mo", "172*86400 -> 5mo"); + d = OldDuration (173*86400); t.is (d.formatCompact (), "5mo", "173*86400 -> 5mo"); + d = OldDuration (174*86400); t.is (d.formatCompact (), "5mo", "174*86400 -> 5mo"); + d = OldDuration (175*86400); t.is (d.formatCompact (), "5mo", "175*86400 -> 5mo"); + d = OldDuration (176*86400); t.is (d.formatCompact (), "5mo", "176*86400 -> 5mo"); + d = OldDuration (177*86400); t.is (d.formatCompact (), "5mo", "177*86400 -> 5mo"); + d = OldDuration (178*86400); t.is (d.formatCompact (), "5mo", "178*86400 -> 5mo"); + d = OldDuration (179*86400); t.is (d.formatCompact (), "5mo", "179*86400 -> 5mo"); + d = OldDuration (180*86400); t.is (d.formatCompact (), "6mo", "180*86400 -> 6mo"); - d = Duration (181*86400); t.is (d.formatCompact (), "6mo", "181*86400 -> 6mo"); - d = Duration (182*86400); t.is (d.formatCompact (), "6mo", "182*86400 -> 6mo"); - d = Duration (183*86400); t.is (d.formatCompact (), "6mo", "183*86400 -> 6mo"); - d = Duration (184*86400); t.is (d.formatCompact (), "6mo", "184*86400 -> 6mo"); - d = Duration (185*86400); t.is (d.formatCompact (), "6mo", "185*86400 -> 6mo"); - d = Duration (186*86400); t.is (d.formatCompact (), "6mo", "186*86400 -> 6mo"); - d = Duration (187*86400); t.is (d.formatCompact (), "6mo", "187*86400 -> 6mo"); - d = Duration (188*86400); t.is (d.formatCompact (), "6mo", "188*86400 -> 6mo"); - d = Duration (189*86400); t.is (d.formatCompact (), "6mo", "189*86400 -> 6mo"); - d = Duration (190*86400); t.is (d.formatCompact (), "6mo", "190*86400 -> 6mo"); + d = OldDuration (181*86400); t.is (d.formatCompact (), "6mo", "181*86400 -> 6mo"); + d = OldDuration (182*86400); t.is (d.formatCompact (), "6mo", "182*86400 -> 6mo"); + d = OldDuration (183*86400); t.is (d.formatCompact (), "6mo", "183*86400 -> 6mo"); + d = OldDuration (184*86400); t.is (d.formatCompact (), "6mo", "184*86400 -> 6mo"); + d = OldDuration (185*86400); t.is (d.formatCompact (), "6mo", "185*86400 -> 6mo"); + d = OldDuration (186*86400); t.is (d.formatCompact (), "6mo", "186*86400 -> 6mo"); + d = OldDuration (187*86400); t.is (d.formatCompact (), "6mo", "187*86400 -> 6mo"); + d = OldDuration (188*86400); t.is (d.formatCompact (), "6mo", "188*86400 -> 6mo"); + d = OldDuration (189*86400); t.is (d.formatCompact (), "6mo", "189*86400 -> 6mo"); + d = OldDuration (190*86400); t.is (d.formatCompact (), "6mo", "190*86400 -> 6mo"); - d = Duration (191*86400); t.is (d.formatCompact (), "6mo", "191*86400 -> 6mo"); - d = Duration (192*86400); t.is (d.formatCompact (), "6mo", "192*86400 -> 6mo"); - d = Duration (193*86400); t.is (d.formatCompact (), "6mo", "193*86400 -> 6mo"); - d = Duration (194*86400); t.is (d.formatCompact (), "6mo", "194*86400 -> 6mo"); - d = Duration (195*86400); t.is (d.formatCompact (), "6mo", "195*86400 -> 6mo"); - d = Duration (196*86400); t.is (d.formatCompact (), "6mo", "196*86400 -> 6mo"); - d = Duration (197*86400); t.is (d.formatCompact (), "6mo", "197*86400 -> 6mo"); - d = Duration (198*86400); t.is (d.formatCompact (), "6mo", "198*86400 -> 6mo"); - d = Duration (199*86400); t.is (d.formatCompact (), "6mo", "199*86400 -> 6mo"); - d = Duration (200*86400); t.is (d.formatCompact (), "6mo", "200*86400 -> 6mo"); + d = OldDuration (191*86400); t.is (d.formatCompact (), "6mo", "191*86400 -> 6mo"); + d = OldDuration (192*86400); t.is (d.formatCompact (), "6mo", "192*86400 -> 6mo"); + d = OldDuration (193*86400); t.is (d.formatCompact (), "6mo", "193*86400 -> 6mo"); + d = OldDuration (194*86400); t.is (d.formatCompact (), "6mo", "194*86400 -> 6mo"); + d = OldDuration (195*86400); t.is (d.formatCompact (), "6mo", "195*86400 -> 6mo"); + d = OldDuration (196*86400); t.is (d.formatCompact (), "6mo", "196*86400 -> 6mo"); + d = OldDuration (197*86400); t.is (d.formatCompact (), "6mo", "197*86400 -> 6mo"); + d = OldDuration (198*86400); t.is (d.formatCompact (), "6mo", "198*86400 -> 6mo"); + d = OldDuration (199*86400); t.is (d.formatCompact (), "6mo", "199*86400 -> 6mo"); + d = OldDuration (200*86400); t.is (d.formatCompact (), "6mo", "200*86400 -> 6mo"); - d = Duration (201*86400); t.is (d.formatCompact (), "6mo", "201*86400 -> 6mo"); - d = Duration (202*86400); t.is (d.formatCompact (), "6mo", "202*86400 -> 6mo"); - d = Duration (203*86400); t.is (d.formatCompact (), "6mo", "203*86400 -> 6mo"); - d = Duration (204*86400); t.is (d.formatCompact (), "6mo", "204*86400 -> 6mo"); - d = Duration (205*86400); t.is (d.formatCompact (), "6mo", "205*86400 -> 6mo"); - d = Duration (206*86400); t.is (d.formatCompact (), "6mo", "206*86400 -> 6mo"); - d = Duration (207*86400); t.is (d.formatCompact (), "6mo", "207*86400 -> 6mo"); - d = Duration (208*86400); t.is (d.formatCompact (), "6mo", "208*86400 -> 6mo"); - d = Duration (209*86400); t.is (d.formatCompact (), "6mo", "209*86400 -> 6mo"); - d = Duration (210*86400); t.is (d.formatCompact (), "7mo", "210*86400 -> 7mo"); + d = OldDuration (201*86400); t.is (d.formatCompact (), "6mo", "201*86400 -> 6mo"); + d = OldDuration (202*86400); t.is (d.formatCompact (), "6mo", "202*86400 -> 6mo"); + d = OldDuration (203*86400); t.is (d.formatCompact (), "6mo", "203*86400 -> 6mo"); + d = OldDuration (204*86400); t.is (d.formatCompact (), "6mo", "204*86400 -> 6mo"); + d = OldDuration (205*86400); t.is (d.formatCompact (), "6mo", "205*86400 -> 6mo"); + d = OldDuration (206*86400); t.is (d.formatCompact (), "6mo", "206*86400 -> 6mo"); + d = OldDuration (207*86400); t.is (d.formatCompact (), "6mo", "207*86400 -> 6mo"); + d = OldDuration (208*86400); t.is (d.formatCompact (), "6mo", "208*86400 -> 6mo"); + d = OldDuration (209*86400); t.is (d.formatCompact (), "6mo", "209*86400 -> 6mo"); + d = OldDuration (210*86400); t.is (d.formatCompact (), "7mo", "210*86400 -> 7mo"); - d = Duration (211*86400); t.is (d.formatCompact (), "7mo", "211*86400 -> 7mo"); - d = Duration (212*86400); t.is (d.formatCompact (), "7mo", "212*86400 -> 7mo"); - d = Duration (213*86400); t.is (d.formatCompact (), "7mo", "213*86400 -> 7mo"); - d = Duration (214*86400); t.is (d.formatCompact (), "7mo", "214*86400 -> 7mo"); - d = Duration (215*86400); t.is (d.formatCompact (), "7mo", "215*86400 -> 7mo"); - d = Duration (216*86400); t.is (d.formatCompact (), "7mo", "216*86400 -> 7mo"); - d = Duration (217*86400); t.is (d.formatCompact (), "7mo", "217*86400 -> 7mo"); - d = Duration (218*86400); t.is (d.formatCompact (), "7mo", "218*86400 -> 7mo"); - d = Duration (219*86400); t.is (d.formatCompact (), "7mo", "219*86400 -> 7mo"); - d = Duration (220*86400); t.is (d.formatCompact (), "7mo", "220*86400 -> 7mo"); + d = OldDuration (211*86400); t.is (d.formatCompact (), "7mo", "211*86400 -> 7mo"); + d = OldDuration (212*86400); t.is (d.formatCompact (), "7mo", "212*86400 -> 7mo"); + d = OldDuration (213*86400); t.is (d.formatCompact (), "7mo", "213*86400 -> 7mo"); + d = OldDuration (214*86400); t.is (d.formatCompact (), "7mo", "214*86400 -> 7mo"); + d = OldDuration (215*86400); t.is (d.formatCompact (), "7mo", "215*86400 -> 7mo"); + d = OldDuration (216*86400); t.is (d.formatCompact (), "7mo", "216*86400 -> 7mo"); + d = OldDuration (217*86400); t.is (d.formatCompact (), "7mo", "217*86400 -> 7mo"); + d = OldDuration (218*86400); t.is (d.formatCompact (), "7mo", "218*86400 -> 7mo"); + d = OldDuration (219*86400); t.is (d.formatCompact (), "7mo", "219*86400 -> 7mo"); + d = OldDuration (220*86400); t.is (d.formatCompact (), "7mo", "220*86400 -> 7mo"); - d = Duration (221*86400); t.is (d.formatCompact (), "7mo", "221*86400 -> 7mo"); - d = Duration (222*86400); t.is (d.formatCompact (), "7mo", "222*86400 -> 7mo"); - d = Duration (223*86400); t.is (d.formatCompact (), "7mo", "223*86400 -> 7mo"); - d = Duration (224*86400); t.is (d.formatCompact (), "7mo", "224*86400 -> 7mo"); - d = Duration (225*86400); t.is (d.formatCompact (), "7mo", "225*86400 -> 7mo"); - d = Duration (226*86400); t.is (d.formatCompact (), "7mo", "226*86400 -> 7mo"); - d = Duration (227*86400); t.is (d.formatCompact (), "7mo", "227*86400 -> 7mo"); - d = Duration (228*86400); t.is (d.formatCompact (), "7mo", "228*86400 -> 7mo"); - d = Duration (229*86400); t.is (d.formatCompact (), "7mo", "229*86400 -> 7mo"); - d = Duration (230*86400); t.is (d.formatCompact (), "7mo", "230*86400 -> 7mo"); + d = OldDuration (221*86400); t.is (d.formatCompact (), "7mo", "221*86400 -> 7mo"); + d = OldDuration (222*86400); t.is (d.formatCompact (), "7mo", "222*86400 -> 7mo"); + d = OldDuration (223*86400); t.is (d.formatCompact (), "7mo", "223*86400 -> 7mo"); + d = OldDuration (224*86400); t.is (d.formatCompact (), "7mo", "224*86400 -> 7mo"); + d = OldDuration (225*86400); t.is (d.formatCompact (), "7mo", "225*86400 -> 7mo"); + d = OldDuration (226*86400); t.is (d.formatCompact (), "7mo", "226*86400 -> 7mo"); + d = OldDuration (227*86400); t.is (d.formatCompact (), "7mo", "227*86400 -> 7mo"); + d = OldDuration (228*86400); t.is (d.formatCompact (), "7mo", "228*86400 -> 7mo"); + d = OldDuration (229*86400); t.is (d.formatCompact (), "7mo", "229*86400 -> 7mo"); + d = OldDuration (230*86400); t.is (d.formatCompact (), "7mo", "230*86400 -> 7mo"); - d = Duration (231*86400); t.is (d.formatCompact (), "7mo", "231*86400 -> 7mo"); - d = Duration (232*86400); t.is (d.formatCompact (), "7mo", "232*86400 -> 7mo"); - d = Duration (233*86400); t.is (d.formatCompact (), "7mo", "233*86400 -> 7mo"); - d = Duration (234*86400); t.is (d.formatCompact (), "7mo", "234*86400 -> 7mo"); - d = Duration (235*86400); t.is (d.formatCompact (), "7mo", "235*86400 -> 7mo"); - d = Duration (236*86400); t.is (d.formatCompact (), "7mo", "236*86400 -> 7mo"); - d = Duration (237*86400); t.is (d.formatCompact (), "7mo", "237*86400 -> 7mo"); - d = Duration (238*86400); t.is (d.formatCompact (), "7mo", "238*86400 -> 7mo"); - d = Duration (239*86400); t.is (d.formatCompact (), "7mo", "239*86400 -> 7mo"); - d = Duration (240*86400); t.is (d.formatCompact (), "8mo", "240*86400 -> 8mo"); + d = OldDuration (231*86400); t.is (d.formatCompact (), "7mo", "231*86400 -> 7mo"); + d = OldDuration (232*86400); t.is (d.formatCompact (), "7mo", "232*86400 -> 7mo"); + d = OldDuration (233*86400); t.is (d.formatCompact (), "7mo", "233*86400 -> 7mo"); + d = OldDuration (234*86400); t.is (d.formatCompact (), "7mo", "234*86400 -> 7mo"); + d = OldDuration (235*86400); t.is (d.formatCompact (), "7mo", "235*86400 -> 7mo"); + d = OldDuration (236*86400); t.is (d.formatCompact (), "7mo", "236*86400 -> 7mo"); + d = OldDuration (237*86400); t.is (d.formatCompact (), "7mo", "237*86400 -> 7mo"); + d = OldDuration (238*86400); t.is (d.formatCompact (), "7mo", "238*86400 -> 7mo"); + d = OldDuration (239*86400); t.is (d.formatCompact (), "7mo", "239*86400 -> 7mo"); + d = OldDuration (240*86400); t.is (d.formatCompact (), "8mo", "240*86400 -> 8mo"); - d = Duration (241*86400); t.is (d.formatCompact (), "8mo", "241*86400 -> 8mo"); - d = Duration (242*86400); t.is (d.formatCompact (), "8mo", "242*86400 -> 8mo"); - d = Duration (243*86400); t.is (d.formatCompact (), "8mo", "243*86400 -> 8mo"); - d = Duration (244*86400); t.is (d.formatCompact (), "8mo", "244*86400 -> 8mo"); - d = Duration (245*86400); t.is (d.formatCompact (), "8mo", "245*86400 -> 8mo"); - d = Duration (246*86400); t.is (d.formatCompact (), "8mo", "246*86400 -> 8mo"); - d = Duration (247*86400); t.is (d.formatCompact (), "8mo", "247*86400 -> 8mo"); - d = Duration (248*86400); t.is (d.formatCompact (), "8mo", "248*86400 -> 8mo"); - d = Duration (249*86400); t.is (d.formatCompact (), "8mo", "249*86400 -> 8mo"); - d = Duration (250*86400); t.is (d.formatCompact (), "8mo", "250*86400 -> 8mo"); + d = OldDuration (241*86400); t.is (d.formatCompact (), "8mo", "241*86400 -> 8mo"); + d = OldDuration (242*86400); t.is (d.formatCompact (), "8mo", "242*86400 -> 8mo"); + d = OldDuration (243*86400); t.is (d.formatCompact (), "8mo", "243*86400 -> 8mo"); + d = OldDuration (244*86400); t.is (d.formatCompact (), "8mo", "244*86400 -> 8mo"); + d = OldDuration (245*86400); t.is (d.formatCompact (), "8mo", "245*86400 -> 8mo"); + d = OldDuration (246*86400); t.is (d.formatCompact (), "8mo", "246*86400 -> 8mo"); + d = OldDuration (247*86400); t.is (d.formatCompact (), "8mo", "247*86400 -> 8mo"); + d = OldDuration (248*86400); t.is (d.formatCompact (), "8mo", "248*86400 -> 8mo"); + d = OldDuration (249*86400); t.is (d.formatCompact (), "8mo", "249*86400 -> 8mo"); + d = OldDuration (250*86400); t.is (d.formatCompact (), "8mo", "250*86400 -> 8mo"); - d = Duration (251*86400); t.is (d.formatCompact (), "8mo", "251*86400 -> 8mo"); - d = Duration (252*86400); t.is (d.formatCompact (), "8mo", "252*86400 -> 8mo"); - d = Duration (253*86400); t.is (d.formatCompact (), "8mo", "253*86400 -> 8mo"); - d = Duration (254*86400); t.is (d.formatCompact (), "8mo", "254*86400 -> 8mo"); - d = Duration (255*86400); t.is (d.formatCompact (), "8mo", "255*86400 -> 8mo"); - d = Duration (256*86400); t.is (d.formatCompact (), "8mo", "256*86400 -> 8mo"); - d = Duration (257*86400); t.is (d.formatCompact (), "8mo", "257*86400 -> 8mo"); - d = Duration (258*86400); t.is (d.formatCompact (), "8mo", "258*86400 -> 8mo"); - d = Duration (259*86400); t.is (d.formatCompact (), "8mo", "259*86400 -> 8mo"); - d = Duration (260*86400); t.is (d.formatCompact (), "8mo", "260*86400 -> 8mo"); + d = OldDuration (251*86400); t.is (d.formatCompact (), "8mo", "251*86400 -> 8mo"); + d = OldDuration (252*86400); t.is (d.formatCompact (), "8mo", "252*86400 -> 8mo"); + d = OldDuration (253*86400); t.is (d.formatCompact (), "8mo", "253*86400 -> 8mo"); + d = OldDuration (254*86400); t.is (d.formatCompact (), "8mo", "254*86400 -> 8mo"); + d = OldDuration (255*86400); t.is (d.formatCompact (), "8mo", "255*86400 -> 8mo"); + d = OldDuration (256*86400); t.is (d.formatCompact (), "8mo", "256*86400 -> 8mo"); + d = OldDuration (257*86400); t.is (d.formatCompact (), "8mo", "257*86400 -> 8mo"); + d = OldDuration (258*86400); t.is (d.formatCompact (), "8mo", "258*86400 -> 8mo"); + d = OldDuration (259*86400); t.is (d.formatCompact (), "8mo", "259*86400 -> 8mo"); + d = OldDuration (260*86400); t.is (d.formatCompact (), "8mo", "260*86400 -> 8mo"); - d = Duration (261*86400); t.is (d.formatCompact (), "8mo", "261*86400 -> 8mo"); - d = Duration (262*86400); t.is (d.formatCompact (), "8mo", "262*86400 -> 8mo"); - d = Duration (263*86400); t.is (d.formatCompact (), "8mo", "263*86400 -> 8mo"); - d = Duration (264*86400); t.is (d.formatCompact (), "8mo", "264*86400 -> 8mo"); - d = Duration (265*86400); t.is (d.formatCompact (), "8mo", "265*86400 -> 8mo"); - d = Duration (266*86400); t.is (d.formatCompact (), "8mo", "266*86400 -> 8mo"); - d = Duration (267*86400); t.is (d.formatCompact (), "8mo", "267*86400 -> 8mo"); - d = Duration (268*86400); t.is (d.formatCompact (), "8mo", "268*86400 -> 8mo"); - d = Duration (269*86400); t.is (d.formatCompact (), "8mo", "269*86400 -> 8mo"); - d = Duration (270*86400); t.is (d.formatCompact (), "9mo", "270*86400 -> 9mo"); + d = OldDuration (261*86400); t.is (d.formatCompact (), "8mo", "261*86400 -> 8mo"); + d = OldDuration (262*86400); t.is (d.formatCompact (), "8mo", "262*86400 -> 8mo"); + d = OldDuration (263*86400); t.is (d.formatCompact (), "8mo", "263*86400 -> 8mo"); + d = OldDuration (264*86400); t.is (d.formatCompact (), "8mo", "264*86400 -> 8mo"); + d = OldDuration (265*86400); t.is (d.formatCompact (), "8mo", "265*86400 -> 8mo"); + d = OldDuration (266*86400); t.is (d.formatCompact (), "8mo", "266*86400 -> 8mo"); + d = OldDuration (267*86400); t.is (d.formatCompact (), "8mo", "267*86400 -> 8mo"); + d = OldDuration (268*86400); t.is (d.formatCompact (), "8mo", "268*86400 -> 8mo"); + d = OldDuration (269*86400); t.is (d.formatCompact (), "8mo", "269*86400 -> 8mo"); + d = OldDuration (270*86400); t.is (d.formatCompact (), "9mo", "270*86400 -> 9mo"); - d = Duration (271*86400); t.is (d.formatCompact (), "9mo", "271*86400 -> 9mo"); - d = Duration (272*86400); t.is (d.formatCompact (), "9mo", "272*86400 -> 9mo"); - d = Duration (273*86400); t.is (d.formatCompact (), "9mo", "273*86400 -> 9mo"); - d = Duration (274*86400); t.is (d.formatCompact (), "9mo", "274*86400 -> 9mo"); - d = Duration (275*86400); t.is (d.formatCompact (), "9mo", "275*86400 -> 9mo"); - d = Duration (276*86400); t.is (d.formatCompact (), "9mo", "276*86400 -> 9mo"); - d = Duration (277*86400); t.is (d.formatCompact (), "9mo", "277*86400 -> 9mo"); - d = Duration (278*86400); t.is (d.formatCompact (), "9mo", "278*86400 -> 9mo"); - d = Duration (279*86400); t.is (d.formatCompact (), "9mo", "279*86400 -> 9mo"); - d = Duration (280*86400); t.is (d.formatCompact (), "9mo", "280*86400 -> 9mo"); + d = OldDuration (271*86400); t.is (d.formatCompact (), "9mo", "271*86400 -> 9mo"); + d = OldDuration (272*86400); t.is (d.formatCompact (), "9mo", "272*86400 -> 9mo"); + d = OldDuration (273*86400); t.is (d.formatCompact (), "9mo", "273*86400 -> 9mo"); + d = OldDuration (274*86400); t.is (d.formatCompact (), "9mo", "274*86400 -> 9mo"); + d = OldDuration (275*86400); t.is (d.formatCompact (), "9mo", "275*86400 -> 9mo"); + d = OldDuration (276*86400); t.is (d.formatCompact (), "9mo", "276*86400 -> 9mo"); + d = OldDuration (277*86400); t.is (d.formatCompact (), "9mo", "277*86400 -> 9mo"); + d = OldDuration (278*86400); t.is (d.formatCompact (), "9mo", "278*86400 -> 9mo"); + d = OldDuration (279*86400); t.is (d.formatCompact (), "9mo", "279*86400 -> 9mo"); + d = OldDuration (280*86400); t.is (d.formatCompact (), "9mo", "280*86400 -> 9mo"); - d = Duration (281*86400); t.is (d.formatCompact (), "9mo", "281*86400 -> 9mo"); - d = Duration (282*86400); t.is (d.formatCompact (), "9mo", "282*86400 -> 9mo"); - d = Duration (283*86400); t.is (d.formatCompact (), "9mo", "283*86400 -> 9mo"); - d = Duration (284*86400); t.is (d.formatCompact (), "9mo", "284*86400 -> 9mo"); - d = Duration (285*86400); t.is (d.formatCompact (), "9mo", "285*86400 -> 9mo"); - d = Duration (286*86400); t.is (d.formatCompact (), "9mo", "286*86400 -> 9mo"); - d = Duration (287*86400); t.is (d.formatCompact (), "9mo", "287*86400 -> 9mo"); - d = Duration (288*86400); t.is (d.formatCompact (), "9mo", "288*86400 -> 9mo"); - d = Duration (289*86400); t.is (d.formatCompact (), "9mo", "289*86400 -> 9mo"); - d = Duration (290*86400); t.is (d.formatCompact (), "9mo", "290*86400 -> 9mo"); + d = OldDuration (281*86400); t.is (d.formatCompact (), "9mo", "281*86400 -> 9mo"); + d = OldDuration (282*86400); t.is (d.formatCompact (), "9mo", "282*86400 -> 9mo"); + d = OldDuration (283*86400); t.is (d.formatCompact (), "9mo", "283*86400 -> 9mo"); + d = OldDuration (284*86400); t.is (d.formatCompact (), "9mo", "284*86400 -> 9mo"); + d = OldDuration (285*86400); t.is (d.formatCompact (), "9mo", "285*86400 -> 9mo"); + d = OldDuration (286*86400); t.is (d.formatCompact (), "9mo", "286*86400 -> 9mo"); + d = OldDuration (287*86400); t.is (d.formatCompact (), "9mo", "287*86400 -> 9mo"); + d = OldDuration (288*86400); t.is (d.formatCompact (), "9mo", "288*86400 -> 9mo"); + d = OldDuration (289*86400); t.is (d.formatCompact (), "9mo", "289*86400 -> 9mo"); + d = OldDuration (290*86400); t.is (d.formatCompact (), "9mo", "290*86400 -> 9mo"); - d = Duration (291*86400); t.is (d.formatCompact (), "9mo", "291*86400 -> 9mo"); - d = Duration (292*86400); t.is (d.formatCompact (), "9mo", "292*86400 -> 9mo"); - d = Duration (293*86400); t.is (d.formatCompact (), "9mo", "293*86400 -> 9mo"); - d = Duration (294*86400); t.is (d.formatCompact (), "9mo", "294*86400 -> 9mo"); - d = Duration (295*86400); t.is (d.formatCompact (), "9mo", "295*86400 -> 9mo"); - d = Duration (296*86400); t.is (d.formatCompact (), "9mo", "296*86400 -> 9mo"); - d = Duration (297*86400); t.is (d.formatCompact (), "9mo", "297*86400 -> 9mo"); - d = Duration (298*86400); t.is (d.formatCompact (), "9mo", "298*86400 -> 9mo"); - d = Duration (299*86400); t.is (d.formatCompact (), "9mo", "299*86400 -> 9mo"); - d = Duration (300*86400); t.is (d.formatCompact (), "10mo", "300*86400 -> 10mo"); + d = OldDuration (291*86400); t.is (d.formatCompact (), "9mo", "291*86400 -> 9mo"); + d = OldDuration (292*86400); t.is (d.formatCompact (), "9mo", "292*86400 -> 9mo"); + d = OldDuration (293*86400); t.is (d.formatCompact (), "9mo", "293*86400 -> 9mo"); + d = OldDuration (294*86400); t.is (d.formatCompact (), "9mo", "294*86400 -> 9mo"); + d = OldDuration (295*86400); t.is (d.formatCompact (), "9mo", "295*86400 -> 9mo"); + d = OldDuration (296*86400); t.is (d.formatCompact (), "9mo", "296*86400 -> 9mo"); + d = OldDuration (297*86400); t.is (d.formatCompact (), "9mo", "297*86400 -> 9mo"); + d = OldDuration (298*86400); t.is (d.formatCompact (), "9mo", "298*86400 -> 9mo"); + d = OldDuration (299*86400); t.is (d.formatCompact (), "9mo", "299*86400 -> 9mo"); + d = OldDuration (300*86400); t.is (d.formatCompact (), "10mo", "300*86400 -> 10mo"); - d = Duration (301*86400); t.is (d.formatCompact (), "10mo", "301*86400 -> 10mo"); - d = Duration (302*86400); t.is (d.formatCompact (), "10mo", "302*86400 -> 10mo"); - d = Duration (303*86400); t.is (d.formatCompact (), "10mo", "303*86400 -> 10mo"); - d = Duration (304*86400); t.is (d.formatCompact (), "10mo", "304*86400 -> 10mo"); - d = Duration (305*86400); t.is (d.formatCompact (), "10mo", "305*86400 -> 10mo"); - d = Duration (306*86400); t.is (d.formatCompact (), "10mo", "306*86400 -> 10mo"); - d = Duration (307*86400); t.is (d.formatCompact (), "10mo", "307*86400 -> 10mo"); - d = Duration (308*86400); t.is (d.formatCompact (), "10mo", "308*86400 -> 10mo"); - d = Duration (309*86400); t.is (d.formatCompact (), "10mo", "309*86400 -> 10mo"); - d = Duration (310*86400); t.is (d.formatCompact (), "10mo", "310*86400 -> 10mo"); + d = OldDuration (301*86400); t.is (d.formatCompact (), "10mo", "301*86400 -> 10mo"); + d = OldDuration (302*86400); t.is (d.formatCompact (), "10mo", "302*86400 -> 10mo"); + d = OldDuration (303*86400); t.is (d.formatCompact (), "10mo", "303*86400 -> 10mo"); + d = OldDuration (304*86400); t.is (d.formatCompact (), "10mo", "304*86400 -> 10mo"); + d = OldDuration (305*86400); t.is (d.formatCompact (), "10mo", "305*86400 -> 10mo"); + d = OldDuration (306*86400); t.is (d.formatCompact (), "10mo", "306*86400 -> 10mo"); + d = OldDuration (307*86400); t.is (d.formatCompact (), "10mo", "307*86400 -> 10mo"); + d = OldDuration (308*86400); t.is (d.formatCompact (), "10mo", "308*86400 -> 10mo"); + d = OldDuration (309*86400); t.is (d.formatCompact (), "10mo", "309*86400 -> 10mo"); + d = OldDuration (310*86400); t.is (d.formatCompact (), "10mo", "310*86400 -> 10mo"); - d = Duration (311*86400); t.is (d.formatCompact (), "10mo", "311*86400 -> 10mo"); - d = Duration (312*86400); t.is (d.formatCompact (), "10mo", "312*86400 -> 10mo"); - d = Duration (313*86400); t.is (d.formatCompact (), "10mo", "313*86400 -> 10mo"); - d = Duration (314*86400); t.is (d.formatCompact (), "10mo", "314*86400 -> 10mo"); - d = Duration (315*86400); t.is (d.formatCompact (), "10mo", "315*86400 -> 10mo"); - d = Duration (316*86400); t.is (d.formatCompact (), "10mo", "316*86400 -> 10mo"); - d = Duration (317*86400); t.is (d.formatCompact (), "10mo", "317*86400 -> 10mo"); - d = Duration (318*86400); t.is (d.formatCompact (), "10mo", "318*86400 -> 10mo"); - d = Duration (319*86400); t.is (d.formatCompact (), "10mo", "319*86400 -> 10mo"); - d = Duration (320*86400); t.is (d.formatCompact (), "10mo", "320*86400 -> 10mo"); + d = OldDuration (311*86400); t.is (d.formatCompact (), "10mo", "311*86400 -> 10mo"); + d = OldDuration (312*86400); t.is (d.formatCompact (), "10mo", "312*86400 -> 10mo"); + d = OldDuration (313*86400); t.is (d.formatCompact (), "10mo", "313*86400 -> 10mo"); + d = OldDuration (314*86400); t.is (d.formatCompact (), "10mo", "314*86400 -> 10mo"); + d = OldDuration (315*86400); t.is (d.formatCompact (), "10mo", "315*86400 -> 10mo"); + d = OldDuration (316*86400); t.is (d.formatCompact (), "10mo", "316*86400 -> 10mo"); + d = OldDuration (317*86400); t.is (d.formatCompact (), "10mo", "317*86400 -> 10mo"); + d = OldDuration (318*86400); t.is (d.formatCompact (), "10mo", "318*86400 -> 10mo"); + d = OldDuration (319*86400); t.is (d.formatCompact (), "10mo", "319*86400 -> 10mo"); + d = OldDuration (320*86400); t.is (d.formatCompact (), "10mo", "320*86400 -> 10mo"); - d = Duration (321*86400); t.is (d.formatCompact (), "10mo", "321*86400 -> 10mo"); - d = Duration (322*86400); t.is (d.formatCompact (), "10mo", "322*86400 -> 10mo"); - d = Duration (323*86400); t.is (d.formatCompact (), "10mo", "323*86400 -> 10mo"); - d = Duration (324*86400); t.is (d.formatCompact (), "10mo", "324*86400 -> 10mo"); - d = Duration (325*86400); t.is (d.formatCompact (), "10mo", "325*86400 -> 10mo"); - d = Duration (326*86400); t.is (d.formatCompact (), "10mo", "326*86400 -> 10mo"); - d = Duration (327*86400); t.is (d.formatCompact (), "10mo", "327*86400 -> 10mo"); - d = Duration (328*86400); t.is (d.formatCompact (), "10mo", "328*86400 -> 10mo"); - d = Duration (329*86400); t.is (d.formatCompact (), "10mo", "329*86400 -> 10mo"); - d = Duration (330*86400); t.is (d.formatCompact (), "11mo", "330*86400 -> 11mo"); + d = OldDuration (321*86400); t.is (d.formatCompact (), "10mo", "321*86400 -> 10mo"); + d = OldDuration (322*86400); t.is (d.formatCompact (), "10mo", "322*86400 -> 10mo"); + d = OldDuration (323*86400); t.is (d.formatCompact (), "10mo", "323*86400 -> 10mo"); + d = OldDuration (324*86400); t.is (d.formatCompact (), "10mo", "324*86400 -> 10mo"); + d = OldDuration (325*86400); t.is (d.formatCompact (), "10mo", "325*86400 -> 10mo"); + d = OldDuration (326*86400); t.is (d.formatCompact (), "10mo", "326*86400 -> 10mo"); + d = OldDuration (327*86400); t.is (d.formatCompact (), "10mo", "327*86400 -> 10mo"); + d = OldDuration (328*86400); t.is (d.formatCompact (), "10mo", "328*86400 -> 10mo"); + d = OldDuration (329*86400); t.is (d.formatCompact (), "10mo", "329*86400 -> 10mo"); + d = OldDuration (330*86400); t.is (d.formatCompact (), "11mo", "330*86400 -> 11mo"); - d = Duration (331*86400); t.is (d.formatCompact (), "11mo", "331*86400 -> 11mo"); - d = Duration (332*86400); t.is (d.formatCompact (), "11mo", "332*86400 -> 11mo"); - d = Duration (333*86400); t.is (d.formatCompact (), "11mo", "333*86400 -> 11mo"); - d = Duration (334*86400); t.is (d.formatCompact (), "11mo", "334*86400 -> 11mo"); - d = Duration (335*86400); t.is (d.formatCompact (), "11mo", "335*86400 -> 11mo"); - d = Duration (336*86400); t.is (d.formatCompact (), "11mo", "336*86400 -> 11mo"); - d = Duration (337*86400); t.is (d.formatCompact (), "11mo", "337*86400 -> 11mo"); - d = Duration (338*86400); t.is (d.formatCompact (), "11mo", "338*86400 -> 11mo"); - d = Duration (339*86400); t.is (d.formatCompact (), "11mo", "339*86400 -> 11mo"); - d = Duration (340*86400); t.is (d.formatCompact (), "11mo", "340*86400 -> 11mo"); + d = OldDuration (331*86400); t.is (d.formatCompact (), "11mo", "331*86400 -> 11mo"); + d = OldDuration (332*86400); t.is (d.formatCompact (), "11mo", "332*86400 -> 11mo"); + d = OldDuration (333*86400); t.is (d.formatCompact (), "11mo", "333*86400 -> 11mo"); + d = OldDuration (334*86400); t.is (d.formatCompact (), "11mo", "334*86400 -> 11mo"); + d = OldDuration (335*86400); t.is (d.formatCompact (), "11mo", "335*86400 -> 11mo"); + d = OldDuration (336*86400); t.is (d.formatCompact (), "11mo", "336*86400 -> 11mo"); + d = OldDuration (337*86400); t.is (d.formatCompact (), "11mo", "337*86400 -> 11mo"); + d = OldDuration (338*86400); t.is (d.formatCompact (), "11mo", "338*86400 -> 11mo"); + d = OldDuration (339*86400); t.is (d.formatCompact (), "11mo", "339*86400 -> 11mo"); + d = OldDuration (340*86400); t.is (d.formatCompact (), "11mo", "340*86400 -> 11mo"); - d = Duration (341*86400); t.is (d.formatCompact (), "11mo", "341*86400 -> 11mo"); - d = Duration (342*86400); t.is (d.formatCompact (), "11mo", "342*86400 -> 11mo"); - d = Duration (343*86400); t.is (d.formatCompact (), "11mo", "343*86400 -> 11mo"); - d = Duration (344*86400); t.is (d.formatCompact (), "11mo", "344*86400 -> 11mo"); - d = Duration (345*86400); t.is (d.formatCompact (), "11mo", "345*86400 -> 11mo"); - d = Duration (346*86400); t.is (d.formatCompact (), "11mo", "346*86400 -> 11mo"); - d = Duration (347*86400); t.is (d.formatCompact (), "11mo", "347*86400 -> 11mo"); - d = Duration (348*86400); t.is (d.formatCompact (), "11mo", "348*86400 -> 11mo"); - d = Duration (349*86400); t.is (d.formatCompact (), "11mo", "349*86400 -> 11mo"); - d = Duration (350*86400); t.is (d.formatCompact (), "11mo", "350*86400 -> 11mo"); + d = OldDuration (341*86400); t.is (d.formatCompact (), "11mo", "341*86400 -> 11mo"); + d = OldDuration (342*86400); t.is (d.formatCompact (), "11mo", "342*86400 -> 11mo"); + d = OldDuration (343*86400); t.is (d.formatCompact (), "11mo", "343*86400 -> 11mo"); + d = OldDuration (344*86400); t.is (d.formatCompact (), "11mo", "344*86400 -> 11mo"); + d = OldDuration (345*86400); t.is (d.formatCompact (), "11mo", "345*86400 -> 11mo"); + d = OldDuration (346*86400); t.is (d.formatCompact (), "11mo", "346*86400 -> 11mo"); + d = OldDuration (347*86400); t.is (d.formatCompact (), "11mo", "347*86400 -> 11mo"); + d = OldDuration (348*86400); t.is (d.formatCompact (), "11mo", "348*86400 -> 11mo"); + d = OldDuration (349*86400); t.is (d.formatCompact (), "11mo", "349*86400 -> 11mo"); + d = OldDuration (350*86400); t.is (d.formatCompact (), "11mo", "350*86400 -> 11mo"); - d = Duration (351*86400); t.is (d.formatCompact (), "11mo", "351*86400 -> 11mo"); - d = Duration (352*86400); t.is (d.formatCompact (), "11mo", "352*86400 -> 11mo"); - d = Duration (353*86400); t.is (d.formatCompact (), "11mo", "353*86400 -> 11mo"); - d = Duration (354*86400); t.is (d.formatCompact (), "11mo", "354*86400 -> 11mo"); - d = Duration (355*86400); t.is (d.formatCompact (), "11mo", "355*86400 -> 11mo"); - d = Duration (356*86400); t.is (d.formatCompact (), "11mo", "356*86400 -> 11mo"); - d = Duration (357*86400); t.is (d.formatCompact (), "11mo", "357*86400 -> 11mo"); - d = Duration (358*86400); t.is (d.formatCompact (), "11mo", "358*86400 -> 11mo"); - d = Duration (359*86400); t.is (d.formatCompact (), "11mo", "359*86400 -> 11mo"); - d = Duration (360*86400); t.is (d.formatCompact (), "12mo", "360*86400 -> 12mo"); + d = OldDuration (351*86400); t.is (d.formatCompact (), "11mo", "351*86400 -> 11mo"); + d = OldDuration (352*86400); t.is (d.formatCompact (), "11mo", "352*86400 -> 11mo"); + d = OldDuration (353*86400); t.is (d.formatCompact (), "11mo", "353*86400 -> 11mo"); + d = OldDuration (354*86400); t.is (d.formatCompact (), "11mo", "354*86400 -> 11mo"); + d = OldDuration (355*86400); t.is (d.formatCompact (), "11mo", "355*86400 -> 11mo"); + d = OldDuration (356*86400); t.is (d.formatCompact (), "11mo", "356*86400 -> 11mo"); + d = OldDuration (357*86400); t.is (d.formatCompact (), "11mo", "357*86400 -> 11mo"); + d = OldDuration (358*86400); t.is (d.formatCompact (), "11mo", "358*86400 -> 11mo"); + d = OldDuration (359*86400); t.is (d.formatCompact (), "11mo", "359*86400 -> 11mo"); + d = OldDuration (360*86400); t.is (d.formatCompact (), "12mo", "360*86400 -> 12mo"); - d = Duration (361*86400); t.is (d.formatCompact (), "12mo", "361*86400 -> 12mo"); - d = Duration (362*86400); t.is (d.formatCompact (), "12mo", "362*86400 -> 12mo"); - d = Duration (363*86400); t.is (d.formatCompact (), "12mo", "363*86400 -> 12mo"); - d = Duration (364*86400); t.is (d.formatCompact (), "12mo", "364*86400 -> 12mo"); - d = Duration (365*86400); t.is (d.formatCompact (), "1.0y", "365*86400 -> 1.0y"); + d = OldDuration (361*86400); t.is (d.formatCompact (), "12mo", "361*86400 -> 12mo"); + d = OldDuration (362*86400); t.is (d.formatCompact (), "12mo", "362*86400 -> 12mo"); + d = OldDuration (363*86400); t.is (d.formatCompact (), "12mo", "363*86400 -> 12mo"); + d = OldDuration (364*86400); t.is (d.formatCompact (), "12mo", "364*86400 -> 12mo"); + d = OldDuration (365*86400); t.is (d.formatCompact (), "1.0y", "365*86400 -> 1.0y"); - d = Duration ("86400"); t.is (d.formatCompact (), "1d", "string '86400' -> 1d"); + d = OldDuration ("86400"); t.is (d.formatCompact (), "1d", "string '86400' -> 1d"); t.ok (d.valid ("daily"), "valid duration daily"); t.ok (d.valid ("day"), "valid duration day"); @@ -724,85 +724,85 @@ int main (int argc, char** argv) t.is (convertDuration ("-"), 0, "valid duration -"); try { - Duration left, right; + OldDuration left, right; // operator< - left = Duration ("1sec"); right = Duration ("2secs"); t.ok (left < right, "duration 1sec < 2secs"); - left = Duration ("-2secs"); right = Duration ("-1sec"); t.ok (left < right, "duration -2secs < -1sec"); - left = Duration ("1sec"); right = Duration ("1min"); t.ok (left < right, "duration 1sec < 1min"); - left = Duration ("1min"); right = Duration ("1hr"); t.ok (left < right, "duration 1min < 1hr"); - left = Duration ("1hr"); right = Duration ("1d"); t.ok (left < right, "duration 1hr < 1d"); - left = Duration ("1d"); right = Duration ("1w"); t.ok (left < right, "duration 1d < 1w"); - left = Duration ("1w"); right = Duration ("1mo"); t.ok (left < right, "duration 1w < 1mo"); - left = Duration ("1mo"); right = Duration ("1q"); t.ok (left < right, "duration 1mo < 1q"); - left = Duration ("1q"); right = Duration ("1y"); t.ok (left < right, "duration 1q < 1y"); + left = OldDuration ("1sec"); right = OldDuration ("2secs"); t.ok (left < right, "duration 1sec < 2secs"); + left = OldDuration ("-2secs"); right = OldDuration ("-1sec"); t.ok (left < right, "duration -2secs < -1sec"); + left = OldDuration ("1sec"); right = OldDuration ("1min"); t.ok (left < right, "duration 1sec < 1min"); + left = OldDuration ("1min"); right = OldDuration ("1hr"); t.ok (left < right, "duration 1min < 1hr"); + left = OldDuration ("1hr"); right = OldDuration ("1d"); t.ok (left < right, "duration 1hr < 1d"); + left = OldDuration ("1d"); right = OldDuration ("1w"); t.ok (left < right, "duration 1d < 1w"); + left = OldDuration ("1w"); right = OldDuration ("1mo"); t.ok (left < right, "duration 1w < 1mo"); + left = OldDuration ("1mo"); right = OldDuration ("1q"); t.ok (left < right, "duration 1mo < 1q"); + left = OldDuration ("1q"); right = OldDuration ("1y"); t.ok (left < right, "duration 1q < 1y"); - left = Duration ("-3s"); right = Duration ("-6s"); t.ok (right < left, "duration -6s < -3s"); + left = OldDuration ("-3s"); right = OldDuration ("-6s"); t.ok (right < left, "duration -6s < -3s"); // operator> - left = Duration ("2secs"); right = Duration ("1sec"); t.ok (left > right, "2sec > 1secs"); - left = Duration ("-1sec"); right = Duration ("-2secs"); t.ok (left > right, "-1secs > -2sec"); - left = Duration ("1min"); right = Duration ("1sec"); t.ok (left > right, "1min > 1sec"); - left = Duration ("1hr"); right = Duration ("1min"); t.ok (left > right, "1hr > 1min"); - left = Duration ("1d"); right = Duration ("1hr"); t.ok (left > right, "1d > 1hr"); - left = Duration ("1w"); right = Duration ("1d"); t.ok (left > right, "1w > 1d"); - left = Duration ("1mo"); right = Duration ("1w"); t.ok (left > right, "1mo > 1w"); - left = Duration ("1q"); right = Duration ("1mo"); t.ok (left > right, "1q > 1mo"); - left = Duration ("1y"); right = Duration ("1q"); t.ok (left > right, "1y > 1q"); + left = OldDuration ("2secs"); right = OldDuration ("1sec"); t.ok (left > right, "2sec > 1secs"); + left = OldDuration ("-1sec"); right = OldDuration ("-2secs"); t.ok (left > right, "-1secs > -2sec"); + left = OldDuration ("1min"); right = OldDuration ("1sec"); t.ok (left > right, "1min > 1sec"); + left = OldDuration ("1hr"); right = OldDuration ("1min"); t.ok (left > right, "1hr > 1min"); + left = OldDuration ("1d"); right = OldDuration ("1hr"); t.ok (left > right, "1d > 1hr"); + left = OldDuration ("1w"); right = OldDuration ("1d"); t.ok (left > right, "1w > 1d"); + left = OldDuration ("1mo"); right = OldDuration ("1w"); t.ok (left > right, "1mo > 1w"); + left = OldDuration ("1q"); right = OldDuration ("1mo"); t.ok (left > right, "1q > 1mo"); + left = OldDuration ("1y"); right = OldDuration ("1q"); t.ok (left > right, "1y > 1q"); - left = Duration ("-3s"); right = Duration ("-6s"); t.ok (left > right, "duration -3s > -6s"); + left = OldDuration ("-3s"); right = OldDuration ("-6s"); t.ok (left > right, "duration -3s > -6s"); // operator<= - left = Duration ("1sec"); right = Duration ("2secs"); t.ok (left <= right, "duration 1sec <= 2secs"); - left = Duration ("2secs"); right = Duration ("2secs"); t.ok (left <= right, "duration 1sec <= 2secs"); - left = Duration ("2secs"); right = Duration ("1secs"); t.notok (left <= right, "duration NOT 1sec <= 2secs"); + left = OldDuration ("1sec"); right = OldDuration ("2secs"); t.ok (left <= right, "duration 1sec <= 2secs"); + left = OldDuration ("2secs"); right = OldDuration ("2secs"); t.ok (left <= right, "duration 1sec <= 2secs"); + left = OldDuration ("2secs"); right = OldDuration ("1secs"); t.notok (left <= right, "duration NOT 1sec <= 2secs"); // operator>= - left = Duration ("1sec"); right = Duration ("2secs"); t.notok (left >= right, "duration NOT 1sec >= 2secs"); - left = Duration ("2secs"); right = Duration ("2secs"); t.ok (left >= right, "duration 1sec >= 2secs"); - left = Duration ("2secs"); right = Duration ("1secs"); t.ok (left >= right, "duration 1sec >= 2secs"); + left = OldDuration ("1sec"); right = OldDuration ("2secs"); t.notok (left >= right, "duration NOT 1sec >= 2secs"); + left = OldDuration ("2secs"); right = OldDuration ("2secs"); t.ok (left >= right, "duration 1sec >= 2secs"); + left = OldDuration ("2secs"); right = OldDuration ("1secs"); t.ok (left >= right, "duration 1sec >= 2secs"); // operator+ - left = Duration (1); - right = Duration (2); - Duration result = left + right; + left = OldDuration (1); + right = OldDuration (2); + OldDuration result = left + right; t.is ((int)(time_t)left, 1, "1 + 2 = 3, 1 is still 1"); t.is ((int)(time_t)right, 2, "1 + 2 = 3, 2 is still 2"); t.is ((int)(time_t)result, 3, "1 + 2 = 3"); // operator+= - left = Duration (1); - right = Duration (2); + left = OldDuration (1); + right = OldDuration (2); left += right; t.is ((int)(time_t)left, 3, "1 += 2, 1 is now 3"); t.is ((int)(time_t)right, 2, "1 += 2, 2 is still 2"); // operator- - left = Duration (3); - right = Duration (2); + left = OldDuration (3); + right = OldDuration (2); result = left - right; t.is ((int)(time_t)left, 3, "3 - 2 = 1, 3 is still 3"); t.is ((int)(time_t)right, 2, "3 - 2 = 1, 2 is still 2"); t.is ((int)(time_t)result, 1, "3 - 2 = 1"); // operator-= - left = Duration (3); - right = Duration (2); + left = OldDuration (3); + right = OldDuration (2); left -= right; t.is ((int)(time_t)left, 1, "3 -= 2, 3 is now 1"); t.is ((int)(time_t)right, 2, "3 -= 2, 2 is still 2"); // Assorted regression tests. - left = Duration ("-864000.00000"); + left = OldDuration ("-864000.00000"); t.is ((int)(time_t)left, 864000, "-864000.00000 -> 864000"); } catch (const std::string& e) { t.diag (e); } catch (...) { t.diag ("Unknown error"); } - // Duration::negative - t.ok ( Duration ("-1day").negative (), "-1day is negative"); - t.ok (! Duration ("1day").negative (), "1day is not negative"); + // OldDuration::negative + t.ok ( OldDuration ("-1day").negative (), "-1day is negative"); + t.ok (! OldDuration ("1day").negative (), "1day is not negative"); return 0; }