There are several areas needing improvement:
1) add tests for hard links
2) add implementation for uncommon flags (-d, -L, -n, -P, -r)
3) align error messages more closely with GNU implementation
For those systems that don't have ptx installed by default, I modified
the tests to use pre-calculated results to check against the GNU
implementation.
When creating tests, we could pass a String, &str, or [u8] to the
standard input. Previously, all arguments had to be manually converted
to a reference to a [u8]. This update makes it more ergonomic.
This commit adds `cargo update` to the distclean target in the
makefile. This updates the Cargo.lock file when clearing the
deps directory.
In addition, it adds a faster implementation of the Sieve of
Eratosthenes for use by `src/factor/gen_table.rs` and `test/factor.rs`.
In addition to upgrading to the nightly build, I refactored the method
that creates the directories by switching from a recursive approach to
an iterative one. I also replaced the obsolete fs::mkdir() with a custom
method using fs::create_dir() and libc::chmod(). I added several
diagnostic messages that match the GNU implementation.
Aside from the usual upgrades to sync with the nightly build, I fixed an
unwrap() panic when reading lines with only a newline. I also refactored
the repeated command calls to use helper functions.
I created random data to test several cases. I verified that the data is
split into the correct number of files and can also be reassembled into
the original file.
This change does the following:
1. Updates the arithmetic functions in `src/factor/numeric.rs` to
correctly handle all cases up to 2^64. When numbers are larger
than 2^63, we fall back to slightly slower routines that check
for and handle overflow.
2. Since the arithmetic functions will now not overflow, we no longer
need the safety net trial division implementation. We now always
use Pollard's rho after eliminating small (<=13 bit) primes.
3. Slight tweak in `src/factor/gen_table.rs` to generate the first
1027 primes, which means we test every prime of 13 or fewer bits
before going into Pollard's rho. Includes corresponding update in
`src/factor/prime_table.rs` and the Makefile to reflect this.
4. Add a new test that generates random numbers with exclusively
large (14 to 50 bit) prime factors. This exercises the possible
overflow paths.
5. Add another new test that checks the `is_prime()` function against
a few dozen 64-bit primes. Again this is to exercise possible
overflow paths.
Add a test for `factor`.
This commit also pulls factor's Sieve implementation into its own module
so that the factor test can use it.
Finally, slight refactoring for clarity in gen_table.rs.