I am trying to write a shell script for testing my programs. I am having a few fundamental questions regarding it:
* Goal: The shell script must be able to test certain programs and determine if they have passes the tests or failed them.
* My approach: There are 2 things we need to deal with here-> the input to the program and the corresponding output from the program. Inorder to do this suppose we have I/O test files like: mytest.in and mytest.out and use them for testing
* Question: My roadblocks here are- how do we pass in mytest.in to the program(say program.c) i.e how is input redirection done in this case. And after doing this, how can we get the output and compare it with those in mytest.out ?
Notes:
-> The input supplied to the files is through stdin, assume that the program doesn't take parameters through command line
-> Assume that we use the shell script in this manner:
./testscript tests folder program
It would be really nice if you could give an example demonstrating this.
Asked by Mathew
(145 rep)
Oct 1, 2015, 07:04 PM
Last activity: Apr 7, 2025, 11:21 AM
Last activity: Apr 7, 2025, 11:21 AM