-
Notifications
You must be signed in to change notification settings - Fork 2
/
symbol_test.go
53 lines (45 loc) · 1 KB
/
symbol_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package goexchange
import (
"fmt"
"testing"
)
func TestSymbol_String(t *testing.T) {
btc_usdt := NewSymbol("btc", "usdt")
t.Log(btc_usdt.String() == "BTC_USDT")
t.Log(btc_usdt.String())
t.Log(btc_usdt.ToSymbol("-"))
t.Log(btc_usdt.ToSymbol(""))
t.Log(btc_usdt.ToLower().ToSymbol("-"))
t.Log(btc_usdt.ToUpper().ToSymbol("-"))
// t.Log(btc_usdt.ToLower().ToSymbol("") == "btcusd")
// t.Log(btc_usdt.ToLower().String() == "btc_usd")
// t.Log(btc_usdt.Reverse().String() == "USD_BTC")
// t.Log(btc_usdt.Eq(BTC_USD))
t.Log(TradeSide(1))
t.Log(TradeSide(-1))
t.Log(TradeSide(2))
t.Log(BUY)
t.Log(BUY.String())
t.Log(SELL)
var a1 map[string]string
a2 := map[string]string{}
if a1 == nil {
fmt.Println("a1 is nil")
}
if a2 == nil || len(a2) == 0 {
fmt.Println("a2 is nil")
}
md1(a1)
md2(a2)
fmt.Println(a1)
fmt.Println(a2)
}
func md1(val map[string]string) {
val = make(map[string]string)
val["1"] = "1"
val["2"] = "2"
}
func md2(val map[string]string) {
val["1"] = "1"
val["2"] = "2"
}