summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 11c503d3d..03997897f 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 8ff5ef8bf..757804ef9 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 5d6b413ae..e06a81f81 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
+;;