Commit graph

1359 commits

Author SHA1 Message Date
Heather
478fe40d3b Merge pull request #584 from jbcrail/fix-basename-bug
Fix basename when trailing slashes are present.
2015-05-09 22:19:06 +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
3abf19a595 Fix basename when trailing slashes are present.
The GNU implementation first strips all trailing slashes before deleting
the directory portion. This case wasn't handled.

I also rewrote the method that strips the directory to use the PathBuf
methods for improved platform-indepedence.
2015-05-09 13:23:48 -04:00
Heather
39de3f7b71 Merge pull request #581 from kwantam/master
fix `rm` and `rmdir`
2015-05-09 08:11:28 +03:00
Heather
df27f5035c Merge pull request #582 from jbcrail/fix-split
Fix split.
2015-05-09 08:10:50 +03:00
Joseph Crail
10339e6c32 Fix split.
I upgraded to the nightly build.
2015-05-08 23:11:15 -04:00
kwantam
a3acb00394 fix rmdir 2015-05-08 20:24:03 -04:00
kwantam
4854eb238d fix rm
In addition, this commit brings the behavior of `rm` better in line
with the behavior of GNU Coreutils rm, especially as regarding recursive
interactive deletion of directories. This version asks to delete files
in a different order from GNU rm, but it now gives the option of stopping
the recursion at each new directory that is reached.
2015-05-08 19:42:19 -04:00
Heather
7cb74885c4 Merge pull request #579 from jbcrail/update-fold
Update fold and add tests.
2015-05-08 08:05:38 +03:00
Joseph Crail
5878d9904e Add tests for fold. 2015-05-08 00:58:43 -04:00
Joseph Crail
dd19bc27c1 Update fold to nightly build. 2015-05-08 00:57:41 -04:00
Heather
b4c106b004 Merge pull request #578 from jbcrail/fix-broken-seq-tests
Fix broken seq tests.
2015-05-08 07:47:25 +03:00
Heather
4e2cd4dd24 Merge pull request #580 from jbcrail/remove-unused-feature
Remove unused feature from cat.
2015-05-08 07:46:21 +03:00
Heather
a457a870e9 Merge pull request #558 from kwantam/master
slight refactor in `unexpand` ; fix and optimize `factor` ; fix `touch`, `test`, `tac`, `shuf`, `sleep` ; merge PR from @ctjhoa for `cksum`
2015-05-08 07:45:58 +03: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
Joseph Crail
dfaee63cd3 Remove unused feature from cat. 2015-05-07 23:02:47 -04:00
kwantam
7565c27c00 fixed sleep 2015-05-07 18:13:40 -04:00
Camille TJHOA
d8f58305d6 new io cksum (includes BufReader fix)
closes kwantam/coreutils#1 via cherry-pick
2015-05-07 18:13:40 -04:00
kwantam
d89fbedf12 fix shuf 2015-05-07 18:13:39 -04:00
kwantam
4390e4ffa6 fix tac 2015-05-07 18:13:39 -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
cab4f8d570 fix test 2015-05-07 18:12:32 -04:00
kwantam
1c93a793e9 fix touch 2015-05-07 18:12:32 -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
Wiktor Kuropatwa
06b70877db factor: Rho-Pollard factorization implementation 2015-05-07 18:12:32 -04:00
kwantam
cee1837879 slight clarification / refactoring in unexpand
This keeps equivalent functionality but makes the code slightly cleaner.
Also added one more test case.
2015-05-07 18:12:32 -04:00
Joseph Crail
b8fb64a35a Fix broken seq tests. 2015-05-07 17:09:57 -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
Heather
4494a13051 Merge pull request #576 from jbcrail/update-paste
Update paste and add test.
2015-05-08 00:00:38 +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
b00a49eab2 Unescape all special characters in delimiter list. 2015-05-07 16:50:54 -04:00
Joseph Crail
773eeb6d5e Update paste to nightly build. 2015-05-07 16:49:07 -04:00
Heather
22093d1e5a Merge pull request #574 from ctjhoa/master
Update comm to new_io
2015-05-07 07:42:23 +03:00
Heather
fbb8d70e78 Merge pull request #575 from jbcrail/fix-env-with-tests
Fix env and add tests.
2015-05-07 07:41:57 +03:00
Joseph Crail
5d7a7fd875 Add test support for env to Makefile. 2015-05-07 00:04:41 -04:00
Joseph Crail
500bbbfa83 Fix env and add tests.
I updated env to use the nightly build. I also added several tests.
2015-05-06 23:59:58 -04:00
Camille TJHOA
53f62cdd6f Update comm to new_io 2015-05-07 01:05:30 +02:00
Heather
1f2b68251f Merge pull request #573 from jbcrail/fix-link-sum
Fix link and sum.
2015-05-07 00:21:09 +03:00
Heather
5ec1c7bea4 Merge pull request #570 from jbcrail/fix-sort-test
Fix failing test for sort.
2015-05-07 00:19:53 +03:00
Joseph Crail
0c883155f5 Fix sum. 2015-05-06 14:12:30 -04:00
Joseph Crail
6911c7e2ce Fix link. 2015-05-06 13:38:45 -04:00
Joseph Crail
8140208cd0 Check return value of read(). 2015-05-06 13:37:57 -04:00
Heather
7c732bcefe Merge pull request #571 from jbcrail/fix-cp
Fix cp.
2015-05-06 07:43:16 +03:00
Heather
b8232eccab Merge pull request #572 from jbcrail/fix-realpath-relpath
Fix realpath and relpath.
2015-05-06 07:38:46 +03:00