How to evaluate the return value of the program, not the output

How to evaluate the return value of the program, not the output

by Łukasz Krzak -
Number of replies: 3

Dear All,

I've recently started using moodle at our Univeristy, porting the C++ code exercises to VPL. I'm successfully evaluating students' programs with test cases in vpl_evaluate.cases file. However these evaluations are based on the output of the program, and my test cases are already constructed in the way, that relies on the return value. So for example I have a test like this:

int main() {
    if (4 == sum(2,2)) {
         return 0;
    } else {
         return 1;
    }
}

My question is - how can I make VPL to evaluate the return code of the program ?

Average of ratings: -
In reply to Łukasz Krzak

Re: How to evaluate the return value of the program, not the output

by Juan Carlos Rodríguez-del-Pino -
Picture of Particularly helpful Moodlers Picture of Plugin developers
Dear Łukasz Krzak,
VPL version 3.3 included new features, one of them is the check of the exit code of the program ran.

I add part of the 3.3 release notes below:

The new instructions for the test program are:

  • Fail message. This instruction sets the text to show when the case fails. The input and output information is omitted.
  • Program to run: This instruction replaces, for this case, the student’s program for another one. For example, you can use this instruction to run a static/dynamic analysis of the student code.
  • Program arguments. This instruction allows sending information to the student program (or “program to run”) as command-line arguments. Notice that this instruction can be used with the input instruction.
  • Expected exit code. This instruction set the expected exit code of the program case execution. The test case is passed if the exit code match. Notice that the test case can also be passed if an output match.

Best regards,
Juan Carlos.
Attachment im3.png
In reply to Juan Carlos Rodríguez-del-Pino

Odp: Re: How to evaluate the return value of the program, not the output

by Łukasz Krzak -
Thank you, that is great information! Now I need to find out which version of VPL is running in my Moodle instance.
In reply to Łukasz Krzak

Re: Odp: Re: How to evaluate the return value of the program, not the output

by Juan Carlos Rodríguez-del-Pino -
Picture of Particularly helpful Moodlers Picture of Plugin developers

Editing the file "vpl_evaluate.cases" press autocomplete (CTRL+Space) if you see the " Expected exit code =" then the VPL version is >= 3.3