public void testLongsCompare(){
  BytesRef left=new BytesRef(new byte[Long.BYTES]);
  BytesRef right=new BytesRef(new byte[Long.BYTES]);
  for (int i=0; i < 10000; i++) {
    long leftValue=TestUtil.nextLong(random(),Long.MIN_VALUE,Long.MAX_VALUE);
    NumericUtils.longToSortableBytes(leftValue,left.bytes,left.offset);
    long rightValue=TestUtil.nextLong(random(),Long.MIN_VALUE,Long.MAX_VALUE);
    NumericUtils.longToSortableBytes(rightValue,right.bytes,right.offset);
    assertEquals(Integer.signum(Long.compare(leftValue,rightValue)),Integer.signum(left.compareTo(right)));
  }
}

public void testLongsCompare ( ) { BytesRef left = new BytesRef ( new byte [ Long . BYTES ] ) ; BytesRef right = new BytesRef ( new byte [ Long . BYTES ] ) ; for ( int i = 0 ; i < 10000 ; i ++ ) { long leftValue = TestUtil . nextLong ( random ( ) , Long . MIN_VALUE , Long . MAX_VALUE ) ; NumericUtils . longToSortableBytes ( leftValue , left . bytes , left . offset ) ; long rightValue = TestUtil . nextLong ( random ( ) , Long . MIN_VALUE , Long . MAX_VALUE ) ; NumericUtils . longToSortableBytes ( rightValue , right . bytes , right . offset ) ; assertEquals ( Integer . signum ( Long . compare ( leftValue , rightValue ) ) , Integer . signum ( left . compareTo ( right ) ) ) ; } }
check sort order of random longs consistent with long . compare
