hyf

Context-aware query service for Radroots
git clone https://radroots.dev/git/hyf.git
Log | Files | Refs | README | LICENSE

coverage.mojo (1031B)


      1 from std.collections import List
      2 
      3 
      4 @fieldwise_init
      5 struct Coverage(Copyable, Movable):
      6     var scope: String
      7     var truncated: Bool
      8     var evaluated: Int
      9     var excluded: Int
     10     var supported_mode: String
     11     var unsupported: List[String]
     12 
     13 
     14 def coverage(
     15     truncated: Bool,
     16     evaluated: Int,
     17     excluded: Int,
     18     supported_mode: String,
     19     unsupported: List[String],
     20 ) raises -> Coverage:
     21     if evaluated < 0 or excluded < 0:
     22         raise Error("coverage counts must be non-negative")
     23     if supported_mode.strip() == "":
     24         raise Error("coverage requires a supported mode")
     25     var copied = List[String]()
     26     for entry in unsupported:
     27         copied.append(String(entry))
     28     return Coverage(
     29         scope="supplied_only",
     30         truncated=truncated,
     31         evaluated=evaluated,
     32         excluded=excluded,
     33         supported_mode=String(supported_mode),
     34         unsupported=copied^,
     35     )
     36 
     37 
     38 def no_match_is_global_absence() -> Bool:
     39     return False
     40 
     41 
     42 def unsupported_is_no_supply() -> Bool:
     43     return False