Skip to content

Commit

Permalink
Exercise mode UUID serialization and grading crash fixes (#1108)
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrus- authored Sep 15, 2023
2 parents 3010d33 + f2722f6 commit 8a7c08b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
13 changes: 12 additions & 1 deletion src/haz3lcore/tiles/Id.re
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,20 @@ type t = Uuidm.t;
let mk: unit => t = Uuidm.v4_gen(Random.State.make_self_init());

let compare: (t, t) => int = Uuidm.compare;
let pp: (Format.formatter, t) => unit = Uuidm.pp;
let to_string: (~upper: bool=?, t) => string = Uuidm.to_string;
let of_string: (~pos: int=?, string) => option(t) = Uuidm.of_string;
let pp: (Format.formatter, t) => unit =
(f, id) =>
Format.fprintf(
f,
"Option.get(Haz3lcore.Id.of_string(\"%s\"))",
to_string(id),
);
let show = id =>
Format.sprintf(
"Option.get(Haz3lcore.Id.of_string(\"%s\"))",
to_string(id),
);

[@deriving (sexp, yojson)]
type binding('v) = (t, 'v);
Expand Down
9 changes: 7 additions & 2 deletions src/haz3lweb/Grading.re
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,12 @@ module ImplGradingReport = {

let individual_reports = (~inject, ~report) => {
switch (report.test_results) {
| Some(test_results) =>
| Some(test_results)
when
List.length(test_results.test_map)
== List.length(report.hinted_results) =>
/* NOTE: This condition will be false when evaluation crashes,
* for example due to a stack overflow, which may occur in normal operation */
div(
report.hinted_results
|> List.mapi((i, (status, hint)) =>
Expand All @@ -402,7 +407,7 @@ module ImplGradingReport = {
)
),
)
| None => div([])
| _ => div([])
};
};

Expand Down

0 comments on commit 8a7c08b

Please sign in to comment.