[MLton-commit] r5198
Vesa Karvonen
vesak at mlton.org
Thu Feb 15 03:37:29 PST 2007
Hide generated files.
----------------------------------------------------------------------
_U mltonlib/trunk/com/ssh/misc-util/unstable/
U mltonlib/trunk/com/ssh/misc-util/unstable/Makefile
U mltonlib/trunk/com/ssh/misc-util/unstable/cee-cache-test.sml
U mltonlib/trunk/com/ssh/misc-util/unstable/cee-cache.sml
----------------------------------------------------------------------
Property changes on: mltonlib/trunk/com/ssh/misc-util/unstable
___________________________________________________________________
Name: svn:ignore
+ *.dep
mlb-path-map
test
Modified: mltonlib/trunk/com/ssh/misc-util/unstable/Makefile
===================================================================
--- mltonlib/trunk/com/ssh/misc-util/unstable/Makefile 2007-02-15 11:24:41 UTC (rev 5197)
+++ mltonlib/trunk/com/ssh/misc-util/unstable/Makefile 2007-02-15 11:37:28 UTC (rev 5198)
@@ -35,8 +35,9 @@
mlton -mlb-path-map mlb-path-map \
-prefer-abs-paths true \
-show-def-use $@.def-use \
+ -const 'Exn.keepHistory true' \
+ -link-opt -ldl \
-output $@ \
- -link-opt -ldl \
$<
##########################################################################
Modified: mltonlib/trunk/com/ssh/misc-util/unstable/cee-cache-test.sml
===================================================================
--- mltonlib/trunk/com/ssh/misc-util/unstable/cee-cache-test.sml 2007-02-15 11:24:41 UTC (rev 5197)
+++ mltonlib/trunk/com/ssh/misc-util/unstable/cee-cache-test.sml 2007-02-15 11:37:28 UTC (rev 5198)
@@ -6,31 +6,33 @@
val () = let
open Type UnitTest
- val verifyNotFound =
- verifyFailsWith (fn CeeCache.NotFound => true | _ => false)
+ val notFound = verifyFailsWith (fn CeeCache.NotFound => true | _ => false)
+ fun eq (e, a) = verifyEq int {actual = a, expect = e}
in
unitTests
(title "CeeCache")
+
(test (fn () => let
open CeeCache
val c = new ()
- val () = verifyTrue (0 = size c)
+ val () = eq (1, size c)
val k5 = put c 5
- val () = verifyTrue (1 = size c)
+ val () = eq (1, size c)
val k2 = put c 2
- val () = verifyTrue (2 = size c)
- val () = verifyTrue (5 = use c k5)
- val () = verifyNotFound (fn () => get c k5)
- val () = verifyTrue (1 = size c)
+ val () = (eq (2, size c)
+ ; eq (5, use c k5)
+ ; notFound (fn () => get c k5)
+ ; eq (1, size c))
val k3 = put c 3
- val () = verifyTrue (2 = use c k2)
- val () = verifyNotFound (fn () => use c k2)
- val () = verifyTrue (1 = size c)
- val () = verifyTrue (3 = use c k3)
- val () = verifyNotFound (fn () => get c k3)
- val () = verifyTrue (0 = size c)
+ val () = (eq (2, use c k2)
+ ; notFound (fn () => use c k2)
+ ; eq (1, size c)
+ ; eq (3, use c k3)
+ ; notFound (fn () => get c k3)
+ ; eq (0, size c))
in
()
end))
+
$
end
Modified: mltonlib/trunk/com/ssh/misc-util/unstable/cee-cache.sml
===================================================================
--- mltonlib/trunk/com/ssh/misc-util/unstable/cee-cache.sml 2007-02-15 11:24:41 UTC (rev 5197)
+++ mltonlib/trunk/com/ssh/misc-util/unstable/cee-cache.sml 2007-02-15 11:37:28 UTC (rev 5198)
@@ -21,15 +21,15 @@
datatype 'a t =
IN of {size : Int.t Ref.t,
table : {key : Key.t, value : 'a} Option.t Array.t Ref.t}
- fun get s (IN r) = ! (s r)
+ fun g s (IN r) = ! (s r)
fun set s (IN r) v = s r := v
exception NotFound
- fun size c = get #size c
+ fun size c = g#size c
- fun sub c i = valOf (Array.sub (get#table c, i))
- fun update c (i, v) = Array.update (get#table c, i, v)
+ fun sub c i = valOf (Array.sub (g#table c, i))
+ fun update c (i, v) = Array.update (g#table c, i, v)
fun new () = IN {size = ref 0, table = ref (Array.tabulate (0, undefined))}
More information about the MLton-commit
mailing list