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

formalsec / smtml / 175

12 Jul 2024 09:10AM UTC coverage: 50.585% (+1.4%) from 49.176%
175

push

github

filipeom
Test relop simplification

1125 of 2224 relevant lines covered (50.58%)

22.03 hits per line

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

54.55
/lib/symbol.ml
1
(***************************************************************************)
2
(* This file is part of the third-party OCaml library `smtml`.             *)
3
(* Copyright (C) 2023-2024 formalsec                                       *)
4
(*                                                                         *)
5
(* This program is free software: you can redistribute it and/or modify    *)
6
(* it under the terms of the GNU General Public License as published by    *)
7
(* the Free Software Foundation, either version 3 of the License, or       *)
8
(* (at your option) any later version.                                     *)
9
(*                                                                         *)
10
(* This program is distributed in the hope that it will be useful,         *)
11
(* but WITHOUT ANY WARRANTY; without even the implied warranty of          *)
12
(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           *)
13
(* GNU General Public License for more details.                            *)
14
(*                                                                         *)
15
(* You should have received a copy of the GNU General Public License       *)
16
(* along with this program.  If not, see <https://www.gnu.org/licenses/>.  *)
17
(***************************************************************************)
18

19
type t =
20
  { ty : Ty.t
21
  ; name : string
22
  }
23

24
let ( @: ) (name : string) (ty : Ty.t) : t = { name; ty }
249✔
25

26
let compare (t1 : t) (t2 : t) : int =
27
  let compare_name = compare t1.name t2.name in
21✔
28
  if compare_name = 0 then compare t1.ty t2.ty else compare_name
×
29

30
let equal (s1 : t) (s2 : t) : bool =
31
  Ty.equal s1.ty s2.ty && String.equal s1.name s2.name
85✔
32

33
let make (ty : Ty.t) (name : string) : t = name @: ty
127✔
34

35
let mk_symbol (ty : Ty.t) (name : string) : t = name @: ty
×
36

37
let pp (fmt : Format.formatter) ({ name; _ } : t) : unit =
38
  Format.pp_print_string fmt name
22✔
39

40
let rename (symbol : t) (name : string) : t = { symbol with name }
×
41

42
let to_string ({ name; _ } : t) : string = name
×
43

44
let to_json ({ name; ty } : t) : Yojson.Basic.t =
45
  `Assoc [ (name, `Assoc [ ("ty", `String (Format.asprintf "%a" Ty.pp ty)) ]) ]
×
46

47
let type_of ({ ty; _ } : t) : Ty.t = ty
44✔
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