Examples of PairOfLongs


Examples of edu.umd.cloud9.io.pair.PairOfLongs

public class PairOfLongsTest {

  @Test
  public void testBasic() throws IOException {
    PairOfLongs pair = new PairOfLongs(1L, 2L);

    assertEquals(1L, pair.getLeftElement());
    assertEquals(2L, pair.getRightElement());
  }
View Full Code Here

Examples of edu.umd.cloud9.io.pair.PairOfLongs

    assertEquals(2L, pair.getRightElement());
  }

  @Test
  public void testSerialize() throws IOException {
    PairOfLongs origPair = new PairOfLongs(1L, 2L);

    ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
    DataOutputStream dataOut = new DataOutputStream(bytesOut);

    origPair.write(dataOut);

    PairOfLongs pair = new PairOfLongs();

    pair.readFields(new DataInputStream(new ByteArrayInputStream(bytesOut.toByteArray())));

    assertEquals(1L, pair.getLeftElement());
    assertEquals(2L, pair.getRightElement());
  }
View Full Code Here

Examples of edu.umd.cloud9.io.pair.PairOfLongs

    assertEquals(2L, pair.getRightElement());
  }

  @Test
  public void testComparison1() throws IOException {
    PairOfLongs pair1 = new PairOfLongs(1L, 2L);
    PairOfLongs pair2 = new PairOfLongs(1L, 2L);
    PairOfLongs pair3 = new PairOfLongs(1L, 1L);
    PairOfLongs pair4 = new PairOfLongs(0L, 9L);
    PairOfLongs pair5 = new PairOfLongs(9L, 0L);

    assertTrue(pair1.equals(pair2));
    assertFalse(pair1.equals(pair3));

    assertTrue(pair1.compareTo(pair2) == 0);
View Full Code Here

Examples of edu.umd.cloud9.io.pair.PairOfLongs

  @Test
  public void testComparison2() throws IOException {
    WritableComparator comparator = new PairOfLongs.Comparator();

    PairOfLongs pair1 = new PairOfLongs(1L, 2L);
    PairOfLongs pair2 = new PairOfLongs(1L, 2L);
    PairOfLongs pair3 = new PairOfLongs(1L, 1L);
    PairOfLongs pair4 = new PairOfLongs(0L, 9L);
    PairOfLongs pair5 = new PairOfLongs(9L, 0L);

    assertTrue(WritableComparatorTestHarness.compare(comparator, pair1, pair2) == 0);
    assertTrue(WritableComparatorTestHarness.compare(comparator, pair1, pair3) > 0);
    assertTrue(WritableComparatorTestHarness.compare(comparator, pair1, pair4) > 0);
    assertTrue(WritableComparatorTestHarness.compare(comparator, pair1, pair5) < 0);
View Full Code Here
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.