package markinfo import "testing" func TestSymbolType(t *testing.T) { r, _ := SymbolType("EURUSD") if r != DIRECT_RATES { t.Errorf("SymbolType failed. Got %d, expected %d.", r, DIRECT_RATES) } r, _ = SymbolType("USDJPY") if r != INDIRECT_RATES { t.Errorf("SymbolType failed. Got %d, expected %d.", r, INDIRECT_RATES) } r, _ = SymbolType("EURJPY") if r != CROSS_RATES { t.Errorf("SymbolType failed. Got %d, expected %d.", r, CROSS_RATES) } _, err := SymbolType("EURJPY1") if err == nil { t.Errorf("SymbolType failed. unknow symbol ,but return no error.") } } func TestID(t *testing.T) { r, _ := SymbolID("EURUSD") if r != 2 { t.Errorf("SymbolUnit failed. Got %d, expected %d.", r, 2) } } func TestName(t *testing.T) { r, _ := SymbolName(2) if r != "EURUSD" { t.Errorf("SymbolUnit failed. Got %s, expected %s.", r, "EURUSD") } } func TestGetMap(t *testing.T) { r := SymbolMap() if r["EURUSD"] != 2 { t.Errorf("SymbolMap failed. ") } }