[MLton-commit] r6486
Vesa Karvonen
vesak at mlton.org
Sat Mar 15 19:41:05 PST 2008
Allow max skip/pass counts to be supplied from the command line and reduce
counts when evaluating nested (all) quantifiers.
----------------------------------------------------------------------
U mltonlib/trunk/com/ssh/unit-test/unstable/detail/unit-test.sml
----------------------------------------------------------------------
Modified: mltonlib/trunk/com/ssh/unit-test/unstable/detail/unit-test.sml
===================================================================
--- mltonlib/trunk/com/ssh/unit-test/unstable/detail/unit-test.sml 2008-03-16 03:39:43 UTC (rev 6485)
+++ mltonlib/trunk/com/ssh/unit-test/unstable/detail/unit-test.sml 2008-03-16 03:41:05 UTC (rev 6486)
@@ -22,8 +22,11 @@
open Maybe
val I = Int.fromString
val cols = Monad.sum [S"-w"@`I, L"--width"@`I, E"COLUMNS"@`I, `70]
+ fun opt s l d = ref (valOf (get (Monad.sum [S s @` I, L l @`I, `d])))
in
val println = println (get cols)
+ val defMaxPass = opt "-p" "--max-pass" 100
+ val defMaxSkip = opt "-s" "--max-skip" 100
end
datatype t' =
@@ -169,14 +172,22 @@
find (passN + 1, skipN)
| BUG (v, ms) =>
minimize (v, ms)
+
+ fun flet (r, v) th =
+ case !r of v' => (r := v ; after (th, fn () => r := v'))
in
- find (0, 0)
+ flet (defMaxPass, 1 + IntInf.log2 (IntInf.fromInt (!defMaxPass)))
+ (fn () =>
+ flet (defMaxSkip, 1 + !defMaxSkip div 2)
+ (fn () =>
+ find (0, 0)))
end
- fun all t =
- allParam {size = fn n => n div 2 + 3,
- maxPass = 100,
- maxSkip = 100} t
+ fun all t ef =
+ allParam {size = fn n => n div 2 + 3,
+ maxPass = !defMaxPass,
+ maxSkip = !defMaxSkip}
+ t ef
fun testAll t ef = test (fn () => all t ef)
More information about the MLton-commit
mailing list