@Test
  public void testSubtractDestructive() {
    two.subtractDestructive(one);
    assertEquals(1L, one.asLong());
    assertEquals(1L, one.asLong());

    try {
      one.subtractDestructive(new UnsignedInt128(10L));
      fail();
    } catch (ArithmeticException ex) {
      // ok
    }

    UnsignedInt128 big = new UnsignedInt128((1L << 62) + (3L << 34) + 3L);
    big.shiftLeftDestructive(6);
    UnsignedInt128 tmp = new UnsignedInt128((1L << 61) + 5L);
    tmp.shiftLeftDestructive(6);

    big.subtractDestructive(tmp);
    big.subtractDestructive(tmp);

    assertEquals((3 << 6) - 2 * (5 << 6), big.getV0());
    assertEquals((3 << 8) - 1, big.getV1());
    assertEquals(0, big.getV2());
    assertEquals(0, big.getV3());
  }
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