Practice ยท 2 of 3
Build the Boundary Net
static int clamp(int v, int lo, int hi) needs a real test net.
Implement clamp, then write the net via static List<String> selfCheck()
returning one line per property it satisfies, in this exact order:
- "low" โ clamp(5, 10, 20) == 10
- "high" โ clamp(25, 10, 20) == 20
- "in-range" โ clamp(15, 10, 20) == 15
- "identity-at-bounds" โ clamp(10, 10, 20) == 10 && clamp(20, 10, 20) == 20
The grader verifies both the implementation AND that the net exists โ
tests are deliverables here.
Difficulty: intermediate
Press Submit to check your solution.
Back to lesson: Practice: Testing Lab