equal
deleted
inserted
replaced
183 let |
183 let |
184 val ((result, reports), exec_time) = |
184 val ((result, reports), exec_time) = |
185 cpu_time "quickcheck execution" (fn () => with_size test_fun 1 []) |
185 cpu_time "quickcheck execution" (fn () => with_size test_fun 1 []) |
186 in |
186 in |
187 (case result of NONE => NONE | SOME ts => SOME (names ~~ ts), |
187 (case result of NONE => NONE | SOME ts => SOME (names ~~ ts), |
188 ([exec_time, comp_time], if Config.get ctxt report then SOME reports else NONE)) |
188 ([exec_time, comp_time], |
|
189 if Config.get ctxt report andalso not (null reports) then SOME reports else NONE)) |
189 end) () |
190 end) () |
190 handle TimeLimit.TimeOut => |
191 handle TimeLimit.TimeOut => |
191 if is_interactive then error (excipit "ran out of time") else raise TimeLimit.TimeOut |
192 if is_interactive then error (excipit "ran out of time") else raise TimeLimit.TimeOut |
192 end; |
193 end; |
193 |
194 |
271 |
272 |
272 fun pretty_counterex ctxt auto NONE = Pretty.str (tool_name auto ^ " found no counterexample.") |
273 fun pretty_counterex ctxt auto NONE = Pretty.str (tool_name auto ^ " found no counterexample.") |
273 | pretty_counterex ctxt auto (SOME cex) = |
274 | pretty_counterex ctxt auto (SOME cex) = |
274 Pretty.chunks (Pretty.str (tool_name auto ^ " found a counterexample:\n") :: |
275 Pretty.chunks (Pretty.str (tool_name auto ^ " found a counterexample:\n") :: |
275 map (fn (s, t) => |
276 map (fn (s, t) => |
276 Pretty.block [Pretty.str (s ^ " ="), Pretty.brk 1, Syntax.pretty_term ctxt t]) cex); |
277 Pretty.block [Pretty.str (s ^ " ="), Pretty.brk 1, Syntax.pretty_term ctxt t]) (rev cex)); |
277 |
278 |
278 fun pretty_report (Report {iterations = iterations, raised_match_errors = raised_match_errors, |
279 fun pretty_report (Report {iterations = iterations, raised_match_errors = raised_match_errors, |
279 satisfied_assms = satisfied_assms, positive_concl_tests = positive_concl_tests}) = |
280 satisfied_assms = satisfied_assms, positive_concl_tests = positive_concl_tests}) = |
280 let |
281 let |
281 fun pretty_stat s i = Pretty.block ([Pretty.str (s ^ ": " ^ string_of_int i)]) |
282 fun pretty_stat s i = Pretty.block ([Pretty.str (s ^ ": " ^ string_of_int i)]) |
286 satisfied_assms |
287 satisfied_assms |
287 @ [pretty_stat "positive conclusion tests" positive_concl_tests]) |
288 @ [pretty_stat "positive conclusion tests" positive_concl_tests]) |
288 end |
289 end |
289 |
290 |
290 fun pretty_reports ctxt (SOME reports) = |
291 fun pretty_reports ctxt (SOME reports) = |
291 Pretty.chunks (Pretty.str "Quickcheck report:" :: |
292 Pretty.chunks (Pretty.fbrk :: Pretty.str "Quickcheck report:" :: |
292 maps (fn (size, report) => |
293 maps (fn (size, report) => |
293 Pretty.str ("size " ^ string_of_int size ^ ":") :: pretty_report report @ [Pretty.brk 1]) |
294 Pretty.str ("size " ^ string_of_int size ^ ":") :: pretty_report report @ [Pretty.brk 1]) |
294 (rev reports)) |
295 (rev reports)) |
295 | pretty_reports ctxt NONE = Pretty.str "" |
296 | pretty_reports ctxt NONE = Pretty.str "" |
296 |
297 |