(t *testing.T)
| 92 | } |
| 93 | |
| 94 | func TestGetUpstream(t *testing.T) { |
| 95 | tasks := createTestTasks() |
| 96 | g := NewGraph(tasks) |
| 97 | |
| 98 | // T5 depends on T3, T4, T2 (via T3, T4), T1 (via T2, T3) |
| 99 | upstream := g.GetUpstream("T5") |
| 100 | |
| 101 | expectedUpstream := map[string]bool{ |
| 102 | "T1": true, |
| 103 | "T2": true, |
| 104 | "T3": true, |
| 105 | "T4": true, |
| 106 | } |
| 107 | |
| 108 | if len(upstream) != len(expectedUpstream) { |
| 109 | t.Errorf("Expected %d upstream tasks for T5, got %d", len(expectedUpstream), len(upstream)) |
| 110 | } |
| 111 | |
| 112 | for taskID := range expectedUpstream { |
| 113 | if !upstream[taskID] { |
| 114 | t.Errorf("Expected %s to be upstream of T5", taskID) |
| 115 | } |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | func TestDetectCycles(t *testing.T) { |
| 120 | // Create tasks with a cycle: T1 -> T2 -> T3 -> T1 |
nothing calls this directly
no test coverage detected