STUD.com
← Objectives

Calculate · Assess & Decide · Engineering

Test coverage with a release gate

Statement/branch/function coverage percentages from executed-vs-total counts, an overall aggregate, and a pass/fail gate against your per-type minimums.

You receive: A reviewed coverage calculator + the passing test report, run on your coverage counts.

Part of Ship MVP

Opens soon

Cost15 credits
AcceptanceAutomated check against your inputs
ProtectionHeld until verified delivery

This objective is verified and ready. It opens soon, once sign-in and payments are live.

Deliverable interface

The exact vocabulary the automated check enforces: keys, tokens, entry points, and worked examples. Generated from the verification source.

{
 "constants": {},
 "entryName": "compute_test_coverage",
 "expectNote": "expect is the comparison-space value (your return value goes through normalize first when one is published)",
 "hiddenCaseCount": 7,
 "hiddenCaseNames": [
  "hidden_at_threshold_passes",
  "below_threshold_fails",
  "weighted_overall",
  "mean_overall",
  "zero_total_excluded",
  "no_thresholds_gate_passes",
  "multi_type_one_fails"
 ],
 "inputKeys": [
  "coverage",
  "executed",
  "min_thresholds",
  "overall_method",
  "rounding_dp",
  "total",
  "type"
 ],
 "normalizeSource": "def _coverage_normalize(r):\n    def pn(v):\n        return None if v is None else round(float(v), 6)\n    try:\n        return {\"by_type\": [{\"type\": str(x[\"type\"]), \"pct\": pn(x[\"pct\"])} for x in r[\"by_type\"]],\n                \"overall_pct\": pn(r[\"overall_pct\"]), \"gate_pass\": bool(r[\"gate_pass\"]),\n                \"failing\": [str(x) for x in r[\"failing\"]]}\n    except Exception:\n        return repr(r)\n",
 "returnShapes": [
  [
   "by_type",
   "failing",
   "gate_pass",
   "overall_pct"
  ]
 ],
 "signature": "def compute_test_coverage(inp):",
 "submission": "python exposing the entry function; inp is one input object; graded on held-out cases",
 "tier": "calculator",
 "visibleCases": [
  {
   "expect": {
    "by_type": [
     {
      "pct": 80,
      "type": "statement"
     }
    ],
    "failing": [],
    "gate_pass": true,
    "overall_pct": 80
   },
   "input": {
    "coverage": [
     {
      "executed": 800,
      "total": 1000,
      "type": "statement"
     }
    ],
    "min_thresholds": {
     "statement": 75
    }
   },
   "name": "statement_only"
  },
  {
   "expect": {
    "by_type": [
     {
      "pct": 70,
      "type": "branch"
     }
    ],
    "failing": [],
    "gate_pass": true,
    "overall_pct": 70
   },
   "input": {
    "coverage": [
     {
      "executed": 70,
      "total": 100,
      "type": "branch"
     }
    ],
    "min_thresholds": {
     "branch": 70
    }
   },
   "name": "branch_at_threshold_passes"
  }
 ],
 "vocabulary": [
  "by_type",
  "coverage",
  "executed",
  "failing",
  "gate_pass",
  "mean",
  "min_thresholds",
  "overall_method",
  "overall_pct",
  "pct",
  "rounding_dp",
  "total",
  "type",
  "weighted"
 ]
}

Get early access to STUD the day it goes live.