Examples of PairOfLongInt


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

public class PairOfLongIntTest {

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

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

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

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

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

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

    origPair.write(dataOut);

    PairOfLongInt pair = new PairOfLongInt();

    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.PairOfLongInt

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

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

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

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

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

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

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

    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.