If I have a program, its input and the desired output, how do I automate the comparison of what I want the program to give me and what it actually gives me? For example:a=${./program < inputfile}diff ${a} outputfile
How should I write a test environment for my program?
programming
diff takes filenames as arguments -- you passed the data from the stdout of the command, instead. If you're using bash, zsh, or another similar shell you can use process substition:diff <(./program < inputfile) outputfileOr, POSIXly (you can also use a named pipe, but it's probably overkill):./program < inputfile > /tmp/program-outdiff /tmp/program-out outputfilerm /tmp/program-out