Skip to content

In/Out_channel Lin test revision #370

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/io/dune
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
)

(library
(name lin_tests_dsl_common_io)
(modules lin_tests_dsl_common)
(name lin_tests_spec_io)
(modules lin_tests_spec_io)
(package multicoretests)
(libraries qcheck-lin.lin)
)
Expand All @@ -22,7 +22,7 @@
(modules lin_tests_dsl_domain)
(package multicoretests)
;(flags (:standard -w -27))
(libraries qcheck-lin.domain lin_tests_dsl_common_io)
(libraries qcheck-lin.domain lin_tests_spec_io)
(action
(setenv OCAML_SYSTEM %{system}
(run %{test} --verbose)))
Expand All @@ -33,7 +33,7 @@
(modules lin_tests_dsl_thread)
(package multicoretests)
;(flags (:standard -w -27))
(libraries qcheck-lin.thread lin_tests_dsl_common_io)
(libraries qcheck-lin.thread lin_tests_spec_io)
; (action (run %{test} --verbose))
(action (echo "Skipping src/io/%{test} from the test suite\n\n"))
)
8 changes: 3 additions & 5 deletions src/io/lin_tests_dsl_domain.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
(* Tests of in and out channels *)
(* ********************************************************************** *)

open Lin_tests_dsl_common_io.Lin_tests_dsl_common

module IC_domain = Lin_domain.Make(ICConf)
module OC_domain = Lin_domain.Make(OCConf)
module IC_domain = Lin_domain.Make(Lin_tests_spec_io.ICConf)
module OC_domain = Lin_domain.Make(Lin_tests_spec_io.OCConf)

let tests =
IC_domain.neg_lin_test ~count:1000 ~name:"Lin DSL In_channel test with Domain" ::
Expand All @@ -14,7 +12,7 @@ let tests =
Printf.printf "Lin DSL Out_channel test with Domain disabled under macOS\n\n%!";
[]
) else [
OC_domain.neg_lin_test ~count:1000 ~name:"Lin DSL Out_channel test with Domain";
OC_domain.neg_lin_test ~count:5000 ~name:"Lin DSL Out_channel test with Domain";
]

let _ = QCheck_base_runner.run_tests_main tests
6 changes: 2 additions & 4 deletions src/io/lin_tests_dsl_thread.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
(* Tests of in and out channels *)
(* ********************************************************************** *)

open Lin_tests_dsl_common_io.Lin_tests_dsl_common

module IC_thread = Lin_thread.Make(ICConf) [@@alert "-experimental"]
module OC_thread = Lin_thread.Make(OCConf) [@@alert "-experimental"]
module IC_thread = Lin_thread.Make(Lin_tests_spec_io.ICConf) [@@alert "-experimental"]
module OC_thread = Lin_thread.Make(Lin_tests_spec_io.OCConf) [@@alert "-experimental"]

let _ =
QCheck_base_runner.run_tests_main [
Expand Down
15 changes: 6 additions & 9 deletions src/io/lin_tests_dsl_common.ml → src/io/lin_tests_spec_io.ml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module ICConf : Lin.Spec = struct
let cleanup = In_channel.close

open Lin
let int,int64 = nat_small,nat64_small
let int,int64,bytes = nat_small,nat64_small,bytes_small

let api = [
(* Only one t is tested, so skip stdin and opening functions *)
Expand All @@ -29,9 +29,8 @@ module ICConf : Lin.Spec = struct
val_ "In_channel.input_char" In_channel.input_char (t @-> returning_or_exc (option char)) ;
val_ "In_channel.input_byte" In_channel.input_byte (t @-> returning_or_exc (option int)) ;
val_ "In_channel.input_line" In_channel.input_line (t @-> returning_or_exc (option string)) ;
(* bytes not yet supported by the Lin library *)
(* val_ "In_channel.input" In_channel.input (t @-> bytes @-> int @-> int @-> returning int) ; *)
(* val_ "In_channel.really_input" In_channel.really_input (t @-> bytes @-> int @-> int @-> returning (option unit)) ; *)
val_ "In_channel.input" In_channel.input (t @-> bytes @-> int @-> int @-> returning_or_exc int) ;
val_ "In_channel.really_input" In_channel.really_input (t @-> bytes @-> int @-> int @-> returning_or_exc (option unit)) ;
val_ "In_channel.really_input_string" In_channel.really_input_string (t @-> int @-> returning_or_exc (option string)) ;
(* input_all generates counter-examples that are impossibly long *)
(* val_ "In_channel.input_all" In_channel.input_all (t @-> returning_or_exc string) ; *)
Expand All @@ -53,7 +52,7 @@ module OCConf : Lin.Spec = struct
let lift f (_, chan) = f chan

open Lin
let int,int64,string = nat_small,nat64_small,string_small
let int,int64,string,bytes = nat_small,nat64_small,string_small,bytes_small
let api = [
(* Only one t is tested, so skip stdout, stderr and opening functions *)

Expand All @@ -76,10 +75,8 @@ module OCConf : Lin.Spec = struct
val_ "Out_channel.output_char" (lift Out_channel.output_char) (t @-> char @-> returning_or_exc unit) ;
val_ "Out_channel.output_byte" (lift Out_channel.output_byte) (t @-> int @-> returning_or_exc unit) ;
val_ "Out_channel.output_string" (lift Out_channel.output_string) (t @-> string @-> returning_or_exc unit) ;

(* val_ "Out_channel.output_bytes" Out_channel.output_bytes (t @-> bytes @-> returning unit) ; *)
(* val_ "Out_channel.output" Out_channel.output (t @-> bytes @-> int @-> int @-> returning unit) ; *)

val_ "Out_channel.output_bytes" (lift Out_channel.output_bytes) (t @-> bytes @-> returning_or_exc unit) ;
val_ "Out_channel.output" (lift Out_channel.output) (t @-> bytes @-> int @-> int @-> returning_or_exc unit) ;
val_ "Out_channel.output_substring" (lift Out_channel.output_substring) (t @-> string @-> int @-> int @-> returning_or_exc unit) ;
val_ "Out_channel.set_binary_mode" (lift Out_channel.set_binary_mode) (t @-> bool @-> returning_or_exc unit) ;
val_ "Out_channel.set_buffered" (lift Out_channel.set_buffered) (t @-> bool @-> returning_or_exc unit) ;
Expand Down