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

mbarbin / super-master-mind / 217

31 Jan 2026 12:24PM UTC coverage: 50.206% (-38.1%) from 88.313%
217

Pull #45

github

web-flow
Merge 235b668da into 3d48eb3d9
Pull Request #45: Dune pkg ci migration

610 of 1215 relevant lines covered (50.21%)

597078.5 hits per line

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

36.84
/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
16✔
14
let print_dyn dyn = print (Dyn.pp dyn)
16✔
15
let phys_equal (type a) (x : a) (y : a) = x == y
6,368✔
16

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

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

27
module Array = struct
28
  include Stdlib.ArrayLabels
29

30
  let equal eq t1 t2 =
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
×
35
  let create ~len a = Array.make len a
9,406,666✔
36

37
  let filter_mapi t ~f =
38
    t |> Array.to_seqi |> Seq.filter_map (fun (i, x) -> f i x) |> Array.of_seq
101,724✔
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
×
45
  ;;
46

47
  let sort t ~compare = sort t ~cmp:(fun a b -> compare a b |> Ordering.to_int)
101,860✔
48
end
49

50
module Float = struct
51
  include Stdlib.Float
52

53
  let compare a b = compare a b |> Ordering.of_int
277,489✔
54
end
55

56
module Fun = struct
57
  include Stdlib.Fun
58

59
  let protect ~f ~finally = protect ~finally f
3✔
60
end
61

62
module Hashtbl = struct
63
  include MoreLabels.Hashtbl
64

65
  let set t ~key ~data = replace t ~key ~data
×
66
end
67

68
module In_channel = struct
69
  include Stdlib.In_channel
70

71
  let read_all file = with_open_bin file input_all
×
72
end
73

74
module Int = struct
75
  include Stdlib.Int
76

77
  let compare a b = compare a b |> Ordering.of_int
1,275,628✔
78
  let incr = incr
79
  let of_string = int_of_string_opt
80
end
81

82
module List = struct
83
  include Stdlib.ListLabels
84

85
  let rec drop_while li ~f =
86
    match li with
×
87
    | x :: l when f x -> drop_while l ~f
×
88
    | rest -> rest
×
89
  ;;
90

91
  let equal eq t1 t2 = equal ~eq t1 t2
×
92

93
  let is_empty = function
94
    | [] -> true
×
95
    | _ :: _ -> false
101,676✔
96
  ;;
97

98
  let iter t ~f = iter ~f t
118,220✔
99
  let fold t ~init ~f = fold_left t ~init ~f
×
100
end
101

102
module Option = struct
103
  include Stdlib.Option
104

105
  let bind x ~f = bind x f
83,727,377✔
106
  let iter t ~f = iter f t
102✔
107
  let some_if cond a = if cond then Some a else None
×
108
end
109

110
module Out_channel = struct
111
  include Stdlib.Out_channel
112

113
  let output_lines t lines =
114
    List.iter lines ~f:(fun line ->
×
115
      output_string t line;
×
116
      output_char t '\n')
×
117
  ;;
118

119
  let with_open_text t ~f = with_open_text t f
×
120
end
121

122
module Result = struct
123
  include Stdlib.Result
124

125
  let bind x ~f = bind x f
6,368✔
126
  let map_error t ~f = map_error f t
×
127
end
128

129
module String = struct
130
  include Stdlib.StringLabels
131

132
  let concat ts ~sep = concat ~sep ts
×
133
  let split t ~on = split_on_char ~sep:on t
×
134
end
135

136
let ( +. ) = Stdlib.( +. )
137
let ( -. ) = Stdlib.( -. )
138
let ( *. ) = Stdlib.( *. )
139
let ( /. ) = Stdlib.( /. )
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

© 2026 Coveralls, Inc