Last active
February 2, 2018 04:06
-
-
Save danthemango/242ea3872fb9dbbd832420c6c579d066 to your computer and use it in GitHub Desktop.
Testcasing Makefile
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
############################################### | |
## Filename: Makefile | |
## Author: Daniel Guenther | |
## Date: 2018-01-31 | |
## Purpose: To quickly create and run test cases for a small program | |
############################################### | |
program=gcl -f lab3.cl | |
testdir=Tests | |
# runs the newest test | |
runNewTest: ${testdir} ${progname} | |
${program} < ${testdir}/`ls -t ${testdir} | head -1` | |
# runs program with each test case found in testing directory | |
runTests: ${testdir} ${progname} | |
echo; for testfile in `ls ${testdir}/`; do ${program} < ${testdir}/$$testfile; echo; done | |
# quickly create a new one-line test case (prompts user for test contents, generates new filename) | |
newTest: ${testdir} | |
i=0;while [ -f ${testdir}/test$$i ]; do i=$$(($$i+1)); done; read input && echo $$input > ${testdir}/test$$i | |
${testdir}: | |
mkdir -p ${testdir} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you want to make a new lisp testing file, just type in:
which will create a file which can be used as input to the lisp program (a list of lists then a number, which is what's needed for lab3). You can then immediately run this new test with
make runNewTest
.By default it will create a file called Tests/test0 (or Tests/test1 or Tests/test2 or Tests/testN for a number N that hasn't already been taken) which may be used as an input file for lab3.cl (e.g.
gcl -f lab3.cl < Tests/test0
, or run all tests withmake runTests
)