You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let's consider a exercise about a function foo with at least one int argument.
If the tests about this function (e.g. Test_lib.test_function_1) may involve negative integers,
then the grader report will display these negative numbers without parenthesis. This leads to
incorrect code fragment like foo -6 in the report :
Computing foo -6 : 1 pt
Correct value 6
This isn't just a cosmetic error, it actually prevent a student from copy-pasting these
fragments unedited in an OCaml toplevel for debugging purpose (the actual situation
was involving a function with many arguments).
To Reproduce
Create an exercise about a function foo : int -> int and test it for instance with Test_lib.test_function_1 with at least one negative test case.
Expected behavior
An output such as : Computing foo (-6) ... (with parenthesis around the negative numbers)
Additional context
I've looked a bit at learnocaml source code, it looks like this issue is due to Introspection.print_value being too optimistic in its need_parentheses sub-routine. I'd be tempted to add - to the characters triggering the case `Decided true (around line 186 in introspection.ml).
The text was updated successfully, but these errors were encountered:
Bug description
Let's consider a exercise about a function
foo
with at least oneint
argument.If the tests about this function (e.g.
Test_lib.test_function_1
) may involve negative integers,then the grader report will display these negative numbers without parenthesis. This leads to
incorrect code fragment like
foo -6
in the report :This isn't just a cosmetic error, it actually prevent a student from copy-pasting these
fragments unedited in an OCaml toplevel for debugging purpose (the actual situation
was involving a function with many arguments).
To Reproduce
Create an exercise about a function
foo : int -> int
and test it for instance withTest_lib.test_function_1
with at least one negative test case.Expected behavior
An output such as :
Computing foo (-6) ...
(with parenthesis around the negative numbers)Additional context
I've looked a bit at learnocaml source code, it looks like this issue is due to
Introspection.print_value
being too optimistic in itsneed_parentheses
sub-routine. I'd be tempted to add-
to the characters triggering the case`Decided true
(around line 186 inintrospection.ml
).The text was updated successfully, but these errors were encountered: