}
private void runMerge(Allocator allocator)
{
// note: local counts aggregated; remote counts are reconciled (i.e. take max)
ContextState left = ContextState.allocate(4, 1, allocator);
left.writeElement(CounterId.fromInt(1), 1L, 1L);
left.writeElement(CounterId.fromInt(2), 2L, 2L);
left.writeElement(CounterId.fromInt(4), 6L, 3L);
left.writeElement(CounterId.getLocalId(), 7L, 3L, true);
ContextState right = ContextState.allocate(3, 1, allocator);
right.writeElement(CounterId.fromInt(4), 4L, 4L);
right.writeElement(CounterId.fromInt(5), 5L, 5L);
right.writeElement(CounterId.getLocalId(), 2L, 9L, true);
ByteBuffer merged = cc.merge(left.context, right.context, allocator);
int hd = 4;
assertEquals(hd + 5 * stepLength, merged.remaining());