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

mbarbin / super-master-mind / 179

16 Dec 2025 02:45PM UTC coverage: 90.673% (-1.3%) from 92.007%
179

Pull #34

github

web-flow
Merge 2290390ed into e92bc19b9
Pull Request #34: Use ordering in comparisons

109 of 134 new or added lines in 14 files covered. (81.34%)

30 existing lines in 1 file now uncovered.

1011 of 1115 relevant lines covered (90.67%)

2829642.04 hits per line

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

81.08
/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 = Dyn
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,901,612✔
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,767✔
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:(fun a b -> compare a b |> Ordering.to_int)
299,350✔
48
end
49

50
module Float = struct
51
  include Stdlib.Float
52

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

56
module Hashtbl = struct
57
  include MoreLabels.Hashtbl
58

59
  let set t ~key ~data = replace t ~key ~data
40,320✔
60
end
61

62
module In_channel = struct
63
  include Stdlib.In_channel
64

65
  let read_all file = with_open_bin file input_all
×
66
end
67

68
module Int = struct
69
  include Stdlib.Int
70

71
  let compare a b = compare a b |> Ordering.of_int
5,119,991✔
72
  let incr = incr
73
  let of_string = int_of_string_opt
74
end
75

76
module List = struct
77
  include Stdlib.ListLabels
78

79
  let rec drop_while li ~f =
80
    match li with
16✔
81
    | x :: l when f x -> drop_while l ~f
12✔
82
    | rest -> rest
4✔
83
  ;;
84

NEW
85
  let equal eq t1 t2 = equal ~eq t1 t2
×
86

87
  let is_empty = function
NEW
88
    | [] -> true
×
89
    | _ :: _ -> false
298,272✔
90
  ;;
91

92
  let iter t ~f = iter ~f t
325,792✔
93
  let fold t ~init ~f = fold_left t ~init ~f
274✔
94
end
95

96
module Option = struct
97
  include Stdlib.Option
98

99
  let bind x ~f = bind x f
357,908,362✔
100
  let iter t ~f = iter f t
114✔
101
  let some_if cond a = if cond then Some a else None
8✔
102
end
103

104
module Out_channel = struct
105
  include Stdlib.Out_channel
106

107
  let output_lines t lines =
108
    List.iter lines ~f:(fun line ->
3✔
109
      output_string t line;
6✔
110
      output_char t '\n')
6✔
111
  ;;
112

113
  let with_open_text t ~f = with_open_text t f
×
114
end
115

116
module Result = struct
117
  include Stdlib.Result
118

119
  let bind x ~f = bind x f
19,128✔
120
  let map_error t ~f = map_error f t
×
121
end
122

123
module String = struct
124
  include Stdlib.StringLabels
125

126
  let concat ts ~sep = concat ~sep ts
4✔
127
  let split t ~on = split_on_char ~sep:on t
4✔
128
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