Commit Graph
297 Commits
Author SHA1 Message Date
Joseph Crail 2bde7872c5 Add tests for base64. 2015-05-28 23:25:13 -04:00
Joseph Crail b4b08de42c Switch to external getopts cargo (part 1).
I switched over to the getopts crate on crates.io, instead of Rust's
private implementation. This will allow coreutils to build for Rust 1.0.

I'm splitting the updates into several commits for better reviewing.
2015-05-20 22:47:30 -04:00
Joseph Crail 9d74bbe532 Add initial tests for hashsum. 2015-05-16 18:03:09 -04:00
Heather 3cc357e118 Merge pull request #601 from kwantam/master
improved Sieve implementation ; add `cargo update`
2015-05-16 08:25:23 +03:00
Joseph Crail 906ba3e24a Add tests for unlink. 2015-05-15 20:11:54 -04:00
kwantam e1dac4695e improved Sieve implementation ; add cargo update
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`.
2015-05-15 19:39:43 -04:00
Joseph Crail 497c04ad44 Add tests for rm. 2015-05-15 19:14:42 -04:00
Joseph Crail 481fdd744a Add tests for readlink. 2015-05-12 17:09:41 -04:00
Joseph Crail 82dbd02c03 Add initial test for tsort. 2015-05-09 23:38:48 -04:00
Heather 1f67aaaf8c Merge pull request #585 from jbcrail/add-basename-split-tests
Add initial tests for basename/split.
2015-05-09 22:20:23 +03:00
Joseph Crail 08aea6d549 Add initial test for pwd. 2015-05-09 15:17:26 -04:00
Joseph Crail 9172bb9bd8 Add initial tests for false/true. 2015-05-09 15:17:16 -04:00
Joseph Crail 87e7cc9b44 Add initial tests for echo. 2015-05-09 15:17:01 -04:00
Joseph Crail e700e0d2f4 Add initial tests for dirname. 2015-05-09 15:16:45 -04:00
Joseph Crail 646285f684 Add initial tests for basename. 2015-05-09 13:32:47 -04:00
Joseph Crail 234c81311f Add initial tests for split.
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.
2015-05-09 13:32:30 -04:00
Joseph Crail 5878d9904e Add tests for fold. 2015-05-08 00:58:43 -04:00
kwantam ff24d48e73 modify factor impl to eliminate overflow issue
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.
2015-05-08 00:06:35 -04:00
kwantam 9a806346a9 add test for factor
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.
2015-05-07 18:13:39 -04:00
kwantam 6c4e967fc6 fix and slight optimization for factor
This commit builds upon @wikol's Pollard rho implementation.
It adds the following:

1. A generator for prime inverse tables. With these, we can do
   very fast divisibility tests (a single multiply and comparison)
   for small primes (presently, the first 1000 primes are in the
   table, which means all numbers of ~26 bits or less can be
   factored very quickly.

2. Always try prime inverse tables before jumping into Pollard's
   rho method or using trial division.

3. Since we have eliminated all small factors by the time we're
   done with the table division, only use slow trial division when
   the number is big enough to cause overflow issues in Pollard's
   rho, and jump out of trial division and into Pollard's rho as
   soon as the number is small enough.

4. Updates the Makefile to regenerate the prime table if it's not
   up-to-date.
2015-05-07 18:12:32 -04:00
Heather d290c9bdfd Merge pull request #577 from jbcrail/add-test-check
Add a new makefile rule to check for test errors.
2015-05-08 00:02:07 +03:00
Joseph Crail 0736855c3d Add a new makefile rule to check for test errors.
This rule will test each program, ignore all output, and return pass or
fail depending on whether the test has errors. This is the equivalent of
"make build-check", but for tests.
2015-05-07 16:59:34 -04:00
Joseph Crail 0ea0e7504a Add test for paste. 2015-05-07 16:51:55 -04:00
Joseph Crail 5d7a7fd875 Add test support for env to Makefile. 2015-05-07 00:04:41 -04:00
Joseph Crail 5c1de087af Add a new makefile rule to check for build errors.
This rule will build each program, ignore all output, and return pass or
fail depending on whether the build has errors. This is helpful for
finding out which programs need to be fixed when a new Rust nightly
build inevitably breaks everything.
2015-04-27 01:48:03 -04:00