Originally Posted by JonathanWilson
You could use a CGI script to call the g++, etc.
However all that would do is prove the code compiled, not that it generated logically correct working code.
Mind you I suppose if you take the compilation as an initial part of a larger process you could within the CGI call other testing applications to supply known correct and incorrect data and test the resulting outputs.
I did something similar when I played with C## for a bit. I can't remember the term but basically as you write the application/functions/classes you (or someone else) writes a testing script, that way if you change the code in the future or a problem becomes known, the testing script automates and/or adjusts its validation.
Thank You for that response.
I basically have my web application in java with jsp n html. And there is java.lang.runtime which i could use to run some commands in linux.
I wanted to know if i could use the whole part of it like
this is the scenario that i want to have and this is where i want help in knowing will i be able to do that
- User Submits the code say one.cpp
- I get that and need to call g++ one.cpp. ( this i know can be done using runtime class)
- Then I have some input files (test cases) with which i need to run that prog. So instead of typing in the inputs i need to give the data in that test case file as input to ./a.out.
- Then I know that the output of ./a.out can be sent to another file using piping like ./a.out > out.file say.
So i need to know if i can give input to ./a.out from a file and also want to know if there is a way that i could get the g++ compiler error messages like say a syntax error be sent to a file which i can use to indicate the error to the user.