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

mbarbin / super-master-mind / 176

16 Dec 2025 01:25PM UTC coverage: 92.007% (-4.3%) from 96.355%
176

Pull #33

github

web-flow
Merge 2ac713a42 into 9cd937d49
Pull Request #33: Use json format for opening-book

420 of 491 new or added lines in 28 files covered. (85.54%)

2 existing lines in 1 file now uncovered.

1013 of 1101 relevant lines covered (92.01%)

3377900.1 hits per line

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

91.67
/src/stdlib/json.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
type t = Yojson.Basic.t
8

9
exception Invalid_json of string * t
10
exception Parse_error of string
11

12
let load ~file =
13
  try Yojson.Basic.from_file file with
8✔
NEW
14
  | Yojson.Json_error msg -> raise (Parse_error msg)
×
15
;;
16

17
let save t ~file =
18
  Stdlib.Out_channel.with_open_text file (fun oc ->
1✔
19
    Yojson.Basic.pretty_to_channel ~std:true oc t;
1✔
20
    Stdlib.Out_channel.output_char oc '\n')
1✔
21
;;
22

23
let to_string t = Yojson.Basic.pretty_to_string ~std:true t
1✔
24

25
let of_string s =
26
  try Yojson.Basic.from_string s with
9✔
27
  | Yojson.Json_error msg -> raise (Parse_error msg)
1✔
28
;;
29

30
let () =
31
  Printexc.register_printer (function
21✔
32
    | Invalid_json (msg, json) ->
1✔
33
      Some (Printf.sprintf "Json.Invalid_json(%S, %s)" msg (Yojson.Basic.to_string json))
1✔
34
    | Parse_error msg -> Some (Printf.sprintf "Json.Parse_error(%S)" msg)
1✔
35
    | _ -> None [@coverage off])
36
;;
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