@@ -9,19 +9,43 @@ module BConf = struct
99 open Lin
1010 let int ,string = nat_small, string_small_printable
1111 let api = [
12- val_ " Bytes.get" Bytes. get (t @-> int @-> returning_or_exc char );
13- val_ " Bytes.set" Bytes. set (t @-> int @-> char @-> returning_or_exc unit );
14- val_ " Bytes.sub_string" Bytes. sub_string (t @-> int @-> int @-> returning_or_exc string );
15- val_ " Bytes.length" Bytes. length (t @-> returning int );
16- val_ " Bytes.fill" Bytes. fill (t @-> int @-> int @-> char @-> returning_or_exc unit );
17- val_ " Bytes.blit_string" Bytes. blit_string (string @-> int @-> t @-> int @-> int @-> returning_or_exc unit );
18- val_ " Bytes.index_from" Bytes. index_from (t @-> int @-> char @-> returning_or_exc int )]
12+ val_ " Bytes.length" Bytes. length (t @-> returning int );
13+ val_ " Bytes.get" Bytes. get (t @-> int @-> returning_or_exc char );
14+ val_ " Bytes.set" Bytes. set (t @-> int @-> char @-> returning_or_exc unit );
15+ val_ " Bytes.copy" Bytes. copy (t @-> returning bytes);
16+ val_ " Bytes.to_string" Bytes. to_string (t @-> returning string );
17+ val_ " Bytes.sub" Bytes. sub (t @-> int @-> int @-> returning_or_exc bytes);
18+ val_ " Bytes.sub_string" Bytes. sub_string (t @-> int @-> int @-> returning_or_exc string );
19+ val_ " Bytes.fill" Bytes. fill (t @-> int @-> int @-> char @-> returning_or_exc unit );
20+ val_ " Bytes.blit_string" Bytes. blit_string (string @-> int @-> t @-> int @-> int @-> returning_or_exc unit );
21+ val_ " Bytes.index" Bytes. index (t @-> char @-> returning_or_exc int );
22+ val_ " Bytes.index_opt" Bytes. index_opt (t @-> char @-> returning (option int ));
23+ val_ " Bytes.rindex" Bytes. rindex (t @-> char @-> returning_or_exc int );
24+ val_ " Bytes.rindex_opt" Bytes. rindex_opt (t @-> char @-> returning (option int ));
25+ val_ " Bytes.index_from" Bytes. index_from (t @-> int @-> char @-> returning_or_exc int );
26+ val_ " Bytes.index_from_opt" Bytes. index_from_opt (t @-> int @-> char @-> returning_or_exc (option int ));
27+ val_ " Bytes.rindex_from" Bytes. rindex_from (t @-> int @-> char @-> returning_or_exc int );
28+ val_ " Bytes.rindex_from_opt" Bytes. rindex_from_opt (t @-> int @-> char @-> returning_or_exc (option int ));
29+ val_ " Bytes.contains" Bytes. contains (t @-> char @-> returning_or_exc bool );
30+ val_ " Bytes.contains_from" Bytes. contains_from (t @-> int @-> char @-> returning_or_exc bool );
31+ val_ " Bytes.rcontains_from" Bytes. rcontains_from (t @-> int @-> char @-> returning_or_exc bool );
32+ (* UTF codecs and validations *)
33+ val_ " Bytes.is_valid_utf_8" Bytes. is_valid_utf_8 (t @-> returning bool );
34+ val_ " Bytes.is_valid_utf_16be" Bytes. is_valid_utf_16be (t @-> returning bool );
35+ val_ " Bytes.is_valid_utf_16le" Bytes. is_valid_utf_16le (t @-> returning bool );
36+ (* Binary encoding/decoding of integers *)
37+ val_ " Bytes.get_uint8" Bytes. get_uint8 (t @-> int @-> returning_or_exc int );
38+ val_ " Bytes.get_int8" Bytes. get_int8 (t @-> int @-> returning_or_exc int );
39+ val_ " Bytes.set_uint8" Bytes. set_uint8 (t @-> int @-> int @-> returning_or_exc unit );
40+ val_ " Bytes.set_int8" Bytes. set_int8 (t @-> int @-> int @-> returning_or_exc unit );
41+ ]
1942end
2043
2144module BT_domain = Lin_domain. Make (BConf )
2245module BT_thread = Lin_thread. Make (BConf ) [@ alert " -experimental" ]
2346;;
2447QCheck_base_runner. run_tests_main [
25- BT_domain. neg_lin_test ~count: 2500 ~name: " Lin Bytes test with Domain" ;
48+ BT_domain. neg_lin_test ~count: 5000 ~name: " Lin Bytes test with Domain" ;
2649 BT_thread. lin_test ~count: 250 ~name: " Lin Bytes test with Thread" ;
50+ BT_domain. stress_test ~count: 1000 ~name: " Lin Bytes stress test with Domain" ;
2751]
0 commit comments