Apply .gitignore rules
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
package counter_util
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestInfoLog(t *testing.T) {
|
||||
var iserr bool = true
|
||||
c := NewCounterUtil("test", 2, checkId, func(tag string, num int, ti time.Time) {
|
||||
msg := fmt.Sprintf("tag:%s 当前数量为num:%v ti:%v", tag, num, ti)
|
||||
if iserr {
|
||||
t.Error(msg)
|
||||
} else {
|
||||
t.Log(msg)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
c.AddNum(1)
|
||||
iserr = false
|
||||
c.AddNum(1)
|
||||
time.Sleep(time.Second * 1)
|
||||
iserr = true
|
||||
c.AddNum(1)
|
||||
time.Sleep(time.Second * 1)
|
||||
c.AddNum(1)
|
||||
}
|
||||
|
||||
func checkId(t1, t2 time.Time) bool {
|
||||
return t1.Second() == t2.Second()
|
||||
}
|
||||
Reference in New Issue
Block a user