Exemplo n.º 1
0
  @Test
  public void testSimple() {
    buffer.put(this.zero);
    buffer.put(StopSignal.getInstance());

    QuickSort qs = QuickSort.create(buffer);
    assertEquals(zero, qs.getSmallestElement());
    assertEquals(StopSignal.getInstance(), qs.getSmallestElement());
  }
Exemplo n.º 2
0
  @Test
  public void testLessSimple() {
    buffer.put(this.fourtyTwo);
    buffer.put(this.ten);
    buffer.put(StopSignal.getInstance());

    QuickSort qs = QuickSort.create(buffer);
    assertEquals(ten, qs.getSmallestElement());
    assertEquals(fourtyTwo, qs.getSmallestElement());
    assertEquals(StopSignal.getInstance(), qs.getSmallestElement());
  }
Exemplo n.º 3
0
  public void test() {
    buffer.put(this.big);
    buffer.put(this.ten);
    buffer.put(this.zero);
    buffer.put(this.fourtyTwo);
    buffer.put(this.oneNegative);
    buffer.put(StopSignal.getInstance());

    QuickSort qs = QuickSort.create(buffer);
    assertEquals(oneNegative, qs.getSmallestElement());
    assertEquals(zero, qs.getSmallestElement());
    assertEquals(fourtyTwo, qs.getSmallestElement());
    assertEquals(big, qs.getSmallestElement());
    assertEquals(StopSignal.getInstance(), qs.getSmallestElement());
  }
Exemplo n.º 4
0
 @Test
 public void testEmpty() {
   buffer.put(StopSignal.getInstance());
   QuickSort qs = QuickSort.create(buffer);
   assertEquals(StopSignal.getInstance(), qs.getSmallestElement());
 }