Hi everybody. Does anybody know a way how to test your program in Linux. I know how to do it in Windows 7.
For example (file gr.bat) ::
copy <input_file_name_in_test_data>.in.%1 <input_file_name_default>.in
<executable_file_name>
fc <output_file_name_in_test_data>.out.%1 <output_file_name_default>.out
(you can set the syntax yourself)
to test just enter in cmd gr 1
, gr 2
, ... or gr x
for test x.
Thanx in advance.
cmp command will help. http://en.wikipedia.org/wiki/Cmp_(Unix) In order to get more familiar with this, open your terminal and type cmp --help
Suppose that your executable is named exec and your input files are named input.1 ... input.10 and similarly for output files. In bash, you can write the following script in the bash terminal:
This will check whether the output your program produces for each input file is the same as the output file.
Thanx. how to save your script ( what should be the extension ) ? and how to run it on terminal ?
Save the script with .sh extension. You can run it with
bash <name>.sh
or, if you have set executable permissions for it,./<name>.sh
. All these are to be run on terminal only.