mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-13 23:16:45 +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) {
|
||||
|
||||
8
testdata/configtest.dat
vendored
8
testdata/configtest.dat
vendored
@@ -42,9 +42,9 @@
|
||||
"Password": "12334",
|
||||
"Contacts": [
|
||||
{
|
||||
"Name": "StyleGherkin",
|
||||
"Number": "1231424",
|
||||
"Enabled": true
|
||||
"name": "StyleGherkin",
|
||||
"number": "1231424",
|
||||
"enabled": true
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -436,4 +436,4 @@
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user