Data Flow Testing - Exam Q2 Approach
How to tackle:
Q2.1 — take each given path, check if B gets redefined before any USE along that path Q2.2 — tick each given path against your du-pair table, check if every du-pair gets ≥ 1 tick Q2.3 — find any uncovered du-pair, find input values that force that path
Q2.1 — Are these paths def-clear for B?
| Path | Def-clear? | Reason |
|---|---|---|
<1,2,3,4,5> | ✅ | def@1 clear to node 4 USE (RHS before LHS), then def@4 clear to node 5 |
<1,3,4,5> | ✅ | def@1 clear to node 4 USE, then def@4 clear to node 5 |
<1,2,3,5> | ✅ | def@1 clear all the way to node 5 — skips node 4 entirely |
Q2.2 — All-Defs and All-Uses check:
| du-pair | path | <1,2,3,4,5> | <1,3,4,5> | <1,2,3,5> | Covered? |
|---|---|---|---|---|---|
(1,<1,2>) | <1,2> | ✅ | — | ✅ | ✅ |
(1,<1,3>) | <1,3> | — | ✅ | — | ✅ |
| (1,4) | <1,2,3,4> | ✅ | — | — | ✅ |
<1,3,4> | — | ✅ | — | ✅ | |
| (1,5) | <1,2,3,5> | — | — | ✅ | ✅ |
<1,3,5> | — | — | — | ❌ | |
| (4,5) | <4,5> | ✅ | ✅ | — | ✅ |
- All-Defs: def@1 ✅, def@4 ✅ → All-Defs ACHIEVED ✅
- All-Uses: (1,5) via
<1,3,5>never covered → All-Uses NOT ACHIEVED ❌
Q2.3 — Additional test case needed:
Need to cover path <1,3,5>:
- 1→3 means B ≤ 1 (skip node 2)
- 3→5 means A ≤ 10 (skip node 4)
Add test case: A=5, B=1 → path
<1,3,5>✅ 🎯