Package

Source Code of VLongWritableTest

import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;

import java.io.IOException;
import org.apache.hadoop.io.VLongWritable;
import org.junit.Test;

public class VLongWritableTest extends WritableTestBase {
 
  @Test
  public void test() throws IOException {
    assertThat(serializeToString(new VLongWritable(1)), is("01")); // 1 byte
    assertThat(serializeToString(new VLongWritable(127)), is("7f")); // 1 byte
    assertThat(serializeToString(new VLongWritable(128)), is("8f80")); // 2 byte
    assertThat(serializeToString(new VLongWritable(163)), is("8fa3")); // 2 byte
    assertThat(serializeToString(new VLongWritable(Long.MAX_VALUE)), is("887fffffffffffffff")); // 9 byte
    assertThat(serializeToString(new VLongWritable(Long.MIN_VALUE)), is("807fffffffffffffff")); // 9 byte
  }
}
TOP

Related Classes of VLongWritableTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.