diff options
| author | Sébastien Dailly <sebastien@dailly.me> | 2026-03-27 08:48:05 +0100 |
|---|---|---|
| committer | Sébastien Dailly <sebastien@dailly.me> | 2026-03-27 08:48:05 +0100 |
| commit | 830e7c5d27d161b91402414e6ecd49f1ed818bfb (patch) | |
| tree | 448864635d29b1ea66424cbb9e0816fbcf1e1907 /test/splay_tree.ml | |
Initial commit
Diffstat (limited to 'test/splay_tree.ml')
| -rw-r--r-- | test/splay_tree.ml | 28 |
1 files changed, 28 insertions, 0 deletions
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 |
