Add basic test suite

This commit is contained in:
Ryan Geary 2019-09-10 23:36:39 -04:00
parent ddf563d41b
commit 4b6d44e121
7 changed files with 49 additions and 0 deletions

6
test/choose_0:2.txt Normal file
View file

@ -0,0 +1,6 @@
Lorem ipsum
incididunt ut
nostrud exercitation
Duis aute
fugiat nulla
culpa qui

6
test/choose_0_3.txt Normal file
View file

@ -0,0 +1,6 @@
Lorem sit
incididunt et
nostrud laboris
Duis dolor
fugiat Excepteur
culpa deserunt

6
test/choose_9.txt Normal file
View file

@ -0,0 +1,6 @@
do
ad
commodo
esse
sunt

6
test/choose_9_3.txt Normal file
View file

@ -0,0 +1,6 @@
do sit
ad et
commodo laboris
esse dolor
sunt Excepteur
deserunt

6
test/choose_:2.txt Normal file
View file

@ -0,0 +1,6 @@
Lorem ipsum
incididunt ut
nostrud exercitation
Duis aute
fugiat nulla
culpa qui

6
test/lorem.txt Normal file
View file

@ -0,0 +1,6 @@
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum.

13
test/test.sh Executable file
View file

@ -0,0 +1,13 @@
#!/bin/bash
set -e
test_dir="test"
orig_dir="$(pwd)"
cd "$(git rev-parse --show-toplevel)"
cargo build
diff -Z <(cargo run -- 0:2 -i ${test_dir}/lorem.txt) <(cat "${test_dir}/choose_0:2.txt")
diff -Z <(cargo run -- 0 3 -i ${test_dir}/lorem.txt) <(cat "${test_dir}/choose_0_3.txt")
diff -Z <(cargo run -- :2 -i ${test_dir}/lorem.txt) <(cat "${test_dir}/choose_:2.txt")
diff -Z <(cargo run -- 9 3 -i ${test_dir}/lorem.txt) <(cat "${test_dir}/choose_9_3.txt")
diff -Z <(cargo run -- 9 -i ${test_dir}/lorem.txt) <(cat "${test_dir}/choose_9.txt")