mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-31 23:16:54 +00:00
Engine: Protocol Features, coverage, types, BTC markets websocket (#368)
* Attempts to update orderbook so it doesn't need to sort * Reverts the ws ob stuff. Gets rid of sorting because it happens later. Adds some exchange features * update existing feature lists. Expands list definition to match my emotions * Adds bithumb bitmex and bitstamp. adds a couple more types * Features for you, features for me, features for bittrex, btcmarkets, btse, coinbasepro, coinut, exmo, gateio and gemini * Features for hitbtc, huobi, itbit, kraken, lakebtc, lbank, localbitcoins, okcoin, okex, poloniex, yobit, zb * Who can forget good old alphapoint? * Adds btcmarksets websocket :glitch_crab: fixes alphapoint features * Adds extra data not in the documentation :/ * Replaces websocket features by using protocol features. However, it breaks it due to import cycles. I'm not sure what I'll do just yet * Removes import cycle via duplicate structs. * Increases coverage of config with `TestCheckCurrencyConfigValues`. Moves all currency pair package types into their own files or places it at the bottom of files if necessary * Increase coverage in code.go * One way of determining a test has failed, is when to it fails. Removed redundant explanation * Increases code coverage of conversion * Lint fixes * Fixes orderbook tests * Re-adds sorting because its important to still have the internal pre-processed orderbook to be representative of a real orderbook * Secret lints that did not show up via Windows linting * Adds protocol package to contain exchange features * Fixes protocol implementation * Fixes ws tests * Addresses the following: Removes st-st-stutters in config types, changes GetAvailableForexProviders -> GetSupportedForexProviders, removes errors from tests where error is nil, removes orderbook setup when not necessary, removes import newlines, removes false bools from declaration, changes should of to should have * imports and casing * Fixes two more nil error checks
This commit is contained in:
@@ -11,7 +11,7 @@ func TestHexEncodeToString(t *testing.T) {
|
||||
expectedOutput := "737472696e67"
|
||||
actualResult := HexEncodeToString(originalInput)
|
||||
if actualResult != expectedOutput {
|
||||
t.Errorf("Test failed. Expected '%s'. Actual '%s'",
|
||||
t.Errorf("Expected '%s'. Actual '%s'",
|
||||
expectedOutput, actualResult)
|
||||
}
|
||||
}
|
||||
@@ -22,13 +22,13 @@ func TestBase64Decode(t *testing.T) {
|
||||
expectedOutput := []byte("hello")
|
||||
actualResult, err := Base64Decode(originalInput)
|
||||
if !bytes.Equal(actualResult, expectedOutput) {
|
||||
t.Errorf("Test failed. Expected '%s'. Actual '%s'. Error: %s",
|
||||
t.Errorf("Expected '%s'. Actual '%s'. Error: %s",
|
||||
expectedOutput, actualResult, err)
|
||||
}
|
||||
|
||||
_, err = Base64Decode("-")
|
||||
if err == nil {
|
||||
t.Error("Test failed. Bad base64 string failed returned nil error")
|
||||
t.Error("Bad base64 string failed returned nil error")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ func TestBase64Encode(t *testing.T) {
|
||||
expectedOutput := "aGVsbG8="
|
||||
actualResult := Base64Encode(originalInput)
|
||||
if actualResult != expectedOutput {
|
||||
t.Errorf("Test failed. Expected '%s'. Actual '%s'",
|
||||
t.Errorf("Expected '%s'. Actual '%s'",
|
||||
expectedOutput, actualResult)
|
||||
}
|
||||
}
|
||||
@@ -48,7 +48,7 @@ func TestGetRandomSalt(t *testing.T) {
|
||||
|
||||
_, err := GetRandomSalt(nil, -1)
|
||||
if err == nil {
|
||||
t.Fatal("Test failed. Expected err on negative salt length")
|
||||
t.Fatal("Expected err on negative salt length")
|
||||
}
|
||||
|
||||
salt, err := GetRandomSalt(nil, 10)
|
||||
@@ -57,7 +57,7 @@ func TestGetRandomSalt(t *testing.T) {
|
||||
}
|
||||
|
||||
if len(salt) != 10 {
|
||||
t.Fatal("Test failed. Expected salt of len=10")
|
||||
t.Fatal("Expected salt of len=10")
|
||||
}
|
||||
|
||||
salt, err = GetRandomSalt([]byte("RAWR"), 12)
|
||||
@@ -66,7 +66,7 @@ func TestGetRandomSalt(t *testing.T) {
|
||||
}
|
||||
|
||||
if len(salt) != 16 {
|
||||
t.Fatal("Test failed. Expected salt of len=16")
|
||||
t.Fatal("Expected salt of len=16")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ func TestGetMD5(t *testing.T) {
|
||||
actualOutput := GetMD5(originalString)
|
||||
actualStr := HexEncodeToString(actualOutput)
|
||||
if !bytes.Equal(expectedOutput, []byte(actualStr)) {
|
||||
t.Errorf("Test failed. Expected '%s'. Actual '%s'",
|
||||
t.Errorf("Expected '%s'. Actual '%s'",
|
||||
expectedOutput, []byte(actualStr))
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ func TestGetSHA512(t *testing.T) {
|
||||
actualOutput := GetSHA512(originalString)
|
||||
actualStr := HexEncodeToString(actualOutput)
|
||||
if !bytes.Equal(expectedOutput, []byte(actualStr)) {
|
||||
t.Errorf("Test failed. Expected '%x'. Actual '%x'",
|
||||
t.Errorf("Expected '%x'. Actual '%x'",
|
||||
expectedOutput, []byte(actualStr))
|
||||
}
|
||||
}
|
||||
@@ -106,7 +106,7 @@ func TestGetSHA256(t *testing.T) {
|
||||
actualOutput := GetSHA256(originalString)
|
||||
actualStr := HexEncodeToString(actualOutput)
|
||||
if !bytes.Equal(expectedOutput, []byte(actualStr)) {
|
||||
t.Errorf("Test failed. Expected '%x'. Actual '%x'", expectedOutput,
|
||||
t.Errorf("Expected '%x'. Actual '%x'", expectedOutput,
|
||||
[]byte(actualStr))
|
||||
}
|
||||
}
|
||||
@@ -138,31 +138,31 @@ func TestGetHMAC(t *testing.T) {
|
||||
|
||||
sha1 := GetHMAC(HashSHA1, []byte("Hello,World"), []byte("1234"))
|
||||
if string(sha1) != string(expectedSha1) {
|
||||
t.Errorf("Test failed. Common GetHMAC error: Expected '%x'. Actual '%x'",
|
||||
t.Errorf("Common GetHMAC error: Expected '%x'. Actual '%x'",
|
||||
expectedSha1, sha1,
|
||||
)
|
||||
}
|
||||
sha256 := GetHMAC(HashSHA256, []byte("Hello,World"), []byte("1234"))
|
||||
if string(sha256) != string(expectedsha256) {
|
||||
t.Errorf("Test failed. Common GetHMAC error: Expected '%x'. Actual '%x'",
|
||||
t.Errorf("Common GetHMAC error: Expected '%x'. Actual '%x'",
|
||||
expectedsha256, sha256,
|
||||
)
|
||||
}
|
||||
sha512 := GetHMAC(HashSHA512, []byte("Hello,World"), []byte("1234"))
|
||||
if string(sha512) != string(expectedsha512) {
|
||||
t.Errorf("Test failed. Common GetHMAC error: Expected '%x'. Actual '%x'",
|
||||
t.Errorf("Common GetHMAC error: Expected '%x'. Actual '%x'",
|
||||
expectedsha512, sha512,
|
||||
)
|
||||
}
|
||||
sha512384 := GetHMAC(HashSHA512_384, []byte("Hello,World"), []byte("1234"))
|
||||
if string(sha512384) != string(expectedsha512384) {
|
||||
t.Errorf("Test failed. Common GetHMAC error: Expected '%x'. Actual '%x'",
|
||||
t.Errorf("Common GetHMAC error: Expected '%x'. Actual '%x'",
|
||||
expectedsha512384, sha512384,
|
||||
)
|
||||
}
|
||||
md5 := GetHMAC(HashMD5, []byte("Hello World"), []byte("1234"))
|
||||
if string(md5) != string(expectedmd5) {
|
||||
t.Errorf("Test failed. Common GetHMAC error: Expected '%x'. Actual '%x'",
|
||||
t.Errorf("Common GetHMAC error: Expected '%x'. Actual '%x'",
|
||||
expectedmd5, md5,
|
||||
)
|
||||
}
|
||||
@@ -174,7 +174,7 @@ func TestSha1Tohex(t *testing.T) {
|
||||
expectedResult := "fcfbfcd7d31d994ef660f6972399ab5d7a890149"
|
||||
actualResult := Sha1ToHex("Testing Sha1ToHex")
|
||||
if actualResult != expectedResult {
|
||||
t.Errorf("Test failed. Expected '%s'. Actual '%s'",
|
||||
t.Errorf("Expected '%s'. Actual '%s'",
|
||||
expectedResult, actualResult)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user