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

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

Napisane przez: Łukasz Krzak ()
Liczba odpowiedzi: 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 ?

W odpowiedzi na Łukasz Krzak

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

Napisane przez: Juan Carlos Rodríguez-del-Pino ()
Obraz Particularly helpful Moodlers Obraz 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.
Załącznik ($a)
W odpowiedzi na Juan Carlos Rodríguez-del-Pino

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

Napisane przez: Łukasz Krzak ()
Thank you, that is great information! Now I need to find out which version of VPL is running in my Moodle instance.