internal/set: remove Int32s, Int64s, and Strings
So far only Ints is being used and it does not seem like the
other set types will ever be used. Remove them.
We can always add them back if we need them again.
Change-Id: I9a9e8ce76bd231d1fe5b726af7da690dc4019bb8
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/170625
Reviewed-by: Herbie Ong <herbie@google.com>
diff --git a/internal/set/ints_test.go b/internal/set/ints_test.go
index b370d32..9dac18b 100644
--- a/internal/set/ints_test.go
+++ b/internal/set/ints_test.go
@@ -22,75 +22,54 @@
}
func TestInts(t *testing.T) {
- type set interface {
- Len() int
- Has(n uint64) bool
- Set(n uint64)
- Clear(n uint64)
+ ns := new(Ints)
+
+ // Check that set starts empty.
+ wantLen := 0
+ if ns.Len() != wantLen {
+ t.Errorf("init: Len() = %d, want %d", ns.Len(), wantLen)
+ }
+ for i := 0; i < maxLimit; i++ {
+ if ns.Has(uint64(i)) {
+ t.Errorf("init: Has(%d) = true, want false", i)
+ }
}
- tests := []struct {
- label string
- makeSet func() set
- limit int
- }{
- {label: "Int32s", makeSet: func() set { return new(Int32s) }, limit: 32},
- {label: "Int64s", makeSet: func() set { return new(Int64s) }, limit: 64},
- {label: "Ints", makeSet: func() set { return new(Ints) }, limit: maxLimit},
+ // Set some numbers.
+ for i, b := range toSet[:maxLimit] {
+ if b {
+ ns.Set(uint64(i))
+ wantLen++
+ }
}
- for _, tt := range tests {
- t.Run(tt.label, func(t *testing.T) {
- ns := tt.makeSet()
+ // Check that integers were set.
+ if ns.Len() != wantLen {
+ t.Errorf("after Set: Len() = %d, want %d", ns.Len(), wantLen)
+ }
+ for i := 0; i < maxLimit; i++ {
+ if got := ns.Has(uint64(i)); got != toSet[i] {
+ t.Errorf("after Set: Has(%d) = %v, want %v", i, got, !got)
+ }
+ }
- // Check that set starts empty.
- wantLen := 0
- if ns.Len() != wantLen {
- t.Errorf("init: Len() = %d, want %d", ns.Len(), wantLen)
+ // Clear some numbers.
+ for i, b := range toClear[:maxLimit] {
+ if b {
+ ns.Clear(uint64(i))
+ if toSet[i] {
+ wantLen--
}
- for i := 0; i < tt.limit; i++ {
- if ns.Has(uint64(i)) {
- t.Errorf("init: Has(%d) = true, want false", i)
- }
- }
+ }
+ }
- // Set some numbers.
- for i, b := range toSet[:tt.limit] {
- if b {
- ns.Set(uint64(i))
- wantLen++
- }
- }
-
- // Check that integers were set.
- if ns.Len() != wantLen {
- t.Errorf("after Set: Len() = %d, want %d", ns.Len(), wantLen)
- }
- for i := 0; i < tt.limit; i++ {
- if got := ns.Has(uint64(i)); got != toSet[i] {
- t.Errorf("after Set: Has(%d) = %v, want %v", i, got, !got)
- }
- }
-
- // Clear some numbers.
- for i, b := range toClear[:tt.limit] {
- if b {
- ns.Clear(uint64(i))
- if toSet[i] {
- wantLen--
- }
- }
- }
-
- // Check that integers were cleared.
- if ns.Len() != wantLen {
- t.Errorf("after Clear: Len() = %d, want %d", ns.Len(), wantLen)
- }
- for i := 0; i < tt.limit; i++ {
- if got := ns.Has(uint64(i)); got != toSet[i] && !toClear[i] {
- t.Errorf("after Clear: Has(%d) = %v, want %v", i, got, !got)
- }
- }
- })
+ // Check that integers were cleared.
+ if ns.Len() != wantLen {
+ t.Errorf("after Clear: Len() = %d, want %d", ns.Len(), wantLen)
+ }
+ for i := 0; i < maxLimit; i++ {
+ if got := ns.Has(uint64(i)); got != toSet[i] && !toClear[i] {
+ t.Errorf("after Clear: Has(%d) = %v, want %v", i, got, !got)
+ }
}
}