Fixed t_units.c so that 'make check' once again works.

This commit is contained in:
Jef Poskanzer 2013-12-09 17:52:59 -08:00
parent c06bc78c65
commit b70c54055f

View File

@ -27,11 +27,19 @@ main(int argc, char **argv)
assert(1024.0 * 1024.0 == unit_atof("1M"));
assert(4.0 * 1024.0 * 1024.0 * 1024.0 == unit_atof("4G"));
#ifdef notdef
/* Obsolete - we no longer make a distinction between upper and lower
** case.
*/
assert(1000.0 * 0.5 == unit_atof("0.5k"));
assert(1000.0 == unit_atof("1k"));
assert(1000.0 * 1000.0 == unit_atof("1m"));
assert(4.0 * 1000.0 * 1000.0 * 1000.0 == unit_atof("4g"));
#endif
assert(1024.0 * 0.5 == unit_atof("0.5k"));
assert(1024.0 == unit_atof("1k"));
assert(1024.0 * 1024.0 == unit_atof("1m"));
assert(4.0 * 1024.0 * 1024.0 * 1024.0 == unit_atof("4g"));
assert(1024 * 0.5 == unit_atoi("0.5K"));
assert(1024 == unit_atoi("1K"));
@ -40,12 +48,21 @@ main(int argc, char **argv)
llu = (iperf_size_t) d;
assert(llu == unit_atoi("4G"));
#ifdef notdef
/* Also obsolete. */
assert(1000 * 0.5 == unit_atoi("0.5k"));
assert(1000 == unit_atoi("1k"));
assert(1000 * 1000 == unit_atoi("1m"));
d = 4.0 * 1000 * 1000 * 1000;
llu = (iperf_size_t) d;
assert(llu == unit_atoi("4g"));
#endif
assert(1024 * 0.5 == unit_atoi("0.5k"));
assert(1024 == unit_atoi("1k"));
assert(1024 * 1024 == unit_atoi("1m"));
d = 4.0 * 1024 * 1024 * 1024;
llu = (iperf_size_t) d;
assert(llu == unit_atoi("4g"));
unit_snprintf(s, 11, 1024.0, 'A');
assert(strncmp(s, "1.00 KByte", 11) == 0);