• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mbarbin / super-master-mind / 184

16 Dec 2025 09:07PM UTC coverage: 88.465%. First build
184

Pull #37

github

web-flow
Merge 4bd68a9b6 into ee06b04ce
Pull Request #37: Preparatory changes to reduce deps further

72 of 93 new or added lines in 10 files covered. (77.42%)

1066 of 1205 relevant lines covered (88.46%)

2792804.26 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

80.0
/src/stdlib/super_master_mind_stdlib.ml
1
(*********************************************************************************)
2
(*  super-master-mind: A solver for the super master mind game                   *)
3
(*  SPDX-FileCopyrightText: 2021-2025 Mathieu Barbin <mathieu.barbin@gmail.com>  *)
4
(*  SPDX-License-Identifier: MIT                                                 *)
5
(*********************************************************************************)
6

7
module Code_error = Code_error
8
module Dyn = Dyn0
9
module Json = Json
10
module Ordering = Ordering
11
module Source_code_position = Source_code_position
12

13
let print pp = Format.printf "%a@." Pp.to_fmt pp
154✔
14
let print_dyn dyn = print (Dyn.pp dyn)
154✔
15
let phys_equal (type a) (x : a) (y : a) = x == y
140,174✔
16

17
let require cond =
18
  if not cond then Code_error.raise "Required condition does not hold." []
1✔
19
;;
20

21
let require_does_raise f =
22
  match f () with
12✔
23
  | _ -> Code_error.raise "Did not raise." []
1✔
24
  | exception e -> print_endline (Printexc.to_string e)
11✔
25
;;
26

27
module Array = struct
28
  include Stdlib.ArrayLabels
29

30
  let equal eq t1 t2 =
NEW
31
    phys_equal t1 t2 || (Array.length t1 = Array.length t2 && Array.for_all2 eq t1 t2)
×
32
  ;;
33

34
  let is_empty t = Array.length t = 0
1✔
35
  let create ~len a = Array.make len a
41,987,218✔
36

37
  let filter_mapi t ~f =
38
    t |> Array.to_seqi |> Seq.filter_map (fun (i, x) -> f i x) |> Array.of_seq
298,524✔
39
  ;;
40

41
  let fold t ~init ~f = fold_left t ~init ~f
×
42

43
  let foldi t ~init ~f =
44
    t |> Array.to_seqi |> Seq.fold_left (fun acc (i, e) -> f i acc e) init
40,320✔
45
  ;;
46

47
  let sort t ~compare = sort t ~cmp:compare
299,322✔
48
end
49

50
module Hashtbl = struct
51
  include MoreLabels.Hashtbl
52

53
  let set t ~key ~data = replace t ~key ~data
40,320✔
54
end
55

56
module In_channel = struct
57
  include Stdlib.In_channel
58

59
  let read_all file = with_open_bin file input_all
×
60
end
61

62
module Int = struct
63
  include Stdlib.Int
64

65
  let incr = incr
66
  let of_string = int_of_string_opt
67
end
68

69
module List = struct
70
  include Stdlib.ListLabels
71

72
  let rec drop_while li ~f =
73
    match li with
16✔
74
    | x :: l when f x -> drop_while l ~f
12✔
75
    | rest -> rest
4✔
76
  ;;
77

NEW
78
  let equal eq t1 t2 = equal ~eq t1 t2
×
79

80
  let is_empty = function
NEW
81
    | [] -> true
×
82
    | _ :: _ -> false
298,500✔
83
  ;;
84

85
  let iter t ~f = iter ~f t
325,872✔
86
  let fold t ~init ~f = fold_left t ~init ~f
274✔
87
end
88

89
module Option = struct
90
  include Stdlib.Option
91

92
  let bind x ~f = bind x f
361,844,635✔
93
  let iter t ~f = iter f t
114✔
94
  let some_if cond a = if cond then Some a else None
8✔
95
end
96

97
module Out_channel = struct
98
  include Stdlib.Out_channel
99

100
  let output_lines t lines =
101
    List.iter lines ~f:(fun line ->
3✔
102
      output_string t line;
6✔
103
      output_char t '\n')
6✔
104
  ;;
105

106
  let with_open_text t ~f = with_open_text t f
×
107
end
108

109
module Result = struct
110
  include Stdlib.Result
111

112
  let bind x ~f = bind x f
19,128✔
113
  let map_error t ~f = map_error f t
×
114
end
115

116
module String = struct
117
  include Stdlib.StringLabels
118

119
  let concat ts ~sep = concat ~sep ts
4✔
120
  let split t ~on = split_on_char ~sep:on t
4✔
121
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc