mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-31 15:10:42 +00:00
Fixed linter issues and added test files
This commit is contained in:
committed by
Adrian Gallagher
parent
f302efeb68
commit
7042da1e03
37
orders_test.go
Normal file
37
orders_test.go
Normal file
@@ -0,0 +1,37 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestNewOrder(t *testing.T) {
|
||||
ID := NewOrder("ANX", 2000, 20.00)
|
||||
if ID != 0 {
|
||||
t.Error("Test Failed - Orders_test.go NewOrder() - Error")
|
||||
}
|
||||
ID = NewOrder("BATMAN", 400, 25.00)
|
||||
if ID != 1 {
|
||||
t.Error("Test Failed - Orders_test.go NewOrder() - Error")
|
||||
}
|
||||
}
|
||||
|
||||
func TestDeleteOrder(t *testing.T) {
|
||||
if value := DeleteOrder(0); !value {
|
||||
t.Error("Test Failed - Orders_test.go DeleteOrder() - Error")
|
||||
}
|
||||
if value := DeleteOrder(100); value {
|
||||
t.Error("Test Failed - Orders_test.go DeleteOrder() - Error")
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetOrdersByExchange(t *testing.T) {
|
||||
if value := GetOrdersByExchange("ANX"); len(value) != 0 {
|
||||
t.Error("Test Failed - Orders_test.go GetOrdersByExchange() - Error")
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetOrderByOrderID(t *testing.T) {
|
||||
if value := GetOrderByOrderID(69); value != nil {
|
||||
t.Error("Test Failed - Orders_test.go GetOrdersByExchange() - Error")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user