Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(BTC Markets): Wrapper SubmitOrder parameter order fix & IsOrderPlace…
…d condition correction (#394) * corrected param order Side -> Type, also corrected condition check for IsOrderPlaced * send open status for GetActiveOrders * GetActiveOrder() changes to include OrderID and status matching * BTC Markets batch order limit fixes & SplitStringSliceByLimit method BTC markets batch end points have limits (20 for cancel 50 for query) adds new method SplitStringSliceByLimit in common to split a slice by limit and return slice of slice * rm line :D * Added test for SplitStringSliceByLimit and moved to const * ntp client reworked to not return error if no valid time servers are found but default to system * clean up * new line added * use TimeMgr sublogger and wording correction on output * Moved to DialTimeout() & Removed SetDeadline call * removed line * added setdeadline fix * goimport file * removed unused error from NTPClient as we now default to system time if no server can be reached * Added checks for number overflows * converted to uint as you should not be passing a negative number in * Increased test cases for NTPClient * Removed Helper call as no longer outputting any data from function * removed unused param
- Loading branch information
Showing
9 changed files
with
145 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,26 @@ | ||
package ntpclient | ||
|
||
import ( | ||
"reflect" | ||
"testing" | ||
"time" | ||
) | ||
|
||
func TestNTPClient(t *testing.T) { | ||
pool := []string{"pool.ntp.org:123", "0.pool.ntp.org:123"} | ||
_, err := NTPClient(pool) | ||
if err != nil { | ||
t.Fatalf("failed to get time %v", err) | ||
v := NTPClient(pool) | ||
|
||
if reflect.TypeOf(v) != reflect.TypeOf(time.Time{}) { | ||
t.Errorf("NTPClient should return time.Time{}") | ||
} | ||
|
||
invalidpool := []string{"pool.thisisinvalid.org"} | ||
_, err = NTPClient(invalidpool) | ||
if err == nil { | ||
t.Errorf("Expected error") | ||
if v.IsZero() { | ||
t.Error("NTPClient should return valid time received zero value") | ||
} | ||
|
||
firstInvalid := []string{"pool.thisisinvalid.org", "pool.ntp.org:123", "0.pool.ntp.org:123"} | ||
_, err = NTPClient(firstInvalid) | ||
if err != nil { | ||
t.Errorf("failed to get time %v", err) | ||
const timeFormat = "2006-01-02T15:04:05" | ||
|
||
if v.UTC().Format(timeFormat) != time.Now().UTC().Format(timeFormat) { | ||
t.Errorf("NTPClient returned incorrect time received: %v", v.UTC().Format(timeFormat)) | ||
} | ||
} |