(t *testing.T)
| 35 | } |
| 36 | |
| 37 | func TestDfsWhenPathIsNotFound(t *testing.T) { |
| 38 | nodes := []int{ |
| 39 | 1, 2, 3, 4, 5, 6, |
| 40 | } |
| 41 | |
| 42 | //Adjacency Matrix for connected nodes |
| 43 | edges := [][]bool{ |
| 44 | {false, true, true, false, false, false}, |
| 45 | {true, false, false, true, false, false}, |
| 46 | {true, false, false, true, false, false}, |
| 47 | {false, true, true, false, true, false}, |
| 48 | {false, false, false, true, false, true}, |
| 49 | {false, false, false, false, true, false}, |
| 50 | } |
| 51 | |
| 52 | start := 1 |
| 53 | end := 7 |
| 54 | |
| 55 | actual, actualIsFound := DepthFirstSearch(start, end, nodes, edges) |
| 56 | var expected []int |
| 57 | expectedIsFound := false |
| 58 | t.Run("Test Dfs", func(t *testing.T) { |
| 59 | if !reflect.DeepEqual(expected, actual) || !reflect.DeepEqual(actualIsFound, expectedIsFound) { |
| 60 | t.Errorf("got route: %v, want route: %v", actual, expected) |
| 61 | t.Errorf("got isFound: %v, want isFound: %v", actualIsFound, expectedIsFound) |
| 62 | } |
| 63 | }) |
| 64 | } |
nothing calls this directly
no test coverage detected