summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Weis <Pierre.Weis@inria.fr>2009-09-23 11:19:29 +0000
committerPierre Weis <Pierre.Weis@inria.fr>2009-09-23 11:19:29 +0000
commitd165928a348c439d1268a5e2d0ccefae0ff7fad7 (patch)
tree36046371089ab3131538ff0d20f9374d3e8f1821
parent318bab1553e7e47c9ee1229f6e14d238b5ab82e5 (diff)
downloadocaml-d165928a348c439d1268a5e2d0ccefae0ff7fad7.tar.gz
Documentation + better phrasing.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@9346 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r--test/Moretest/tscanf2_io.ml3
-rw-r--r--test/Moretest/tscanf2_master.ml38
-rw-r--r--test/Moretest/tscanf2_slave.ml5
3 files changed, 28 insertions, 18 deletions
diff --git a/test/Moretest/tscanf2_io.ml b/test/Moretest/tscanf2_io.ml
index 11c503d3d4..03997897f8 100644
--- a/test/Moretest/tscanf2_io.ml
+++ b/test/Moretest/tscanf2_io.ml
@@ -5,7 +5,8 @@ let send_flush send ob oc t =
send ob t;
Buffer.output_buffer oc ob;
Buffer.clear ob;
- flush oc;;
+ flush oc
+;;
(* The correct sending format for the test should be "%S\n",
but to avoid problems when Scanf ask too early for the next character,
diff --git a/test/Moretest/tscanf2_master.ml b/test/Moretest/tscanf2_master.ml
index 8ff5ef8bf3..757804ef9d 100644
--- a/test/Moretest/tscanf2_master.ml
+++ b/test/Moretest/tscanf2_master.ml
@@ -7,9 +7,9 @@
- finally send the string "stop" to the slave
and wait for its answer "OK, bye!"
and die.
-
- Use the communication module Test_scanf_io.
-
+
+ Use the communication module Tscanf2_io.
+
Usage: test_master <slave_name> *)
open Tscanf2_io;;
@@ -26,15 +26,23 @@ let interact i =
Printf.eprintf " Ping"; flush stderr;
send_string_ping ob;
let s = receive_string ib in
- if s <> "-pong" then failwith ("Master: unbound string " ^ s);;
-
-Random.self_init ();
-let n = max (Random.int 8) 1 in
-let rec loop i =
- if i > 0 then (interact i; loop (i - 1)) in
-loop n;;
-
-send_string_stop ob;
-let ack = receive_string ib in
-if ack = "OK, bye!" then (prerr_endline "Test OK."; exit 0) else
-(prerr_endline "Test Failed!"; exit 2);;
+ if s <> "-pong" then failwith ("Master: unbound string " ^ s)
+;;
+
+begin
+ Random.self_init ();
+ let n = max (Random.int 8) 1 in
+ let rec loop i =
+ if i > 0 then (interact i; loop (i - 1)) in
+ loop n
+end
+;;
+
+begin
+ send_string_stop ob;
+ let ack = receive_string ib in
+ if ack = "OK, bye!"
+ then (prerr_endline "Test OK."; exit 0)
+ else (prerr_endline "Test Failed!"; exit 2)
+end
+;;
diff --git a/test/Moretest/tscanf2_slave.ml b/test/Moretest/tscanf2_slave.ml
index 5d6b413aee..e06a81f814 100644
--- a/test/Moretest/tscanf2_slave.ml
+++ b/test/Moretest/tscanf2_slave.ml
@@ -7,7 +7,7 @@
- send back the string "OK, bye!" on stdout,
- and die.
- Use the communication module Test_scanf_io. *)
+ Use the communication module Test_scanf2_io. *)
open Tscanf2_io;;
@@ -24,4 +24,5 @@ while true do
| " Ping" -> Printf.eprintf "-pong"; flush stderr; send_string_pong ob
| "stop" -> Printf.eprintf "!\n"; flush stderr; send_string_okbye ob; exit 0
| s -> failwith ("Slave: unbound string " ^ s)
-done;;
+done
+;;