Search in sources :

Example 1 with LongValueToUnsignedFloatValue

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

the class GraphKeyTypeTransformTest method testToFloatValue.

// FloatValue
@Test
public void testToFloatValue() throws Exception {
    TranslateFunction<LongValue, FloatValue> translator = new LongValueToUnsignedFloatValue();
    Assert.assertEquals(new FloatValue(Float.intBitsToFloat(0)), translator.translate(new LongValue(0L), floatValue));
    Assert.assertEquals(new FloatValue(Float.intBitsToFloat(Integer.MIN_VALUE)), translator.translate(new LongValue((long) Integer.MAX_VALUE + 1), floatValue));
    Assert.assertEquals(new FloatValue(Float.intBitsToFloat(-1)), translator.translate(new LongValue(LongValueToUnsignedFloatValue.MAX_VERTEX_COUNT - 1), floatValue));
}
Also used : LongValue(org.apache.flink.types.LongValue) FloatValue(org.apache.flink.types.FloatValue) LongValueToUnsignedFloatValue(org.apache.flink.graph.drivers.transform.GraphKeyTypeTransform.LongValueToUnsignedFloatValue) LongValueToUnsignedFloatValue(org.apache.flink.graph.drivers.transform.GraphKeyTypeTransform.LongValueToUnsignedFloatValue) Test(org.junit.Test)

Aggregations

LongValueToUnsignedFloatValue (org.apache.flink.graph.drivers.transform.GraphKeyTypeTransform.LongValueToUnsignedFloatValue)1 FloatValue (org.apache.flink.types.FloatValue)1 LongValue (org.apache.flink.types.LongValue)1 Test (org.junit.Test)1