Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua Rubin committed Jun 17, 2015
1 parent db8b999 commit 79c1753
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions primes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ func TestPrimes(t *testing.T) {
max := uint64(10000)

Convey("Between should work", t, func() {
Convey("for invalid algorithms", func() {
primes := Between(0, max, SieveAlgo(999))
So(primes, ShouldResemble, []uint64{})
})

for _, algo := range algos {
primes := Between(max, 0, algo)
So(len(primes), ShouldEqual, 1229)
Expand Down
14 changes: 14 additions & 0 deletions sievealgo_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package primes

import (
"testing"

. "github.com/smartystreets/goconvey/convey"
)

func TestSieveAlgo(t *testing.T) {
Convey("SieveAlgos should be correct", t, func() {
So(EratosthenesAlgo, ShouldEqual, 0)
So(EratosthenesAlgo.String(), ShouldEqual, "EratosthenesAlgo")
})
}

0 comments on commit 79c1753

Please sign in to comment.