예제 #1
0
func TestGuidFuns(t *testing.T) {
	r := rand.New(rand.NewSource(1))
	for i := 0; i < 1000; i++ {
		traderId := r.Uint32()
		tradeId := r.Uint32()
		guid := ints.Combine(traderId, tradeId)
		cTraderId := ints.High32(guid)
		cTradeId := ints.Low32(guid)
		if cTraderId != traderId {
			t.Errorf("Expecting traderId '%s' found '%s'", traderId, cTraderId)
		}
		if cTradeId != tradeId {
			t.Errorf("Expecting tradeId '%s' found '%s'", tradeId, cTradeId)
		}
	}
}
예제 #2
0
func (o *OrderNode) TraderId() uint32 {
	return ints.High32(o.guidNode.val)
}