CmdChart: Added assert for non-negative totals

This commit is contained in:
Paul Beckingham 2016-07-04 09:44:14 -04:00
parent 1dc8eb7b4f
commit 44e5dd7b84

View file

@ -36,6 +36,7 @@
#include <algorithm> #include <algorithm>
#include <iostream> #include <iostream>
#include <iomanip> #include <iomanip>
#include <cassert>
int renderChart (const CLI&, const std::string&, Interval&, Rules&, Database&); int renderChart (const CLI&, const std::string&, Interval&, Rules&, Database&);
static void determineHourRange (const std::string&, const Rules&, const Interval&, const std::vector <Interval>&, int&, int&); static void determineHourRange (const std::string&, const Rules&, const Interval&, const std::vector <Interval>&, int&, int&);
@ -652,6 +653,7 @@ static std::string renderSummary (
} }
auto total_available = filter.range.total () - total_unavailable; auto total_available = filter.range.total () - total_unavailable;
assert (total_available >= 0);
auto total_remaining = total_available - total_worked; auto total_remaining = total_available - total_worked;
out << '\n' out << '\n'