Created
February 6, 2015 04:43
-
-
Save cgmb/f05b9763a675461437c9 to your computer and use it in GitHub Desktop.
An end-to-end test implemented in bash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# the above line specifies the program used to run this script | |
# run like: ./acceptance_test.sh ascending 100 merge | |
# or: bash acceptance_test.sh ascending 100 merge | |
# bash is a very easy language to make mistakes in | |
# let's set a few flags that help catch errors | |
set -e # exit on error | |
set -u # make the use of non-existant variables an error | |
set -o pipefail # propogate errors through | pipelines | |
# run our program. $1, $2 and $3 represent the command-line arguments passed to this script | |
java Assign1 $1 $2 $3 out.txt | |
# <() runs commands in a new shell and lets you use the output as if it were a file | |
# cat reads a file and prints the output | |
# sort -n sorts its input numerically | |
diff <(cat out.txt) <(cat out.txt | sort -n) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment