Bug Fix - broken unit tests on Ubuntu

- Fixed util.cpp formatSeconds and formatSecondsCompact, that were using
  an algorithm that accentuated rounding errors.
- Fixed unit tests that were expecting wrong answers from the wrong
  algorithm above.
This commit is contained in:
Paul Beckingham 2009-12-12 11:30:20 -05:00
parent 37411c7521
commit eaeca45eae
2 changed files with 21 additions and 22 deletions

View file

@ -62,7 +62,7 @@ int main (int argc, char** argv)
t.is (formatSeconds (85 * 86400 - 1), "2 mths", "85 days - 1 sec -> 2 mths");
t.is (formatSeconds (85 * 86400), "2 mths", "85 days -> 2 mths");
t.is (formatSeconds (85 * 86400 + 1), "2 mths", "85 days + 1 sec -> 2 mths");
t.is (formatSeconds (365 * 86400 - 1), "1.0 yrs", "365 days - 1 sec -> 1.0 yrs");
t.is (formatSeconds (365 * 86400 - 1), "11 mths", "365 days - 1 sec -> 11 mths");
t.is (formatSeconds (365 * 86400), "1.0 yrs", "365 days -> 1.0 yrs");
t.is (formatSeconds (365 * 86400 + 1), "1.0 yrs", "365 days + 1 sec -> 1.0 yrs");
@ -87,7 +87,7 @@ int main (int argc, char** argv)
t.is (formatSecondsCompact (85 * 86400 - 1), "2mo", "85 days - 1 sec -> 2mo");
t.is (formatSecondsCompact (85 * 86400), "2mo", "85 days -> 2mo");
t.is (formatSecondsCompact (85 * 86400 + 1), "2mo", "85 days + 1 sec -> 2mo");
t.is (formatSecondsCompact (365 * 86400 - 1), "1.0y", "365 days - 1 sec -> 1.0y");
t.is (formatSecondsCompact (365 * 86400 - 1), "11mo", "365 days - 1 sec -> 11mo");
t.is (formatSecondsCompact (365 * 86400), "1.0y", "365 days -> 1.0y");
t.is (formatSecondsCompact (365 * 86400 + 1), "1.0y", "365 days + 1 sec -> 1.0y");