mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 02:33:34 +00:00
Changes to accommodate client-go changes and kube vendor update
to v1.18.0 Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
This commit is contained in:
committed by
mergify[bot]
parent
4c96ad3c85
commit
34fc1d847e
18
vendor/github.com/onsi/ginkgo/.travis.yml
generated
vendored
18
vendor/github.com/onsi/ginkgo/.travis.yml
generated
vendored
@ -4,14 +4,22 @@ go:
|
||||
- 1.13.x
|
||||
- tip
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $GOPATH/pkg/mod
|
||||
|
||||
# allow internal package imports, necessary for forked repositories
|
||||
go_import_path: github.com/onsi/ginkgo
|
||||
|
||||
install:
|
||||
- go get -v -t ./...
|
||||
- go get golang.org/x/tools/cmd/cover
|
||||
- go get github.com/onsi/gomega
|
||||
- go install github.com/onsi/ginkgo/ginkgo
|
||||
- GO111MODULE="off" go get -v -t ./...
|
||||
- GO111MODULE="off" go get golang.org/x/tools/cmd/cover
|
||||
- GO111MODULE="off" go get github.com/onsi/gomega
|
||||
- GO111MODULE="off" go install github.com/onsi/ginkgo/ginkgo
|
||||
- export PATH=$PATH:$HOME/gopath/bin
|
||||
|
||||
script: $HOME/gopath/bin/ginkgo -r --randomizeAllSpecs --randomizeSuites --race --trace && go vet
|
||||
script:
|
||||
- GO111MODULE="on" go mod tidy
|
||||
- diff -u <(echo -n) <(git diff go.mod)
|
||||
- diff -u <(echo -n) <(git diff go.sum)
|
||||
- $HOME/gopath/bin/ginkgo -r --randomizeAllSpecs --randomizeSuites --race --trace && go vet
|
||||
|
5
vendor/github.com/onsi/ginkgo/CHANGELOG.md
generated
vendored
5
vendor/github.com/onsi/ginkgo/CHANGELOG.md
generated
vendored
@ -1,3 +1,8 @@
|
||||
## 1.12.0
|
||||
|
||||
### Features
|
||||
- Add module definition (#630) [78916ab]
|
||||
|
||||
## 1.11.0
|
||||
|
||||
### Features
|
||||
|
2
vendor/github.com/onsi/ginkgo/config/config.go
generated
vendored
2
vendor/github.com/onsi/ginkgo/config/config.go
generated
vendored
@ -20,7 +20,7 @@ import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
const VERSION = "1.11.0"
|
||||
const VERSION = "1.12.0"
|
||||
|
||||
type GinkgoConfigType struct {
|
||||
RandomSeed int64
|
||||
|
9
vendor/github.com/onsi/ginkgo/go.mod
generated
vendored
Normal file
9
vendor/github.com/onsi/ginkgo/go.mod
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
module github.com/onsi/ginkgo
|
||||
|
||||
require (
|
||||
github.com/hpcloud/tail v1.0.0
|
||||
github.com/onsi/gomega v1.7.1
|
||||
golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e
|
||||
)
|
||||
|
||||
go 1.12
|
26
vendor/github.com/onsi/ginkgo/go.sum
generated
vendored
Normal file
26
vendor/github.com/onsi/ginkgo/go.sum
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
|
||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
|
||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/gomega v1.7.1 h1:K0jcRCwNQM3vFGh1ppMtDh/+7ApJrjldlX8fA0jDTLQ=
|
||||
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
|
||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd h1:nTDtHvHSdCn1m6ITfMRqtOd/9+7a3s8RBNOZ3eYZzJA=
|
||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e h1:N7DeIrjYszNmSW409R3frPPwglRwMkXSBzwVbkOjLLA=
|
||||
golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
|
||||
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
|
||||
gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I=
|
||||
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
7
vendor/github.com/onsi/gomega/CHANGELOG.md
generated
vendored
7
vendor/github.com/onsi/gomega/CHANGELOG.md
generated
vendored
@ -1,3 +1,10 @@
|
||||
## 1.9.0
|
||||
|
||||
### Features
|
||||
- Add ContainElements matcher (#370) [2f57380]
|
||||
- Output missing and extra elements in ConsistOf failure message [a31eda7]
|
||||
- Document method LargestMatching [7c5a280]
|
||||
|
||||
## 1.8.1
|
||||
|
||||
### Fixes
|
||||
|
2
vendor/github.com/onsi/gomega/gomega_dsl.go
generated
vendored
2
vendor/github.com/onsi/gomega/gomega_dsl.go
generated
vendored
@ -24,7 +24,7 @@ import (
|
||||
"github.com/onsi/gomega/types"
|
||||
)
|
||||
|
||||
const GOMEGA_VERSION = "1.8.1"
|
||||
const GOMEGA_VERSION = "1.9.0"
|
||||
|
||||
const nilFailHandlerPanic = `You are trying to make an assertion, but Gomega's fail handler is nil.
|
||||
If you're using Ginkgo then you probably forgot to put your assertion in an It().
|
||||
|
14
vendor/github.com/onsi/gomega/matchers.go
generated
vendored
14
vendor/github.com/onsi/gomega/matchers.go
generated
vendored
@ -306,6 +306,20 @@ func ConsistOf(elements ...interface{}) types.GomegaMatcher {
|
||||
}
|
||||
}
|
||||
|
||||
//ContainElements succeeds if actual contains the passed in elements. The ordering of the elements does not matter.
|
||||
//By default ContainElements() uses Equal() to match the elements, however custom matchers can be passed in instead. Here are some examples:
|
||||
//
|
||||
// Expect([]string{"Foo", "FooBar"}).Should(ContainElements("FooBar"))
|
||||
// Expect([]string{"Foo", "FooBar"}).Should(ContainElements(ContainSubstring("Bar"), "Foo"))
|
||||
//
|
||||
//Actual must be an array, slice or map.
|
||||
//For maps, ContainElements searches through the map's values.
|
||||
func ContainElements(elements ...interface{}) types.GomegaMatcher {
|
||||
return &matchers.ContainElementsMatcher{
|
||||
Elements: elements,
|
||||
}
|
||||
}
|
||||
|
||||
//HaveKey succeeds if actual is a map with the passed in key.
|
||||
//By default HaveKey uses Equal() to perform the match, however a
|
||||
//matcher can be passed in instead:
|
||||
|
99
vendor/github.com/onsi/gomega/matchers/consist_of.go
generated
vendored
99
vendor/github.com/onsi/gomega/matchers/consist_of.go
generated
vendored
@ -11,7 +11,9 @@ import (
|
||||
)
|
||||
|
||||
type ConsistOfMatcher struct {
|
||||
Elements []interface{}
|
||||
Elements []interface{}
|
||||
missingElements []interface{}
|
||||
extraElements []interface{}
|
||||
}
|
||||
|
||||
func (matcher *ConsistOfMatcher) Match(actual interface{}) (success bool, err error) {
|
||||
@ -19,44 +21,63 @@ func (matcher *ConsistOfMatcher) Match(actual interface{}) (success bool, err er
|
||||
return false, fmt.Errorf("ConsistOf matcher expects an array/slice/map. Got:\n%s", format.Object(actual, 1))
|
||||
}
|
||||
|
||||
elements := matcher.Elements
|
||||
if len(matcher.Elements) == 1 && isArrayOrSlice(matcher.Elements[0]) {
|
||||
elements = []interface{}{}
|
||||
value := reflect.ValueOf(matcher.Elements[0])
|
||||
for i := 0; i < value.Len(); i++ {
|
||||
elements = append(elements, value.Index(i).Interface())
|
||||
}
|
||||
}
|
||||
|
||||
matchers := []interface{}{}
|
||||
for _, element := range elements {
|
||||
matcher, isMatcher := element.(omegaMatcher)
|
||||
if !isMatcher {
|
||||
matcher = &EqualMatcher{Expected: element}
|
||||
}
|
||||
matchers = append(matchers, matcher)
|
||||
}
|
||||
|
||||
values := matcher.valuesOf(actual)
|
||||
|
||||
if len(values) != len(matchers) {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
neighbours := func(v, m interface{}) (bool, error) {
|
||||
match, err := m.(omegaMatcher).Match(v)
|
||||
return match && err == nil, nil
|
||||
}
|
||||
matchers := matchers(matcher.Elements)
|
||||
values := valuesOf(actual)
|
||||
|
||||
bipartiteGraph, err := bipartitegraph.NewBipartiteGraph(values, matchers, neighbours)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return len(bipartiteGraph.LargestMatching()) == len(values), nil
|
||||
edges := bipartiteGraph.LargestMatching()
|
||||
if len(edges) == len(values) && len(edges) == len(matchers) {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
var missingMatchers []interface{}
|
||||
matcher.extraElements, missingMatchers = bipartiteGraph.FreeLeftRight(edges)
|
||||
matcher.missingElements = equalMatchersToElements(missingMatchers)
|
||||
|
||||
return false, nil
|
||||
}
|
||||
|
||||
func (matcher *ConsistOfMatcher) valuesOf(actual interface{}) []interface{} {
|
||||
func neighbours(value, matcher interface{}) (bool, error) {
|
||||
match, err := matcher.(omegaMatcher).Match(value)
|
||||
return match && err == nil, nil
|
||||
}
|
||||
|
||||
func equalMatchersToElements(matchers []interface{}) (elements []interface{}) {
|
||||
for _, matcher := range matchers {
|
||||
equalMatcher, ok := matcher.(*EqualMatcher)
|
||||
if ok {
|
||||
matcher = equalMatcher.Expected
|
||||
}
|
||||
elements = append(elements, matcher)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func matchers(expectedElems []interface{}) (matchers []interface{}) {
|
||||
elems := expectedElems
|
||||
if len(expectedElems) == 1 && isArrayOrSlice(expectedElems[0]) {
|
||||
elems = []interface{}{}
|
||||
value := reflect.ValueOf(expectedElems[0])
|
||||
for i := 0; i < value.Len(); i++ {
|
||||
elems = append(elems, value.Index(i).Interface())
|
||||
}
|
||||
}
|
||||
|
||||
for _, e := range elems {
|
||||
matcher, isMatcher := e.(omegaMatcher)
|
||||
if !isMatcher {
|
||||
matcher = &EqualMatcher{Expected: e}
|
||||
}
|
||||
matchers = append(matchers, matcher)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func valuesOf(actual interface{}) []interface{} {
|
||||
value := reflect.ValueOf(actual)
|
||||
values := []interface{}{}
|
||||
if isMap(actual) {
|
||||
@ -74,7 +95,21 @@ func (matcher *ConsistOfMatcher) valuesOf(actual interface{}) []interface{} {
|
||||
}
|
||||
|
||||
func (matcher *ConsistOfMatcher) FailureMessage(actual interface{}) (message string) {
|
||||
return format.Message(actual, "to consist of", matcher.Elements)
|
||||
message = format.Message(actual, "to consist of", matcher.Elements)
|
||||
message = appendMissingElements(message, matcher.missingElements)
|
||||
if len(matcher.extraElements) > 0 {
|
||||
message = fmt.Sprintf("%s\nthe extra elements were\n%s", message,
|
||||
format.Object(matcher.extraElements, 1))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func appendMissingElements(message string, missingElements []interface{}) string {
|
||||
if len(missingElements) == 0 {
|
||||
return message
|
||||
}
|
||||
return fmt.Sprintf("%s\nthe missing elements were\n%s", message,
|
||||
format.Object(missingElements, 1))
|
||||
}
|
||||
|
||||
func (matcher *ConsistOfMatcher) NegatedFailureMessage(actual interface{}) (message string) {
|
||||
|
44
vendor/github.com/onsi/gomega/matchers/contain_elements_matcher.go
generated
vendored
Normal file
44
vendor/github.com/onsi/gomega/matchers/contain_elements_matcher.go
generated
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
package matchers
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/onsi/gomega/format"
|
||||
"github.com/onsi/gomega/matchers/support/goraph/bipartitegraph"
|
||||
)
|
||||
|
||||
type ContainElementsMatcher struct {
|
||||
Elements []interface{}
|
||||
missingElements []interface{}
|
||||
}
|
||||
|
||||
func (matcher *ContainElementsMatcher) Match(actual interface{}) (success bool, err error) {
|
||||
if !isArrayOrSlice(actual) && !isMap(actual) {
|
||||
return false, fmt.Errorf("ContainElements matcher expects an array/slice/map. Got:\n%s", format.Object(actual, 1))
|
||||
}
|
||||
|
||||
matchers := matchers(matcher.Elements)
|
||||
bipartiteGraph, err := bipartitegraph.NewBipartiteGraph(valuesOf(actual), matchers, neighbours)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
edges := bipartiteGraph.LargestMatching()
|
||||
if len(edges) == len(matchers) {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
_, missingMatchers := bipartiteGraph.FreeLeftRight(edges)
|
||||
matcher.missingElements = equalMatchersToElements(missingMatchers)
|
||||
|
||||
return false, nil
|
||||
}
|
||||
|
||||
func (matcher *ContainElementsMatcher) FailureMessage(actual interface{}) (message string) {
|
||||
message = format.Message(actual, "to contain elements", matcher.Elements)
|
||||
return appendMissingElements(message, matcher.missingElements)
|
||||
}
|
||||
|
||||
func (matcher *ContainElementsMatcher) NegatedFailureMessage(actual interface{}) (message string) {
|
||||
return format.Message(actual, "not to contain elements", matcher.Elements)
|
||||
}
|
26
vendor/github.com/onsi/gomega/matchers/support/goraph/bipartitegraph/bipartitegraph.go
generated
vendored
26
vendor/github.com/onsi/gomega/matchers/support/goraph/bipartitegraph/bipartitegraph.go
generated
vendored
@ -13,13 +13,13 @@ type BipartiteGraph struct {
|
||||
|
||||
func NewBipartiteGraph(leftValues, rightValues []interface{}, neighbours func(interface{}, interface{}) (bool, error)) (*BipartiteGraph, error) {
|
||||
left := NodeOrderedSet{}
|
||||
for i := range leftValues {
|
||||
left = append(left, Node{Id: i})
|
||||
for i, v := range leftValues {
|
||||
left = append(left, Node{ID: i, Value: v})
|
||||
}
|
||||
|
||||
right := NodeOrderedSet{}
|
||||
for j := range rightValues {
|
||||
right = append(right, Node{Id: j + len(left)})
|
||||
for j, v := range rightValues {
|
||||
right = append(right, Node{ID: j + len(left), Value: v})
|
||||
}
|
||||
|
||||
edges := EdgeSet{}
|
||||
@ -31,10 +31,26 @@ func NewBipartiteGraph(leftValues, rightValues []interface{}, neighbours func(in
|
||||
}
|
||||
|
||||
if neighbours {
|
||||
edges = append(edges, Edge{Node1: left[i], Node2: right[j]})
|
||||
edges = append(edges, Edge{Node1: left[i].ID, Node2: right[j].ID})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return &BipartiteGraph{left, right, edges}, nil
|
||||
}
|
||||
|
||||
// FreeLeftRight returns left node values and right node values
|
||||
// of the BipartiteGraph's nodes which are not part of the given edges.
|
||||
func (bg *BipartiteGraph) FreeLeftRight(edges EdgeSet) (leftValues, rightValues []interface{}) {
|
||||
for _, node := range bg.Left {
|
||||
if edges.Free(node) {
|
||||
leftValues = append(leftValues, node.Value)
|
||||
}
|
||||
}
|
||||
for _, node := range bg.Right {
|
||||
if edges.Free(node) {
|
||||
rightValues = append(rightValues, node.Value)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -1,9 +1,14 @@
|
||||
package bipartitegraph
|
||||
|
||||
import . "github.com/onsi/gomega/matchers/support/goraph/node"
|
||||
import . "github.com/onsi/gomega/matchers/support/goraph/edge"
|
||||
import "github.com/onsi/gomega/matchers/support/goraph/util"
|
||||
import (
|
||||
. "github.com/onsi/gomega/matchers/support/goraph/edge"
|
||||
. "github.com/onsi/gomega/matchers/support/goraph/node"
|
||||
"github.com/onsi/gomega/matchers/support/goraph/util"
|
||||
)
|
||||
|
||||
// LargestMatching implements the Hopcroft–Karp algorithm taking as input a bipartite graph
|
||||
// and outputting a maximum cardinality matching, i.e. a set of as many edges as possible
|
||||
// with the property that no two edges share an endpoint.
|
||||
func (bg *BipartiteGraph) LargestMatching() (matching EdgeSet) {
|
||||
paths := bg.maximalDisjointSLAPCollection(matching)
|
||||
|
||||
@ -23,7 +28,7 @@ func (bg *BipartiteGraph) maximalDisjointSLAPCollection(matching EdgeSet) (resul
|
||||
return
|
||||
}
|
||||
|
||||
used := make(map[Node]bool)
|
||||
used := make(map[int]bool)
|
||||
|
||||
for _, u := range guideLayers[len(guideLayers)-1] {
|
||||
slap, found := bg.findDisjointSLAP(u, matching, guideLayers, used)
|
||||
@ -43,7 +48,7 @@ func (bg *BipartiteGraph) findDisjointSLAP(
|
||||
start Node,
|
||||
matching EdgeSet,
|
||||
guideLayers []NodeOrderedSet,
|
||||
used map[Node]bool,
|
||||
used map[int]bool,
|
||||
) ([]Edge, bool) {
|
||||
return bg.findDisjointSLAPHelper(start, EdgeSet{}, len(guideLayers)-1, matching, guideLayers, used)
|
||||
}
|
||||
@ -54,16 +59,16 @@ func (bg *BipartiteGraph) findDisjointSLAPHelper(
|
||||
currentLevel int,
|
||||
matching EdgeSet,
|
||||
guideLayers []NodeOrderedSet,
|
||||
used map[Node]bool,
|
||||
used map[int]bool,
|
||||
) (EdgeSet, bool) {
|
||||
used[currentNode] = true
|
||||
used[currentNode.ID] = true
|
||||
|
||||
if currentLevel == 0 {
|
||||
return currentSLAP, true
|
||||
}
|
||||
|
||||
for _, nextNode := range guideLayers[currentLevel-1] {
|
||||
if used[nextNode] {
|
||||
if used[nextNode.ID] {
|
||||
continue
|
||||
}
|
||||
|
||||
@ -84,17 +89,17 @@ func (bg *BipartiteGraph) findDisjointSLAPHelper(
|
||||
currentSLAP = currentSLAP[:len(currentSLAP)-1]
|
||||
}
|
||||
|
||||
used[currentNode] = false
|
||||
used[currentNode.ID] = false
|
||||
return nil, false
|
||||
}
|
||||
|
||||
func (bg *BipartiteGraph) createSLAPGuideLayers(matching EdgeSet) (guideLayers []NodeOrderedSet) {
|
||||
used := make(map[Node]bool)
|
||||
used := make(map[int]bool)
|
||||
currentLayer := NodeOrderedSet{}
|
||||
|
||||
for _, node := range bg.Left {
|
||||
if matching.Free(node) {
|
||||
used[node] = true
|
||||
used[node.ID] = true
|
||||
currentLayer = append(currentLayer, node)
|
||||
}
|
||||
}
|
||||
@ -113,7 +118,7 @@ func (bg *BipartiteGraph) createSLAPGuideLayers(matching EdgeSet) (guideLayers [
|
||||
if util.Odd(len(guideLayers)) {
|
||||
for _, leftNode := range lastLayer {
|
||||
for _, rightNode := range bg.Right {
|
||||
if used[rightNode] {
|
||||
if used[rightNode.ID] {
|
||||
continue
|
||||
}
|
||||
|
||||
@ -123,7 +128,7 @@ func (bg *BipartiteGraph) createSLAPGuideLayers(matching EdgeSet) (guideLayers [
|
||||
}
|
||||
|
||||
currentLayer = append(currentLayer, rightNode)
|
||||
used[rightNode] = true
|
||||
used[rightNode.ID] = true
|
||||
|
||||
if matching.Free(rightNode) {
|
||||
done = true
|
||||
@ -133,7 +138,7 @@ func (bg *BipartiteGraph) createSLAPGuideLayers(matching EdgeSet) (guideLayers [
|
||||
} else {
|
||||
for _, rightNode := range lastLayer {
|
||||
for _, leftNode := range bg.Left {
|
||||
if used[leftNode] {
|
||||
if used[leftNode.ID] {
|
||||
continue
|
||||
}
|
||||
|
||||
@ -143,7 +148,7 @@ func (bg *BipartiteGraph) createSLAPGuideLayers(matching EdgeSet) (guideLayers [
|
||||
}
|
||||
|
||||
currentLayer = append(currentLayer, leftNode)
|
||||
used[leftNode] = true
|
||||
used[leftNode.ID] = true
|
||||
}
|
||||
}
|
||||
|
||||
|
8
vendor/github.com/onsi/gomega/matchers/support/goraph/edge/edge.go
generated
vendored
8
vendor/github.com/onsi/gomega/matchers/support/goraph/edge/edge.go
generated
vendored
@ -3,15 +3,15 @@ package edge
|
||||
import . "github.com/onsi/gomega/matchers/support/goraph/node"
|
||||
|
||||
type Edge struct {
|
||||
Node1 Node
|
||||
Node2 Node
|
||||
Node1 int
|
||||
Node2 int
|
||||
}
|
||||
|
||||
type EdgeSet []Edge
|
||||
|
||||
func (ec EdgeSet) Free(node Node) bool {
|
||||
for _, e := range ec {
|
||||
if e.Node1 == node || e.Node2 == node {
|
||||
if e.Node1 == node.ID || e.Node2 == node.ID {
|
||||
return false
|
||||
}
|
||||
}
|
||||
@ -31,7 +31,7 @@ func (ec EdgeSet) Contains(edge Edge) bool {
|
||||
|
||||
func (ec EdgeSet) FindByNodes(node1, node2 Node) (Edge, bool) {
|
||||
for _, e := range ec {
|
||||
if (e.Node1 == node1 && e.Node2 == node2) || (e.Node1 == node2 && e.Node2 == node1) {
|
||||
if (e.Node1 == node1.ID && e.Node2 == node2.ID) || (e.Node1 == node2.ID && e.Node2 == node1.ID) {
|
||||
return e, true
|
||||
}
|
||||
}
|
||||
|
3
vendor/github.com/onsi/gomega/matchers/support/goraph/node/node.go
generated
vendored
3
vendor/github.com/onsi/gomega/matchers/support/goraph/node/node.go
generated
vendored
@ -1,7 +1,8 @@
|
||||
package node
|
||||
|
||||
type Node struct {
|
||||
Id int
|
||||
ID int
|
||||
Value interface{}
|
||||
}
|
||||
|
||||
type NodeOrderedSet []Node
|
||||
|
Reference in New Issue
Block a user