@@ -23,8 +23,8 @@ import (
2323 "testing"
2424 "time"
2525
26+ "github.com/bytedance/gopkg/internal/assert"
2627 "github.com/bytedance/gopkg/lang/fastrand"
27- "github.com/stretchr/testify/assert"
2828)
2929
3030var letterRunes = []rune ("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" )
@@ -39,7 +39,7 @@ func randString(prefix string) string {
3939
4040func TestFloat64Set (t * testing.T ) {
4141 z := NewFloat64 ()
42- assert .Zero (t , z .Len ())
42+ assert .True (t , z .Len () == 0 )
4343}
4444
4545func TestFloat64SetAdd (t * testing.T ) {
@@ -156,7 +156,7 @@ func TestFloat64SetRank_UpdateScore(t *testing.T) {
156156 for _ , v := range vs {
157157 r := z .Rank (v )
158158 assert .NotEqual (t , - 1 , r )
159- assert .Greater (t , z .Len (), r )
159+ assert .True (t , z .Len () > r )
160160
161161 // verify rank by traversing level 0
162162 actualRank := 0
@@ -237,11 +237,16 @@ func testInternalSpan(t *testing.T, z *Float64Set) {
237237 assert .NotEqual (t , - 1 , toRank )
238238
239239 // span = to.rank - from.rank
240- assert .Equalf (t , span , toRank - fromRank , "from %q (score: , rank: %d) to %q (score: %d, rank: %d), expect span: %d, actual: %d" ,
241- from , fromScore , fromRank , to , toScore , toRank , span , toRank - fromRank )
240+ if span != toRank - fromRank {
241+ t .Fatalf ("from %q (score: %v, rank: %d) to %q (score: %v, rank: %d), expect span: %d, actual: %d" ,
242+ from , fromScore , fromRank , to , toScore , toRank , span , toRank - fromRank )
243+ }
242244 } else { // from -> nil
243245 // span = skiplist.len - from.rank
244- assert .Equalf (t , l .length - fromRank , x .loadSpan (i ), "%q (score: , rank: %d)" , from , fromScore , fromRank )
246+ if l .length - fromRank != x .loadSpan (i ) {
247+ t .Fatalf ("%q (score: %v, rank: %d): expect span %d, actual %d" ,
248+ from , fromScore , fromRank , l .length - fromRank , x .loadSpan (i ))
249+ }
245250 }
246251 }
247252 }
@@ -408,8 +413,8 @@ func testFloat64SetRangeByScore(t *testing.T, rev bool) {
408413 }
409414 var prev * float64
410415 for _ , n := range ns {
411- assert .LessOrEqual (t , min , n .Score )
412- assert .GreaterOrEqual (t , max , n .Score )
416+ assert .True (t , min <= n .Score )
417+ assert .True (t , max >= n .Score )
413418 if prev != nil {
414419 if rev {
415420 assert .True (t , * prev >= n .Score )
@@ -598,7 +603,7 @@ func TestUnionFloat64(t *testing.T) {
598603
599604func TestUnionFloat64_Empty (t * testing.T ) {
600605 z := UnionFloat64 ()
601- assert .Zero (t , z .Len ())
606+ assert .True (t , z .Len () == 0 )
602607}
603608
604609func TestInterFloat64 (t * testing.T ) {
@@ -626,7 +631,7 @@ func TestInterFloat64(t *testing.T) {
626631
627632func TestInterFloat64_Empty (t * testing.T ) {
628633 z := InterFloat64 ()
629- assert .Zero (t , z .Len ())
634+ assert .True (t , z .Len () == 0 )
630635}
631636
632637func TestInterFloat64_Simple (t * testing.T ) {
@@ -638,7 +643,7 @@ func TestInterFloat64_Simple(t *testing.T) {
638643 z3 .Add (0 , "2" )
639644
640645 z := InterFloat64 (z1 , z2 , z3 )
641- assert .Zero (t , z .Len ())
646+ assert .True (t , z .Len () == 0 )
642647}
643648
644649func BenchmarkRankAfterDelete (b * testing.B ) {
0 commit comments