[Toybox] factor tests broken by commit e8427bfd008be233aadea49e89075451c8a9ceee
Andy Chu
andychup at gmail.com
Fri Mar 11 21:49:13 PST 2016
https://github.com/landley/toybox/commit/e8427bfd008be233aadea49e89075451c8a9ceee
Before this commit, the first test in tests/factor.test succeeds:
testing "factor -32" "factor -32" "-32: -1 2 2 2 2 2\n" "" ""
After this commit, it fails.
$ make test_factor
...
FAIL: factor -32
FWIW, GNU coreutils factor doesn't care about negative numbers, so the
right fix might be just to get rid of the test case and get rid of the
(l < 0) check. Although then strtoul seems to convert the '-1' to a
large unsigned long, so probably another check is needed.
$ factor --version
factor (GNU coreutils) 8.21
$ factor -- -32
factor: ‘-32’ is not a valid positive integer
FYI I found this through compiling with clang, e.g. 'make CC=clang'.
And after that I saw that the test fails.
..................toys/other/factor.c:40:11: warning: comparison of
unsigned expression < 0 is always false [-Wtautological-compare]
if (l < 0) {
~ ^ ~
I'm just looking through the code, so this has no particular urgency.
But it seems like it would be better if there was a known test
environment so that trivial failures like this are more obvious (see
last message) .
Andy
More information about the Toybox
mailing list