mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-30 07:26:46 +00:00
Update nonce func and test coverage
This commit is contained in:
@@ -60,11 +60,26 @@ func TestString(t *testing.T) {
|
||||
func TestGetValue(t *testing.T) {
|
||||
var nonce Nonce
|
||||
timeNowNano := strconv.FormatInt(time.Now().UnixNano(), 10)
|
||||
time.Sleep(time.Millisecond * 100)
|
||||
nValue := nonce.GetValue("dingdong", true).String()
|
||||
|
||||
if timeNowNano == nValue {
|
||||
t.Error("Test failed - GetValue() error, incorrect values")
|
||||
}
|
||||
|
||||
if len(nValue) != 19 {
|
||||
t.Error("Test failed - GetValue() error, incorrect values")
|
||||
}
|
||||
|
||||
timeNowUnix := nonce.GetValue("dongding", false)
|
||||
if len(timeNowUnix.String()) != 10 {
|
||||
t.Error("Test failed - GetValue() error, incorrect values")
|
||||
}
|
||||
|
||||
n := nonce.GetValue("dongding", false)
|
||||
if n != timeNowUnix+1 {
|
||||
t.Error("Test failed - GetValue() error, incorrect values")
|
||||
}
|
||||
}
|
||||
|
||||
func TestNonceConcurrency(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user