MCPcopy Create free account
hub / github.com/driangle/taskmd / TestDetectCycles

Function TestDetectCycles

sdk/go/graph/graph_test.go:119–145  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

117}
118
119func 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
147func TestDetectNoCycles(t *testing.T) {
148 tasks := createTestTasks()

Callers

nothing calls this directly

Calls 3

DetectCyclesMethod · 0.95
NewGraphFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected