Class ExpressionTck

java.lang.Object
io.micronaut.sourcegen.bytecode.tck.AbstractByteCodeWriterTck
io.micronaut.sourcegen.bytecode.tck.ExpressionTck

public abstract class ExpressionTck extends AbstractByteCodeWriterTck
Operators and array expressions: numeric promotion of arithmetic and shifts, structural and referential equality, and array creation and access, compared with what javac writes for the same source.

A backend runs these tests by extending this class and implementing AbstractByteCodeWriterTck.write(io.micronaut.sourcegen.model.ObjectDef).

Since:
2.3
  • Constructor Details

    • ExpressionTck

      public ExpressionTck()
  • Method Details

    • byteArithmeticIsNarrowedToTheTypeOfTheOperation

      @Test public void byteArithmeticIsNarrowedToTheTypeOfTheOperation() throws Exception
      Throws:
      Exception
    • characterUnboxesBeforeWideningToInt

      @Test public void characterUnboxesBeforeWideningToInt() throws Exception
      Throws:
      Exception
    • notEqualsReferentiallyAcceptsAPrimitiveOperand

      @Test public void notEqualsReferentiallyAcceptsAPrimitiveOperand() throws Exception
      Throws:
      Exception
    • newArrayOfSizeKeepsEveryDimension

      @Test public void newArrayOfSizeKeepsEveryDimension() throws Exception
      Throws:
      Exception
    • longShiftTakesAnIntDistance

      @Test public void longShiftTakesAnIntDistance() throws Exception
      Throws:
      Exception
    • equalsStructurallyComparesFloatsNumerically

      @Test public void equalsStructurallyComparesFloatsNumerically() throws Exception
      Throws:
      Exception
    • elementOfATwoDimensionalArrayIsAnArray

      @Test public void elementOfATwoDimensionalArrayIsAnArray() throws Exception
      Throws:
      Exception
    • floatingPointComparisonOfNaNMatchesJavac

      @ParameterizedTest(name="{0} {1} with NaN operands matches javac, as a value and as a branch") @MethodSource("floatingPointComparisons") public void floatingPointComparisonOfNaNMatchesJavac(TypeDef.Primitive type, ExpressionDef.ComparisonOperation.OpType operation) throws Exception
      Throws:
      Exception
    • referentialEqualityOfPrimitivesComparesThePromotedValues

      @ParameterizedTest(name="{0} == and != of primitives compare their values as javac promotes them") @MethodSource("primitiveEqualities") public void referentialEqualityOfPrimitivesComparesThePromotedValues(String name, TypeDef.Primitive left, TypeDef.Primitive right, List<?> leftValues, List<?> rightValues) throws Exception
      Throws:
      Exception
    • structuralEqualityOfAnObjectAndACharCastsTheObjectToCharacter

      @Test public void structuralEqualityOfAnObjectAndACharCastsTheObjectToCharacter() throws Exception
      Throws:
      Exception
    • negationOfABoxedOperandUnboxesIt

      @ParameterizedTest(name="-{0} unboxes, negates and boxes the {1}") @MethodSource("boxedNegations") public void negationOfABoxedOperandUnboxesIt(TypeDef.Primitive primitive, Object value, Object negated) throws Exception
      Throws:
      Exception