File: delta.go

package info (click to toggle)
golang-ginkgo 1.2.0%2Bgit20161006.acfa16a-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 1,324 kB
  • ctags: 1,210
  • sloc: makefile: 12
file content (22 lines) | stat: -rw-r--r-- 534 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package watch

import "sort"

type Delta struct {
	ModifiedPackages []string

	NewSuites      []*Suite
	RemovedSuites  []*Suite
	modifiedSuites []*Suite
}

type DescendingByDelta []*Suite

func (a DescendingByDelta) Len() int           { return len(a) }
func (a DescendingByDelta) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a DescendingByDelta) Less(i, j int) bool { return a[i].Delta() > a[j].Delta() }

func (d Delta) ModifiedSuites() []*Suite {
	sort.Sort(DescendingByDelta(d.modifiedSuites))
	return d.modifiedSuites
}