Using an external IDE

I’ve read from time to time about people testing their solutions with Visual Studio.
I’d like to set this up. I often use CodinGame Sync on Chrome to code my solutions in emacs, and I’ve also synced emacs to Visual Studio at times, and I think if I could integrate this more, I’d be able to get better at using VS+emacs while playing.

As far as putting my code into the Cg IDE, it’s fine, the Sync plugin does that just fine, but I’d like to try doing the test runs locally.
I see that, for some bizarre reason, VS doesn’t allow redirecting stdin, stdout and stderr directly. It always pulls up an external window - annoying as *****.
I can create a text file in the project folder and setup VS to read it for stdin by setting Project->Properties->Debugging->Command Arguments to:
< “$(ProjectDir)\input.txt”

OK, but stdout… Has anyone found a way to do this? I mean, I could just use a “res” variable, and then look at the value of the res variable in VS, right? But sometimes, to be fast, I print an expression instead of a variable.

Also - has anyone worked out a way to do this with all tests at once? To have them all written in the input file, but solve one after another? Doesn’t quite seem possible. I mean, to have the same code then work directly on submission…

Correct me if I’m wrong, from what I understand you want to:

  • run the tests locally
  • for this you have created a file which you have told emacs/vs to treat it as stdin, in this file you (I assume) copy the tests provided by the challenge you are currently tackling (via ctrl+c && ctrl+v)
  • now you want to also copy the expected result (stdout) and have it be checked and print PASS/FAIL like the website does?

How are you compiling in emacs? I create a local build.bat which has compilation instructions on what to do. I currently:

  1. launch emacs via a shortcut that first sets vcvarsall.bat
  2. in the build.bat script I have something like
    mkdir build
    pushd build
    cl myprogram
    popd build

and I bind a call to this script via f5

It isn’t inconceivable then, to try to emulate the website functionality by adding more steps to the build script, you could run it inside of a test harness you program yourself.

something like:

~after building~
myProgram.exe 2>&1 myTestHarness.exe input.txt expectedOutput.txt

and have myTestHarness check for correctness.

is this what you’re asking if anyone has made?

I haven’t, but I’ve wanted such functionality for a while, might do it later~ (or never)