Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #448 from pfitaxel/fix/440-neg-int
fix(grader): Display negative numbers with mandatory parens
- Loading branch information
Showing
15 changed files
with
112 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,7 +79,7 @@ | |
"text": "Computing" | ||
}, | ||
{ | ||
"text": "plus 10 -10", | ||
"text": "plus 10 (-10)", | ||
"display": "code" | ||
} | ||
], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
let aff = fun a b x -> a * x + b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
[ | ||
{ | ||
"section": [ | ||
{ | ||
"text": "Function:" | ||
}, | ||
{ | ||
"text": "aff", | ||
"display": "code" | ||
} | ||
], | ||
"contents": [ | ||
{ | ||
"message": [ | ||
{ | ||
"text": "Found" | ||
}, | ||
{ | ||
"text": "aff", | ||
"display": "code" | ||
}, | ||
{ | ||
"text": "with compatible type." | ||
} | ||
], | ||
"result": "informative" | ||
}, | ||
{ | ||
"message": [ | ||
{ | ||
"text": "Computing" | ||
}, | ||
{ | ||
"text": "aff 2 (-1) 5", | ||
"display": "code" | ||
} | ||
], | ||
"result": "informative" | ||
}, | ||
{ | ||
"message": [ | ||
{ | ||
"text": "Correct value" | ||
}, | ||
{ | ||
"text": "9", | ||
"display": "code" | ||
} | ||
], | ||
"result": 1 | ||
}, | ||
{ | ||
"message": [ | ||
{ | ||
"text": "Computing" | ||
}, | ||
{ | ||
"text": "aff (-2) 1 5", | ||
"display": "code" | ||
} | ||
], | ||
"result": "informative" | ||
}, | ||
{ | ||
"message": [ | ||
{ | ||
"text": "Correct value" | ||
}, | ||
{ | ||
"text": "(-9)", | ||
"display": "code" | ||
} | ||
], | ||
"result": 1 | ||
} | ||
] | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ "learnocaml_version": "1", | ||
"groups": | ||
{ "demo": | ||
{ "title": "Test negative_int", | ||
"exercises": [ "int_exo" ] } } } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Test negative_int | ||
|
||
This exercise is just a regression test with pretty-printing negative `int`s. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{"learnocaml_version":"1","kind":"exercise","stars":0, | ||
"title":"Test negative_int"} |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
let aff a b x = a * x + b |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
open Test_lib | ||
open Report | ||
|
||
let () = | ||
set_result @@ | ||
ast_sanity_check code_ast @@ fun () -> | ||
[ Section | ||
([ Text "Function:" ; Code "aff" ], | ||
let prot = [%funty: int -> int -> int -> int] in | ||
test_function_against_solution ~gen:(0) prot "aff" | ||
[2 @: (-1) @:!! 5; | ||
(-2) @: 1 @:!! 5]) | ||
] |