Make testing simple (#20)

* Make testing simpler

* Remove testing deps

* Simplemize tests
This commit is contained in:
Osamu TONOMORI
2020-08-27 10:17:19 +09:00
committed by GitHub
parent 60e9d38e92
commit 848d664cee
3 changed files with 5 additions and 12 deletions

4
go.mod
View File

@@ -1,5 +1,3 @@
module github.com/sony/sonyflake
go 1.12
require github.com/deckarep/golang-set v1.7.1
go 1.13

2
go.sum
View File

@@ -1,2 +0,0 @@
github.com/deckarep/golang-set v1.7.1 h1:SCQV0S6gTtp6itiFrTqI+pfmJ4LN85S1YzhDf9rTHJQ=
github.com/deckarep/golang-set v1.7.1/go.mod h1:93vsz/8Wt4joVM7c2AVqh+YRMiUSc14yDtF28KmMOgQ=

View File

@@ -5,8 +5,6 @@ import (
"runtime"
"testing"
"time"
"github.com/deckarep/golang-set"
)
var sf *Sonyflake
@@ -139,16 +137,15 @@ func TestSonyflakeInParallel(t *testing.T) {
go generate()
}
set := mapset.NewSet()
set := make(map[uint64]struct{})
for i := 0; i < numID*numGenerator; i++ {
id := <-consumer
if set.Contains(id) {
if _, ok := set[id]; ok {
t.Fatal("duplicated id")
} else {
set.Add(id)
}
set[id] = struct{}{}
}
fmt.Println("number of id:", set.Cardinality())
fmt.Println("number of id:", len(set))
}
func TestNilSonyflake(t *testing.T) {