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) } } }
func (o *OrderNode) TradeId() uint32 { return ints.Low32(o.guidNode.val) }