| m := ReadEventMsg(msg) | m := ReadEventMsg(msg) | ||||
| AssertEqual(t, m.Event, "CLICK", "Expect Click event") | AssertEqual(t, m.Event, "CLICK", "Expect Click event") | ||||
| AssertEqual(t, m.EventKey, "MEMBER_SEARCH", "Expect MEMBER_SEARCH") | AssertEqual(t, m.EventKey, "MEMBER_SEARCH", "Expect MEMBER_SEARCH") | ||||
| AssertEqual(t, m.Ticket, "", "Expect Empty Ticket") | |||||
| AssertEqual(t, m.Latitude, 0.0, "Expect 0") | |||||
| AssertEqual(t, m.Longitude, 0.0, "Expect 0") | |||||
| AssertEqual(t, m.Precision, 0.0, "Expect 0") | |||||
| } | } | ||||
| func TestAcceptLocationInfo(t *testing.T) { | func TestAcceptLocationInfo(t *testing.T) { | ||||
| AssertEqual(t, m.Longitude, 150.960327, "Expect 150.960327") | AssertEqual(t, m.Longitude, 150.960327, "Expect 150.960327") | ||||
| AssertEqual(t, m.Latitude, -33.764935, "Expect -33.764935") | AssertEqual(t, m.Latitude, -33.764935, "Expect -33.764935") | ||||
| AssertEqual(t, m.Precision, 110.000000, "Expect 110.000000") | AssertEqual(t, m.Precision, 110.000000, "Expect 110.000000") | ||||
| AssertEqual(t, m.EventKey, "", "Expect Empty EventKey") | |||||
| AssertEqual(t, m.Ticket, "", "Expect Empty Ticket") | |||||
| } | } | ||||
| func TestReadEventFollow(t *testing.T) { | func TestReadEventFollow(t *testing.T) { | ||||
| </xml>` | </xml>` | ||||
| m := ReadEventMsg(msg) | m := ReadEventMsg(msg) | ||||
| AssertEqual(t, m.Event, "subscribe", "Expect subscribe") | AssertEqual(t, m.Event, "subscribe", "Expect subscribe") | ||||
| AssertEqual(t, m.EventKey, "", "Expect Empty EventKey") | |||||
| AssertEqual(t, m.Ticket, "", "Expect Empty Ticket") | |||||
| AssertEqual(t, m.Latitude, 0.0, "Expect 0") | |||||
| AssertEqual(t, m.Longitude, 0.0, "Expect 0") | |||||
| AssertEqual(t, m.Precision, 0.0, "Expect 0") | |||||
| } | } | ||||
| AssertEqual(t, m.Event, "subscribe", "Expect subscribe") | AssertEqual(t, m.Event, "subscribe", "Expect subscribe") | ||||
| AssertEqual(t, m.EventKey, "qrscene_123123", "Expect qrscene_123123") | AssertEqual(t, m.EventKey, "qrscene_123123", "Expect qrscene_123123") | ||||
| AssertEqual(t, m.Ticket, "TICKET", "Expect TICKET") | AssertEqual(t, m.Ticket, "TICKET", "Expect TICKET") | ||||
| AssertEqual(t, m.Latitude, 0.0, "Expect 0") | |||||
| AssertEqual(t, m.Longitude, 0.0, "Expect 0") | |||||
| AssertEqual(t, m.Precision, 0.0, "Expect 0") | |||||
| } | } | ||||
| AssertEqual(t, m.Event, "SCAN", "Expect SCAN") | AssertEqual(t, m.Event, "SCAN", "Expect SCAN") | ||||
| AssertEqual(t, m.EventKey, "SCENE_VALUE", "Expect SCENE_VALUE") | AssertEqual(t, m.EventKey, "SCENE_VALUE", "Expect SCENE_VALUE") | ||||
| AssertEqual(t, m.Ticket, "TICKET", "Expect TICKET") | AssertEqual(t, m.Ticket, "TICKET", "Expect TICKET") | ||||
| AssertEqual(t, m.Latitude, 0.0, "Expect 0") | |||||
| AssertEqual(t, m.Longitude, 0.0, "Expect 0") | |||||
| AssertEqual(t, m.Precision, 0.0, "Expect 0") | |||||
| } | } | ||||
| m := ReadEventMsg(msg) | m := ReadEventMsg(msg) | ||||
| AssertEqual(t, m.Event, "VIEW", "Expect VIEW") | AssertEqual(t, m.Event, "VIEW", "Expect VIEW") | ||||
| AssertEqual(t, m.EventKey, "www.qq.com", "Expectwww.qq.com") | AssertEqual(t, m.EventKey, "www.qq.com", "Expectwww.qq.com") | ||||
| AssertEqual(t, m.Ticket, "", "Expect empty ") | |||||
| AssertEqual(t, m.Ticket, "", "Expect Empty Ticket") | |||||
| AssertEqual(t, m.Latitude, 0.0, "Expect 0") | |||||
| AssertEqual(t, m.Longitude, 0.0, "Expect 0") | |||||
| AssertEqual(t, m.Precision, 0.0, "Expect 0") | |||||
| } | } |