Commit e686ecb6 authored by Connor Doyle's avatar Connor Doyle

Renamed CPUSet.AsSlice() => CPUSet.ToSlice()

parent 8f38abb3
...@@ -140,9 +140,9 @@ func (s CPUSet) Difference(s2 CPUSet) CPUSet { ...@@ -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 { ...@@ -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) { ...@@ -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) { ...@@ -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)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment