Skip to content

Commit cc90130

Browse files
authored
Remove a test-only method (#16)
* Remove a test-only method * update circle Go version * simplify circleci * mod update
1 parent 69a5c9f commit cc90130

File tree

5 files changed

+5
-14
lines changed

5 files changed

+5
-14
lines changed

.circleci/config.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,8 @@ jobs:
44
test:
55
working_directory: ~/go/src/github.com/lightstep/varopt
66
docker:
7-
- image: circleci/golang:1.13
7+
- image: circleci/golang:1.15
88
steps:
9-
- run:
10-
name: "configure environment"
11-
command: |
12-
echo 'export GOPATH="$HOME/go"' >> $BASH_ENV
13-
source $BASH_ENV
149
- checkout
1510
- run: go test -v ./...
1611

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module github.com/lightstep/varopt
22

3-
go 1.13
3+
go 1.15
44

55
require github.com/stretchr/testify v1.4.0

go.sum

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
55
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
66
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
77
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
8+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
89
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
910
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
1011
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

simple/simple.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,12 @@ func (s *Simple) Get(i int) varopt.Sample {
5353
return s.buffer[i]
5454
}
5555

56-
// Get returns the number of items in the sample. If the reservoir is
56+
// Size returns the number of items in the sample. If the reservoir is
5757
// full, Size() equals Capacity().
5858
func (s *Simple) Size() int {
5959
return len(s.buffer)
6060
}
6161

62-
// Weight returns the adjusted weight of each item in the sample.
63-
func (s *Simple) Weight() float64 {
64-
return float64(s.observed) / float64(s.Size())
65-
}
66-
6762
// Count returns the number of items that were observed.
6863
func (s *Simple) Count() int {
6964
return s.observed

varopt_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ func testUnbiased(t *testing.T, bbr, bsr float64) {
113113
ss.Add(s)
114114
}
115115

116-
weight := ss.Weight()
116+
weight := float64(ss.Count()) / float64(ss.Size())
117117
for i := 0; i < ss.Size(); i++ {
118118
vsample.Add(ss.Get(i), weight)
119119
}

0 commit comments

Comments
 (0)