Section1.2Parsons Left-Numbering Overflow Tests II
Comprehensive test cases for the numbered="left" overflow fix. Groups 1-8 appeared in v1; Groups 9-14 cover edge cases identified by code inspection that were not in v1.
Case 9-A: language="math", adaptive, indentation hidden, left-numbered. MathJax rendering is awaited inside the block-width loop; the label column must be added after that await resolves or the area will be sized to the pre-render (narrow) width.
Case 9-B: language="math", static (non-adaptive), indentation enabled, left-numbered. Combines the MathJax sizing path with the indent-column width budget.
Prove that \(\sqrt{2}\) is irrational.
---
Assume \(\sqrt{2} = \frac{p}{q}\) in lowest terms.
---
Assume \(\sqrt{2} = \frac{p}{q}\) where \(p, q\) share a factor.
#paired
---
Then \(2 = \frac{p^2}{q^2}\), so \(p^2 = 2q^2\).
---
So \(p^2\) is even, hence \(p\) is even.
---
Write \(p = 2k\); then \(4k^2 = 2q^2\), so \(q^2 = 2k^2\).
---
Write \(p = 2k\); then \(2k^2 = q^2\).
#paired
---
So \(q\) is also even β contradiction.
Case 9-C: Wide math expressions, adaptive, left-numbered. Large rendered equations push block width further than any code line would; this is the worst case for the MathJax-then-label sizing order.
Subsection1.2.2Group 10: "Help Me" β removeIndentation() path
Activity1.2.4.
Case 10-A: Adaptive, indentation enabled, left-numbered. After 3 failed attempts the "Help Me" button becomes active. If all distractors are already removed and blocks β€ 3, pressing Help Me triggers removeIndentation(), which has its own blockWidth += 25 branch. Verify the source area does not overflow after Help Me fires.
Case 10-B: Adaptive, long lines, indentation enabled, left-numbered. Long lines maximise blockWidth in the removeIndentation() recalculation, exposing any remaining off-by-one in the +25 px branch.
Case 11-A: Blocks with multiple clines (joined into one draggable unit), adaptive, indentation hidden, left-numbered. The label sits beside a tall block; confirm horizontal layout is unaffected.
def swap(a, b):
return b, a
---
def swap(a, b):
a, b = b, a #paired
---
x = 3
y = 7
---
x, y = swap(x, y)
---
x, y = swap(y, x) #paired
---
print(x, y)
Case 11-B: Multi-cline blocks with indentation enabled, left-numbered. Tests that a tall indented block does not push the label column outside the source area.
Case 12-A: DAG grader (order-independent), adaptive, indentation hidden, left-numbered. The tagged blocks follow the same sizing path; confirm labels donβt overflow the source area.
Subsection1.2.5Group 13: Maximum indent level (answer4)
Activity1.2.9.
Case 13-A: Four indent levels, adaptive, left-numbered. This triggers the answer4 CSS class, the deepest indent supported by the standard CSS. The source area width budget is at its minimum: \((availableWidth - 4 \times 30 - 80) / 2 - 25\) px.
Case 13-B: Four indent levels, 10+ blocks (double-digit labels), adaptive, left-numbered. This is the narrowest possible source area combined with the widest label column β the triple-threat case.
results = []
---
for a in range(5):
---
for b in range(5):
---
for c in range(5):
---
for d in range(5):
---
total = a + b + c + d
---
total = a * b * c * d #paired
---
if total == 10:
---
if total > 10: #paired
---
results.append((a, b, c, d))
---
count = len(results)
---
print(count)
Case 14-A: Explicit block order, adaptive, left-numbered. The order attribute bypasses the random shuffle and places blocks in a fixed sequence. The sizing code runs identically, but this exercises the order-specific branch in createBlocks().