Commit graph

15 commits

Author SHA1 Message Date
Ryan Geary
fc6a2ddbda Add regression tests for #16 2020-06-08 22:52:47 -04:00
Ryan Geary
a66621380b Add character-wise chooseing
Alphabetize structopt options

Add character-wise tests

Add character-wise switch

Add print-after-end test

Add empty default separator for char-wise mode

Add char-wise forward and negative printing

Add pure reverse printing

Change to char_wise to user `char` instead of `u8`

Adds support for unicode (read: emojis)

Adds a newline char to end of each char-wise test because that's how it
is

Add writing traits for better code structure

Merge repetitive codepaths with generics

Unify print_choice_* funtion names

Reorder functions in choice module

Rename variable to avoid name confusion

Make default case for loop more readable

Abstract default case print loop

Add e2e test

Move vec create to print_choice_negative
2020-06-02 14:41:30 -04:00
Ryan Geary
7243843d2f [FEATURE] specify output field delimiter (#8)
Add output_field_separator option

Add output_field_separator tests

Change structopt req to 0.3

Separate negative choices into a function

Prevent tail printing output_field_separator

Change OFS to Option<String> with a default value of " "

Reorder arguments to write_bytes to parallel print_choice

Print output_separator in main loop if applicable

Add `cargo test` to Makefile

Add write_separator function
2020-04-06 17:13:57 -04:00
Ryan Geary
e78ea2783c Add negative choice and parsing tests
Allow negative ranges as long as they aren't reversed too

Allow reversed negative ranges iff both indices are negative
2020-04-01 13:15:32 -04:00
Ryan Geary
41e060680e Handle failure to open input file 2020-03-17 13:43:49 -04:00
Ryan Geary
dfe4c2cad0 Reassign exit codes and clean up e2e_test
0 - Success
1 - Argument parsing error
2 - Regex compilation error
2020-03-17 13:26:35 -04:00
Ryan Geary
389c29822b Improve performance and add profiling tooling
Add tags, todo, *.bench, *.svg and bench_output to .gitignore

Add test/bench.sh script. bench.sh runs the `bench` command on each
test/long*txt file with range 3:5 and saves the output to a file for
comparing performance across file sizes.

Inline printing in get_choice_slice

Change BufWriter<..stdout..> to BufWriter<T>

Add MockStdout for testing printing

Add more reverse range tests

Simplify word finding with a more uniform bounds check.

Add Makefile for generating flamegraphs

Redefine Choice struct as a start and end integer

Improve algorithm for finding words to print

Settle exclusivity at Config construction time

Add tests for nonexistant field_seps

Add regression test for preceding separator

Use handle.write instead of write! macro for tremendous speed up
2020-03-10 00:03:14 -04:00
Ryan Geary
f662219407 [BREAKING] Default to inclusive ranges, -x for exclusive 2019-10-13 22:00:15 -04:00
Ryan Geary
0be16bf1d9 Add reverse ranges 2019-10-13 21:40:59 -04:00
Ryan Geary
e28bdcce12 Add cargo test to e2etest 2019-09-17 23:48:59 -04:00
Ryan Geary
4eb2ed0396 Test return value on error with e2e test 2019-09-17 23:40:35 -04:00
Ryan Geary
18dcf845fb Add choose 12 test 2019-09-11 11:50:49 -04:00
Ryan Geary
44e5446992 Rename test to e2e_test 2019-09-10 23:51:59 -04:00
Ryan Geary
1d4fd6f48e Ignore all whitespace in testing 2019-09-10 23:51:21 -04:00
Ryan Geary
4b6d44e121 Add basic test suite 2019-09-10 23:36:39 -04:00