mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-13 13:55:41 +00:00
Renamed CPUSet.AsSlice() => CPUSet.ToSlice()
This commit is contained in:
parent
8f38abb350
commit
e686ecb6ea
@ -140,9 +140,9 @@ func (s CPUSet) Difference(s2 CPUSet) CPUSet {
|
|||||||
return s.FilterNot(func(cpu int) bool { return s2.Contains(cpu) })
|
return s.FilterNot(func(cpu int) bool { return s2.Contains(cpu) })
|
||||||
}
|
}
|
||||||
|
|
||||||
// AsSlice returns a slice of integers that contains all elements from
|
// ToSlice returns a slice of integers that contains all elements from
|
||||||
// this set.
|
// this set.
|
||||||
func (s CPUSet) AsSlice() []int {
|
func (s CPUSet) ToSlice() []int {
|
||||||
result := []int{}
|
result := []int{}
|
||||||
for cpu := range s {
|
for cpu := range s {
|
||||||
result = append(result, cpu)
|
result = append(result, cpu)
|
||||||
@ -160,7 +160,7 @@ func (s CPUSet) String() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
elems := s.AsSlice()
|
elems := s.ToSlice()
|
||||||
sort.Ints(elems)
|
sort.Ints(elems)
|
||||||
|
|
||||||
type rng struct {
|
type rng struct {
|
||||||
|
@ -269,7 +269,7 @@ func TestCPUSetDifference(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCPUSetAsSlice(t *testing.T) {
|
func TestCPUSetToSlice(t *testing.T) {
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
set CPUSet
|
set CPUSet
|
||||||
expected []int
|
expected []int
|
||||||
@ -280,7 +280,7 @@ func TestCPUSetAsSlice(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, c := range testCases {
|
for _, c := range testCases {
|
||||||
result := c.set.AsSlice()
|
result := c.set.ToSlice()
|
||||||
if !reflect.DeepEqual(result, c.expected) {
|
if !reflect.DeepEqual(result, c.expected) {
|
||||||
t.Fatalf("expected set as slice to be [%v] (got [%v]), s: [%v]", c.expected, result, c.set)
|
t.Fatalf("expected set as slice to be [%v] (got [%v]), s: [%v]", c.expected, result, c.set)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user