(t *testing.T)
| 67 | } |
| 68 | |
| 69 | func TestGetDownstream(t *testing.T) { |
| 70 | tasks := createTestTasks() |
| 71 | g := NewGraph(tasks) |
| 72 | |
| 73 | // T1 blocks T2, T3, T4 (via T2), T5 (via T3, T4) |
| 74 | downstream := g.GetDownstream("T1") |
| 75 | |
| 76 | expectedDownstream := map[string]bool{ |
| 77 | "T2": true, |
| 78 | "T3": true, |
| 79 | "T4": true, |
| 80 | "T5": true, |
| 81 | } |
| 82 | |
| 83 | if len(downstream) != len(expectedDownstream) { |
| 84 | t.Errorf("Expected %d downstream tasks for T1, got %d", len(expectedDownstream), len(downstream)) |
| 85 | } |
| 86 | |
| 87 | for taskID := range expectedDownstream { |
| 88 | if !downstream[taskID] { |
| 89 | t.Errorf("Expected %s to be downstream of T1", taskID) |
| 90 | } |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | func TestGetUpstream(t *testing.T) { |
| 95 | tasks := createTestTasks() |
nothing calls this directly
no test coverage detected