39 assert(str ==
" -127 b");
46 assert(str ==
" 1023 b");
53 assert(str ==
" 1.0Kb");
60 assert(str ==
" 1.1Kb");
71 assert(str ==
"156.78Pb");
83 assert(str ==
" 156.0Pb");
96 assert(str ==
" 156.0Pb");
120 assert(str ==
"100");
126 assert(str ==
"1,000");
132 assert(str ==
"10,000");
138 assert(str ==
"100,000");
144 assert(str ==
"1,000,000");
156 assert(str ==
" 10");
162 assert(str ==
" 100");
168 assert(str ==
" 1,000");
174 assert(str ==
" 10,000");
180 assert(str ==
" 100,000");
186 assert(str ==
"1,000,000");
199 assert(str ==
" -127 b/s");
206 assert(str ==
" 1023 b/s");
213 assert(str ==
" 1.0Kb/s");
220 assert(str ==
" 1.1Kb/s");
231 assert(str ==
"156.78Pb/s");
243 assert(str ==
" 156.0Pb/s");
256 assert(str ==
" 156.0Pb/s");
261 const uint8 max = max_limit<uint8>();
264 std::string::size_type s_len;
265 std::string::size_type idx;
267 for (x = 0; x != max; ++x) {
275 <<
static_cast<unsigned int>(x)
277 << static_cast<unsigned int>(max)
282 assert(s_len - idx < 4);
287 int main(
int argc,
char const * argv[])
Basic types definitions and templates.
int main(int argc, char const *argv[])
std::string percent_string(const T &a_complete, const T &a_total)
Given a count complete and a count total, calculate a percentage.
std::string num_to_string(T a_t, uint16 a_width=0)
Given an integral number, return a string with the number formatted in a generic, human-readable form...
std::string throughput_to_string(T a_t, const std::string &a_base_size_unit="b", const std::string &a_base_time_unit="s", uint16 a_width=10, uint16 a_precision=1, uint16 a_kilo=1024)
Given an integral number, return a string with the number formated as a number of machine-type size p...
std::string size_to_string(T a_t, const std::string &a_base_size_unit="b", uint16 a_width=8, uint16 a_precision=1, uint16 a_kilo=1024)
Given an integral number, return a string with the number formatted as a human-readable machine-type ...