1 (* Thoroughly test HV-related functions.
2 * $Id: 120-hv.ml,v 1.1 2005-01-28 23:09:33 rich Exp $
8 let hv = hv_empty () in
9 hv_set hv "foo" (sv_of_int 1);
10 hv_set hv "bar" (sv_of_int 2);
11 hv_set hv "foo" (sv_of_int 42);
12 assert (42 = int_of_sv (hv_get hv "foo"));
13 assert (2 = int_of_sv (hv_get hv "bar"));
14 assert (hv_exists hv "foo");
15 assert (not (hv_exists hv "baz"));
17 assert (not (hv_exists hv "foo"));
18 assert (not (hv_exists hv "bar"));
20 ignore (eval "%h = ( foo => 1, bar => 2 )");
21 let hv = get_hv "h" in
22 assert (1 = int_of_sv (hv_get hv "foo"));
23 assert (2 = int_of_sv (hv_get hv "bar"));
24 assert (not (hv_exists hv "baz"));