use of org.apache.flink.graph.drivers.transform.GraphKeyTypeTransform.UnsignedFloatValueToLongValueWithProperHashCode in project flink by apache.
the class GraphKeyTypeTransformTest method testFromFloatValue.
@Test
public void testFromFloatValue() throws Exception {
TranslateFunction<FloatValue, LongValueWithProperHashCode> translator = new UnsignedFloatValueToLongValueWithProperHashCode();
Assert.assertEquals(new LongValueWithProperHashCode(0L), translator.translate(new FloatValue(Float.intBitsToFloat(0)), longValueWithProperHashCode));
Assert.assertEquals(new LongValueWithProperHashCode((long) Integer.MAX_VALUE + 1), translator.translate(new FloatValue(Float.intBitsToFloat(Integer.MIN_VALUE)), longValueWithProperHashCode));
Assert.assertEquals(new LongValueWithProperHashCode(LongValueToUnsignedFloatValue.MAX_VERTEX_COUNT - 1), translator.translate(new FloatValue(Float.intBitsToFloat(-1)), longValueWithProperHashCode));
}
Aggregations