Add program to test the Format module, and Sudoku program.
[fedora-mingw.git] / ocaml / test_format.ml
1 (* Test the Format module, which we suspect may not be working. *)
2
3 open Format
4
5 let debug = false
6
7 let () =
8   if debug then Printf.printf "creating buffer ...\n%!";
9   let buf = Buffer.create 100 in
10   if debug then Printf.printf "creating formatter ...\n%!";
11   let fmt = formatter_of_buffer buf in
12   if debug then Printf.printf "open box ...\n%!";
13   pp_open_box fmt 0;
14   if debug then Printf.printf "print string ...\n%!";
15   pp_print_string fmt "This is a string";
16   if debug then Printf.printf "close box ...\n%!";
17   pp_close_box fmt ();
18   if debug then Printf.printf "flush ...\n%!";
19   pp_print_flush fmt ();
20   if debug then Printf.printf "get buffer contents ...\n%!";
21   let str = Buffer.contents buf in
22   Printf.printf "contents of buffer = %S\n%!" str