@Test
  public void testCompareToScaleTen() {
    assertTrue(zero.compareToScaleTen(new UnsignedInt128(0), (short) 3) == 0);
    assertTrue(zero.compareToScaleTen(new UnsignedInt128(0), (short) -1) == 0);
    assertTrue(zero.compareToScaleTen(new UnsignedInt128(0), (short) 12) == 0);
    assertTrue(one.compareToScaleTen(zero, (short) 0) > 0);
    assertTrue(one.compareToScaleTen(zero, (short) 3) > 0);
    assertTrue(one.compareToScaleTen(zero, (short) -3) > 0);

    assertTrue(zero.compareToScaleTen(one, (short) 3) < 0);
    assertTrue(zero.compareToScaleTen(one, (short) 0) < 0);
    assertTrue(zero.compareToScaleTen(one, (short) -1) == 0);

    assertTrue(new UnsignedInt128(30).compareToScaleTen(new UnsignedInt128(3),
        (short) 1) == 0);
    assertTrue(new UnsignedInt128(30).compareToScaleTen(new UnsignedInt128(3),
        (short) 2) < 0);
    assertTrue(new UnsignedInt128(30).compareToScaleTen(new UnsignedInt128(3),
        (short) 0) > 0);

    assertTrue(new UnsignedInt128(680000000000L).compareToScaleTen(
        new UnsignedInt128(68), (short) 10) == 0);
    assertTrue(new UnsignedInt128(68).compareToScaleTen(new UnsignedInt128(
        680000000000L), (short) -10) == 0);
    assertTrue(new UnsignedInt128(680000000000L).compareToScaleTen(
        new UnsignedInt128(0), (short) 60) > 0);
    assertTrue(new UnsignedInt128(680000000000L).compareToScaleTen(
        new UnsignedInt128(0), (short) 30) > 0);
    assertTrue(new UnsignedInt128(680000000000L).compareToScaleTen(
        new UnsignedInt128(0), (short) 10) > 0);
    assertTrue(new UnsignedInt128(0).compareToScaleTen(new UnsignedInt128(
        680000000000L), (short) -10) < 0);
    assertTrue(new UnsignedInt128(0).compareToScaleTen(new UnsignedInt128(
        680000000000L), (short) -11) < 0);
    assertTrue(new UnsignedInt128(0).compareToScaleTen(new UnsignedInt128(
        680000000000L), (short) -12) < 0);
    assertTrue(new UnsignedInt128(0).compareToScaleTen(new UnsignedInt128(
        680000000000L), (short) -13) == 0);
    assertTrue(new UnsignedInt128(0).compareToScaleTen(new UnsignedInt128(
        680000000000L), (short) -30) == 0);

    assertTrue(new UnsignedInt128(680000000000L).compareToScaleTen(
        new UnsignedInt128(680000000001L), (short) 0) < 1);
    assertTrue(new UnsignedInt128(68000000000L).compareToScaleTen(
        new UnsignedInt128(680000000001L), (short) -1) == 0);
    assertTrue(new UnsignedInt128(68000000000L).compareToScaleTen(
        new UnsignedInt128(680000000000L), (short) -1) == 0);
    assertTrue(new UnsignedInt128(68000000000L).compareToScaleTen(
        new UnsignedInt128(679999999999L), (short) -1) == 0);

    assertTrue(new UnsignedInt128(0x10000000000000L).shiftLeftConstructive(32)
        .compareToScaleTen(
            new UnsignedInt128(0xA0000000000000L).shiftLeftConstructive(32),
            (short) -1) == 0);
    assertTrue(new UnsignedInt128(0x10000000000000L).shiftLeftConstructive(32)
        .compareToScaleTen(
            new UnsignedInt128(0xA0000000000000L).shiftLeftConstructive(32),
            (short) 1) < 0);
    assertTrue(new UnsignedInt128(0x10000000000000L).shiftLeftConstructive(32)
        .compareToScaleTen(
            new UnsignedInt128(0xA0000000000000L).shiftLeftConstructive(32),
            (short) 0) < 0);
    assertTrue(new UnsignedInt128(0x10000000000000L).shiftLeftConstructive(32)
        .compareToScaleTen(
            new UnsignedInt128(0xA0000000000000L).shiftLeftConstructive(32),
            (short) -2) > 0);
  }
Testcases for {@link UnsignedInt128}

This code was based on code from Microsoft's PolyBase.
common/src/test/org/apache/hadoop/hive/common/type/TestUnsignedInt128.java