+let as_expected report_fname expected found =
+ (if Sys.file_exists report_fname then Sys.remove report_fname) ;
+ let och = lazy (open_out report_fname) in
+ let print_endline = print_endline_to_channel (Lazy.force och) in
+ let rec aux =
+ function
+ [],[] -> true
+ | ex::extl, fo::fotl ->
+ as_expected_one och ex fo &&
+ aux (extl,fotl)
+ | [],found ->
+ print_endline "### Too many interpretations found" ;
+ false
+ | expected,[] ->
+ print_endline "### Too few interpretations found" ;
+ false
+ in
+ let outcome = aux (expected,found) in
+ (if Lazy.lazy_is_val och then close_out (Lazy.force och)) ;
+ outcome
+