Skip to content

Commit

Permalink
Remove a test-only method (#16)
Browse files Browse the repository at this point in the history
* Remove a test-only method

* update circle Go version

* simplify circleci

* mod update
  • Loading branch information
jmacd authored Jul 14, 2021
1 parent 69a5c9f commit cc90130
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 14 deletions.
7 changes: 1 addition & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,8 @@ jobs:
test:
working_directory: ~/go/src/github.com/lightstep/varopt
docker:
- image: circleci/golang:1.13
- image: circleci/golang:1.15
steps:
- run:
name: "configure environment"
command: |
echo 'export GOPATH="$HOME/go"' >> $BASH_ENV
source $BASH_ENV
- checkout
- run: go test -v ./...

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module github.com/lightstep/varopt

go 1.13
go 1.15

require github.com/stretchr/testify v1.4.0
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
7 changes: 1 addition & 6 deletions simple/simple.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,12 @@ func (s *Simple) Get(i int) varopt.Sample {
return s.buffer[i]
}

// Get returns the number of items in the sample. If the reservoir is
// Size returns the number of items in the sample. If the reservoir is
// full, Size() equals Capacity().
func (s *Simple) Size() int {
return len(s.buffer)
}

// Weight returns the adjusted weight of each item in the sample.
func (s *Simple) Weight() float64 {
return float64(s.observed) / float64(s.Size())
}

// Count returns the number of items that were observed.
func (s *Simple) Count() int {
return s.observed
Expand Down
2 changes: 1 addition & 1 deletion varopt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func testUnbiased(t *testing.T, bbr, bsr float64) {
ss.Add(s)
}

weight := ss.Weight()
weight := float64(ss.Count()) / float64(ss.Size())
for i := 0; i < ss.Size(); i++ {
vsample.Add(ss.Get(i), weight)
}
Expand Down

0 comments on commit cc90130

Please sign in to comment.