@Test
  public void testMultiplyDestructiveSignedInt128() {
    two.multiplyDestructive(one);
    assertEquals(2L, two.longValue());
    assertEquals(1L, one.longValue());
    two.multiplyDestructive(two);
    assertEquals(4L, two.longValue());

    SignedInt128 five = new SignedInt128(5);
    five.multiplyDestructive(new SignedInt128(6432346));
    assertEquals(6432346 * 5, five.getV0());
    assertEquals(0, five.getV1());
    assertEquals(0, five.getV2());
    assertEquals(0, five.getV3());

    SignedInt128 big = new SignedInt128((1L << 62) + (3L << 34) + 3L);
    big.multiplyDestructive(new SignedInt128(96));

    assertEquals(3 * 96, big.getV0());
    assertEquals(96 * (3 << 2), big.getV1());
    assertEquals(96 / 4, big.getV2());
    assertEquals(0, big.getV3());

    SignedInt128 tmp = new SignedInt128(1);
    tmp.shiftLeftDestructive(126);
    try {
      tmp.multiplyDestructive(new SignedInt128(2));
      fail();
    } catch (ArithmeticException ex) {
      // ok
    }

    SignedInt128 complicated1 = new SignedInt128(0xF9892FCA, 0x59D109AD,
        0x0534AB4C, 0);
    BigInteger bigInteger1 = complicated1.toBigIntegerSlow();
    SignedInt128 complicated2 = new SignedInt128(54234234, 9, 0, 0);
    BigInteger bigInteger2 = complicated2.toBigIntegerSlow();
    complicated1.multiplyDestructive(complicated2);
    BigInteger ans = bigInteger1.multiply(bigInteger2);
    assertEquals(ans, complicated1.toBigIntegerSlow());

    try {
      SignedInt128 complicated3 = new SignedInt128(0xF9892FCA, 0x59D109AD,
          0x0534AB4C, 0);
      complicated3.multiplyDestructive(new SignedInt128(54234234, 9845, 0, 0));
      fail();
    } catch (ArithmeticException ex) {
      // ok
    }
  }
Testcases for {@link SignedInt128}

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