(seed: number)
| 165 | } |
| 166 | |
| 167 | function generateCase(seed: number): MarkdownRobustnessCase { |
| 168 | const rng = createRng(seed) |
| 169 | const visibleToken = `VISIBLE_SENTINEL_${seed}` |
| 170 | const hiddenTokens: string[] = [] |
| 171 | const diagramProbes: string[] = [] |
| 172 | const codeProbes: string[] = [] |
| 173 | |
| 174 | const segments: string[] = [ |
| 175 | `# Case ${seed}`, |
| 176 | '', |
| 177 | `Visible token: ${visibleToken}`, |
| 178 | ] |
| 179 | |
| 180 | const count = 4 + Math.floor(rng() * 3) |
| 181 | const kinds = [ |
| 182 | 'paragraph', |
| 183 | 'list', |
| 184 | 'table', |
| 185 | 'fence', |
| 186 | 'diagram', |
| 187 | 'hidden_system', |
| 188 | 'hidden_abort', |
| 189 | ] as const |
| 190 | |
| 191 | for (let index = 0; index < count; index += 1) { |
| 192 | const kind = pick(rng, kinds) |
| 193 | switch (kind) { |
| 194 | case 'paragraph': |
| 195 | segments.push( |
| 196 | '', |
| 197 | `Prose paragraph ${seed}_${index} with client -> api arrows and ordinary text.`, |
| 198 | ) |
| 199 | break |
| 200 | case 'list': |
| 201 | segments.push( |
| 202 | '', |
| 203 | `- bullet_${seed}_${index}`, |
| 204 | `- continuation_${seed}_${index}`, |
| 205 | ) |
| 206 | break |
| 207 | case 'table': |
| 208 | segments.push( |
| 209 | '', |
| 210 | '| Current | Target | Status |', |
| 211 | '|---------|--------|--------|', |
| 212 | `| trigger_${seed}_${index} | routine_${seed}_${index} | pending |`, |
| 213 | ) |
| 214 | break |
| 215 | case 'fence': { |
| 216 | const fence = makeFence(seed, index) |
| 217 | codeProbes.push(fence.probe) |
| 218 | segments.push('', fence.content) |
| 219 | break |
| 220 | } |
| 221 | case 'diagram': { |
| 222 | const diagram = makeDiagram(seed, index) |
| 223 | diagramProbes.push(...diagram.probes) |
| 224 | segments.push('', diagram.content) |
no test coverage detected