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

pull/6/head
Connor Doyle 2017-08-22 21:21:26 -07:00
parent 8f38abb350
commit e686ecb6ea
2 changed files with 5 additions and 5 deletions

View File

@ -140,9 +140,9 @@ func (s CPUSet) Difference(s2 CPUSet) CPUSet {
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.
func (s CPUSet) AsSlice() []int {
func (s CPUSet) ToSlice() []int {
result := []int{}
for cpu := range s {
result = append(result, cpu)
@ -160,7 +160,7 @@ func (s CPUSet) String() string {
return ""
}
elems := s.AsSlice()
elems := s.ToSlice()
sort.Ints(elems)
type rng struct {

View File

@ -269,7 +269,7 @@ func TestCPUSetDifference(t *testing.T) {
}
}
func TestCPUSetAsSlice(t *testing.T) {
func TestCPUSetToSlice(t *testing.T) {
testCases := []struct {
set CPUSet
expected []int
@ -280,7 +280,7 @@ func TestCPUSetAsSlice(t *testing.T) {
}
for _, c := range testCases {
result := c.set.AsSlice()
result := c.set.ToSlice()
if !reflect.DeepEqual(result, c.expected) {
t.Fatalf("expected set as slice to be [%v] (got [%v]), s: [%v]", c.expected, result, c.set)
}