Search in sources :

Example 1 with LongValueToUnsignedShortValue

use of org.apache.flink.graph.drivers.transform.GraphKeyTypeTransform.LongValueToUnsignedShortValue in project flink by apache.

the class GraphKeyTypeTransformTest method testToShortValue.

// ShortValue
@Test
public void testToShortValue() throws Exception {
    TranslateFunction<LongValue, ShortValue> translator = new LongValueToUnsignedShortValue();
    Assert.assertEquals(new ShortValue((short) 0), translator.translate(new LongValue(0L), shortValue));
    Assert.assertEquals(new ShortValue(Short.MIN_VALUE), translator.translate(new LongValue((long) Short.MAX_VALUE + 1), shortValue));
    Assert.assertEquals(new ShortValue((short) -1), translator.translate(new LongValue(LongValueToUnsignedShortValue.MAX_VERTEX_COUNT - 1), shortValue));
}
Also used : LongValueToUnsignedShortValue(org.apache.flink.graph.drivers.transform.GraphKeyTypeTransform.LongValueToUnsignedShortValue) LongValueToUnsignedShortValue(org.apache.flink.graph.drivers.transform.GraphKeyTypeTransform.LongValueToUnsignedShortValue) ShortValue(org.apache.flink.types.ShortValue) LongValue(org.apache.flink.types.LongValue) Test(org.junit.Test)

Aggregations

LongValueToUnsignedShortValue (org.apache.flink.graph.drivers.transform.GraphKeyTypeTransform.LongValueToUnsignedShortValue)1 LongValue (org.apache.flink.types.LongValue)1 ShortValue (org.apache.flink.types.ShortValue)1 Test (org.junit.Test)1