Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | 'use client' const BUGS = [ { cx: 590, cy: 120, label: 'Race condition', anchor: 'start' }, { cx: 610, cy: 200, label: 'Unexpected input', anchor: 'start' }, { cx: 575, cy: 270, label: 'State boundary', anchor: 'start' }, { cx: 120, cy: 155, label: 'Security edge case', anchor: 'end' }, { cx: 135, cy: 245, label: 'Integer overflow', anchor: 'end' }, ] export function TestingCoverageGap() { return ( <figure style={{ margin: '2.5rem 0', border: '1px solid #1f2937', borderRadius: 12, overflow: 'hidden', background: '#0d1117', }} > <svg viewBox="0 0 760 340" style={{ width: '100%', height: 'auto', display: 'block' }} aria-label="Diagram showing the gap between what tests cover and all possible program states" > <defs> <radialGradient id="outerGrad" cx="50%" cy="50%" r="50%"> <stop offset="0%" stopColor="#1e2533" /> <stop offset="100%" stopColor="#141b27" /> </radialGradient> <radialGradient id="innerGrad" cx="45%" cy="48%" r="55%"> <stop offset="0%" stopColor="#1e3a5f" /> <stop offset="100%" stopColor="#172d4a" /> </radialGradient> </defs> {/* Background */} <rect width="760" height="340" fill="#0d1117" /> {/* Outer region — all possible program states */} <ellipse cx="375" cy="172" rx="338" ry="152" fill="url(#outerGrad)" stroke="#334155" strokeWidth="1.5" /> {/* Outer label */} <text x="375" y="38" textAnchor="middle" fill="#64748b" fontSize="13" fontFamily="system-ui, sans-serif" letterSpacing="0.05em" > ALL POSSIBLE PROGRAM STATES </text> {/* Inner region — what tests cover */} <ellipse cx="345" cy="168" rx="178" ry="104" fill="url(#innerGrad)" stroke="#2563eb" strokeWidth="1.5" strokeDasharray="none" /> {/* Checkmark + "Tests pass here" */} <text x="345" y="158" textAnchor="middle" fill="#60a5fa" fontSize="22" fontFamily="system-ui, sans-serif" > ✓ </text> <text x="345" y="180" textAnchor="middle" fill="#93c5fd" fontSize="13" fontFamily="system-ui, sans-serif" fontWeight="600" > Tests pass here </text> <text x="345" y="198" textAnchor="middle" fill="#3b82f6" fontSize="11" fontFamily="system-ui, sans-serif" > your test suite covers this region </text> {/* "Bugs live here" label in the gap */} <text x="560" y="80" textAnchor="middle" fill="#f87171" fontSize="12" fontFamily="system-ui, sans-serif" fontWeight="600" letterSpacing="0.04em" > BUGS LIVE HERE </text> {/* Dashed bracket under "bugs live here" */} <line x1="520" y1="86" x2="600" y2="86" stroke="#991b1b" strokeWidth="1" strokeDasharray="3 3" /> {/* Bug dots and labels */} {BUGS.map((bug) => ( <g key={bug.label}> <circle cx={bug.cx} cy={bug.cy} r={5} fill="#ef4444" opacity={0.9} /> <text x={bug.anchor === 'start' ? bug.cx + 12 : bug.cx - 12} y={bug.cy + 4} textAnchor={bug.anchor as 'start' | 'end'} fill="#fca5a5" fontSize="12" fontFamily="system-ui, sans-serif" > {bug.label} </text> </g> ))} {/* Arrow pointing from "bugs live here" to the gap region */} <line x1="540" y1="90" x2="545" y2="110" stroke="#7f1d1d" strokeWidth="1" /> <polygon points="540,114 545,104 550,114" fill="#7f1d1d" /> </svg> <figcaption style={{ padding: '0.85rem 1.25rem', borderTop: '1px solid #1f2937', color: '#6b7280', fontSize: 13, fontStyle: 'italic', lineHeight: 1.6, }} > Testing demonstrates that your program works in the cases you thought to test. It cannot demonstrate correctness for the cases you did not. The gap between these two regions is where production bugs live — by definition, undiscovered until someone hits them. </figcaption> </figure> ) } |