(t *testing.T)
| 117 | } |
| 118 | |
| 119 | func TestDetectCycles(t *testing.T) { |
| 120 | // Create tasks with a cycle: T1 -> T2 -> T3 -> T1 |
| 121 | cyclicTasks := []*model.Task{ |
| 122 | { |
| 123 | ID: "T1", |
| 124 | Title: "Task 1", |
| 125 | Dependencies: []string{"T3"}, |
| 126 | }, |
| 127 | { |
| 128 | ID: "T2", |
| 129 | Title: "Task 2", |
| 130 | Dependencies: []string{"T1"}, |
| 131 | }, |
| 132 | { |
| 133 | ID: "T3", |
| 134 | Title: "Task 3", |
| 135 | Dependencies: []string{"T2"}, |
| 136 | }, |
| 137 | } |
| 138 | |
| 139 | g := NewGraph(cyclicTasks) |
| 140 | cycles := g.DetectCycles() |
| 141 | |
| 142 | if len(cycles) == 0 { |
| 143 | t.Error("Expected to detect at least one cycle") |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | func TestDetectNoCycles(t *testing.T) { |
| 148 | tasks := createTestTasks() |
nothing calls this directly
no test coverage detected