From 830e7c5d27d161b91402414e6ecd49f1ed818bfb Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Fri, 27 Mar 2026 08:48:05 +0100 Subject: Initial commit --- test/splay_tree.ml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 test/splay_tree.ml (limited to 'test/splay_tree.ml') diff --git a/test/splay_tree.ml b/test/splay_tree.ml new file mode 100644 index 0000000..318fc96 --- /dev/null +++ b/test/splay_tree.ml @@ -0,0 +1,28 @@ +let name = __FILE__ +let description = "Display the tree content after operations" + +module T = Splay.Make (struct + include Int + + let pp = Format.pp_print_int +end) + +type t = unit T.t + +let pp : Format.formatter -> t -> unit = T.pp +let tree : unit T.t ref = ref (T.empty ()) + +let speclist = + [ + ( "-add", + Arg.Int (fun n -> tree := T.add n () !tree), + "Add an element in the tree" ); + ( "-del", + Arg.Int (fun n -> tree := T.remove n !tree), + "Remove an element from the tree" ); + ( "-get", + Arg.Int (fun n -> ignore @@ T.find n !tree), + "Get an element from the tree" ); + ] + +let exec : string list -> t = fun _ -> !tree -- cgit v1.2.3