# HG changeset patch # User wenzelm # Date 1191266393 -7200 # Node ID 34cbfb87dfe8778bbcc49a051dd2dda16aaf3e47 # Parent 513bb015b46976d0354b28902f34f190324aa5e8 auto_quickcheck: pervasive options, turned time_limit into plain int, simplified exception handling; diff -r 513bb015b469 -r 34cbfb87dfe8 src/Pure/codegen.ML --- a/src/Pure/codegen.ML Mon Oct 01 21:19:52 2007 +0200 +++ b/src/Pure/codegen.ML Mon Oct 01 21:19:53 2007 +0200 @@ -75,7 +75,7 @@ val test_fn: (int -> (string * term) list option) ref val test_term: theory -> bool -> int -> int -> term -> (string * term) list option val auto_quickcheck: bool ref - val auto_quickcheck_time_limit: Time.time ref + val auto_quickcheck_time_limit: int ref val eval_result: (unit -> term) ref val eval_term: theory -> term -> term val evaluation_conv: cterm -> thm @@ -986,7 +986,7 @@ ProofContext.pretty_term ctxt t]) cex); val auto_quickcheck = ref true; -val auto_quickcheck_time_limit = ref (Time.fromSeconds 5); +val auto_quickcheck_time_limit = ref 5000; fun test_goal' int state = let @@ -996,14 +996,15 @@ in if int andalso !auto_quickcheck andalso not (!Toplevel.quiet) then - (case try (fn state => TimeLimit.timeLimit (!auto_quickcheck_time_limit) + (case try (fn state => + TimeLimit.timeLimit (Time.fromMilliseconds (!auto_quickcheck_time_limit)) (test_goal true (params, []) 1 assms) state) state of SOME (cex as SOME _) => Proof.goal_message (fn () => Pretty.chunks [Pretty.str "", Pretty.markup Markup.hilite [pretty_counterex ctxt cex]]) state | _ => state) else state - end handle TimeLimit.TimeOut => state; + end; val _ = Context.add_setup (Context.theory_map (Specification.add_theorem_hook test_goal')); @@ -1200,3 +1201,7 @@ [assoc_typeP, assoc_constP, code_libraryP, code_moduleP, test_paramsP, testP, valueP]; end; + +val auto_quickcheck = Codegen.auto_quickcheck; +val auto_quickcheck_time_limit = Codegen.auto_quickcheck_time_limit; +