| 1 | // Copyright 2026 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | package graphscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/graph`/ |
| 6 | |
| 7 | import ( |
| 8 | "slicesscip-go gomod github.com/golang/go/src go1.25.0 slices/" |
| 9 | "testingscip-go gomod github.com/golang/go/src go1.25.0 testing/" |
| 10 | ) |
| 11 | |
| 12 | func TestShortestPathscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/graph`/TestShortestPath().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 13 | g := stringGraphscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/graph`/stringGraph#{ |
| 14 | "A": {"B", "C"}, |
| 15 | "B": {"D"}, |
| 16 | "C": {"D"}, |
| 17 | "D": {"E"}, |
| 18 | "E": {}, |
| 19 | } |
| 20 | |
| 21 | got := ShortestPathscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/graph`/ShortestPath().(g, "A", "E") |
| 22 | want := []string{"A", "B", "D", "E"} |
| 23 | if !slicesscip-go gomod github.com/golang/go/src go1.25.0 slices/.Equalscip-go gomod github.com/golang/go/src go1.25.0 slices/Equal().(got, want) { |
| 24 | t.Errorfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Errorf().("ShortestPath(A, E) = %v, want %v", got, want) |
| 25 | } |
| 26 | |
| 27 | got = ShortestPathscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/graph`/ShortestPath().(g, "A", "F") |
| 28 | if got != nil { |
| 29 | t.Errorfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Errorf().("ShortestPath(A, F) = %v, want nil", got) |
| 30 | } |
| 31 | } |