Class ExpressionTck
java.lang.Object
io.micronaut.sourcegen.bytecode.tck.AbstractByteCodeWriterTck
io.micronaut.sourcegen.bytecode.tck.ExpressionTck
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidvoidvoidvoidfloatingPointComparisonOfNaNMatchesJavac(TypeDef.Primitive type, ExpressionDef.ComparisonOperation.OpType operation) voidvoidnegationOfABoxedOperandUnboxesIt(TypeDef.Primitive primitive, Object value, Object negated) voidvoidvoidreferentialEqualityOfPrimitivesComparesThePromotedValues(String name, TypeDef.Primitive left, TypeDef.Primitive right, List<?> leftValues, List<?> rightValues) voidMethods inherited from class AbstractByteCodeWriterTck
assertCall, caller, callWithParameter, classShape, declaredFields, declaredMethods, define, defineInPackage, genericShape, invoke, list, load, outcome, run, run, run, selection, selection, shape, write
-
Constructor Details
-
ExpressionTck
public ExpressionTck()
-
-
Method Details
-
byteArithmeticIsNarrowedToTheTypeOfTheOperation
-
characterUnboxesBeforeWideningToInt
-
notEqualsReferentiallyAcceptsAPrimitiveOperand
-
newArrayOfSizeKeepsEveryDimension
-
longShiftTakesAnIntDistance
-
equalsStructurallyComparesFloatsNumerically
-
elementOfATwoDimensionalArrayIsAnArray
-
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
-
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
-