### Question:
OpBehaviorIntCarry extends BinaryOpBehavior { @Override public long evaluateBinary(int sizeout, int sizein, long in1, long in2) { if (sizein == 8) { if (in1 < 0) { return ((in2 < 0) || (-in2 <= in1)) ? 1 : 0; } if (in2 < 0) { return (-in1 <= in2) ? 1 : 0; } } return (in1 > ((in1 + in2) & Utils.calc_mask(sizein))) ? 1 : 0; } OpBehaviorIntCarry(); @Override long evaluateBinary(int sizeout, int sizein, long in1, long in2); @Override BigInteger evaluateBinary(int sizeout, int sizein, BigInteger in1, BigInteger in2);  }### Answer:
@Test public void testEvaluateBinaryLong() { OpBehaviorIntCarry op = new OpBehaviorIntCarry(); Assert.assertEquals(0, op.evaluateBinary(4, 4, 0, 0)); Assert.assertEquals(1, op.evaluateBinary(4, 4, 1, 0xffffffffL)); Assert.assertEquals(1, op.evaluateBinary(4, 4, 0xffffffffL, 1)); Assert.assertEquals(0, op.evaluateBinary(4, 4, 0x7fffffffL, 0x80000000L)); Assert.assertEquals(1, op.evaluateBinary(4, 4, 0x7fffffffL, 0x80000001L)); Assert.assertEquals(0, op.evaluateBinary(4, 4, 0x80000000L, 0x7fffffffL)); Assert.assertEquals(1, op.evaluateBinary(4, 4, 0x80000001L, 0x7fffffffL)); Assert.assertEquals(0, op.evaluateBinary(8, 8, 0, 0)); Assert.assertEquals(0, op.evaluateBinary(8, 8, Long.MAX_VALUE, Long.MIN_VALUE)); Assert.assertEquals(1, op.evaluateBinary(8, 8, Long.MAX_VALUE, Long.MIN_VALUE + 1)); Assert.assertEquals(0, op.evaluateBinary(8, 8, Long.MIN_VALUE, Long.MAX_VALUE)); Assert.assertEquals(1, op.evaluateBinary(8, 8, Long.MIN_VALUE + 1, Long.MAX_VALUE)); }
@Test public void testEvaluateBinaryBigInteger() { OpBehaviorIntCarry op = new OpBehaviorIntCarry(); BigInteger NEGATIVE_ONE = new BigInteger("FFFFFFFFFFFFFFFF", 16); BigInteger BIG_POSITIVE = new BigInteger("7FFFFFFFFFFFFFFF", 16); BigInteger BIG_NEGATIVE = new BigInteger("8000000000000000", 16); Assert.assertEquals(BigInteger.ZERO, op.evaluateBinary(8, 8, BigInteger.ZERO, BigInteger.ZERO)); Assert.assertEquals(BigInteger.ONE, op.evaluateBinary(8, 8, BigInteger.ONE, NEGATIVE_ONE)); Assert.assertEquals(BigInteger.ONE, op.evaluateBinary(8, 8, NEGATIVE_ONE, BigInteger.ONE)); Assert.assertEquals(BigInteger.ZERO, op.evaluateBinary(8, 8, BIG_POSITIVE, BIG_NEGATIVE)); Assert.assertEquals(BigInteger.ONE, op.evaluateBinary(8, 8, BIG_POSITIVE, BIG_NEGATIVE.add(BigInteger.ONE))); Assert.assertEquals(BigInteger.ZERO, op.evaluateBinary(8, 8, BIG_NEGATIVE, BIG_POSITIVE)); Assert.assertEquals(BigInteger.ONE, op.evaluateBinary(8, 8, BIG_NEGATIVE.add(BigInteger.ONE), BIG_POSITIVE)); }