jcrodriguez-dis / moodle-mod_vpl

Virtual Programming Lab for Moodle (Module)
GNU General Public License v3.0
99 stars 85 forks source link

Missing linebreaks in evaluation output #85

Open t-schroeder opened 5 years ago

t-schroeder commented 5 years ago

We have this test case:

Case = Test 1
output = "Hello World!
"

... and this solution:

#include <stdio.h>

void main(void) {
    printf("Hello World!");
    return 0;
}

... leads to this output when evaluated: image

The problem is that it isn't obvious to the user what's wrong with his solution. When you add a \n to the end of the printf your solution will evaluate as correct. The reason for the empty line being skipped in the expected output is this function: https://github.com/jcrodriguez-dis/moodle-mod_vpl/blob/3842307010be49a71a934dbd772c6fe77c7a72d4/jail/default_scripts/vpl_evaluate.cpp#L368-L391

I don't know if the Tools::splitLines function can just be changed. It is also used in Evaluation::loadTestCases and I can't tell if it would lead to any problems there.

jcrodriguez-dis commented 5 years ago

Hello, Thanks for your sharing your issue. I think that the test program is correcto. If you want to accept only the output with newline the case definition is correct. Please, remember to state it at problem definition. If you want also accept the output whitout newline add a new output to the case definitivo. output = "Hello World! " output = "Hello World!"

I think that the real problem is that the report does not state clearly the difference found. I think that the error report must be improved to help with this problem.

Best regards, Juan Carlos

t-schroeder commented 5 years ago

Hello Juan Carlos,

yes, that's what I meant. In the problem definition we would write something like:

Write a program that outputs "Hello World!" (without the quotes) followed by a newline.

The only problem is that the linebreak is missing in the evaluate output.

Regards Tim Schroeder

jcrodriguez-dis commented 5 years ago

The scrollbars seems to be hiding the real content. I have tagged the issue as bug.