Package etch.util.core.nio

Examples of etch.util.core.nio.History


 
  /** @throws Exception */
  @Test
  public void suggested5() throws Exception
  {
    History h = new History( 0, 10, 0 );
    assertEquals( 0, h.suggested() );
    assertTrue( h.used( 5 ) );
    assertEquals( 0, h.suggested() );
    h.tickle();
    assertEquals( 0, h.suggested() );
  }
View Full Code Here


{
  /** @throws Exception */
  @Test
  public void construct1() throws Exception
  {
    History h = new History( 1, 2, 3 );
    assertEquals( 1, h.min() );
    assertEquals( 2, h.limit() );
    assertEquals( 3, h.length() );
  }
View Full Code Here

  /** @throws Exception */
  @Test
  public void construct2() throws Exception
  {
    History h = new History( 102, 119, 7 );
    assertEquals( 102, h.min() );
    assertEquals( 119, h.limit() );
    assertEquals( 7, h.length() );
  }
View Full Code Here

  /** @throws Exception */
  @Test( expected = IllegalArgumentException.class )
  public void construct3() throws Exception
  {
    // min < 0
    new History( -1, 2, 3 );
  }
View Full Code Here

  /** @throws Exception */
  @Test( expected = IllegalArgumentException.class )
  public void construct4() throws Exception
  {
    // limit < min
    new History( 0, -1, 3 );
  }
View Full Code Here

  /** @throws Exception */
  @Test( expected = IllegalArgumentException.class )
  public void construct5() throws Exception
  {
    // len < 0
    new History( 0, 0, -1 );
  }
View Full Code Here

 
  /** @throws Exception */
  @Test
  public void used1() throws Exception
  {
    History h = new History( 0, 10, 5 );
    checkUsedAlloc( h, 0, 0 );
    assertTrue( h.used( 1 ) );
    checkUsedAlloc( h, 1, 0 );
    assertTrue( h.used( -1 ) );
    checkUsedAlloc( h, 0, 0 );
  }
View Full Code Here

 
  /** @throws Exception */
  @Test
  public void used2() throws Exception
  {
    History h = new History( 0, 10, 5 );
    checkUsedAlloc( h, 0, 0 );
    assertTrue( h.used( 2 ) );
    checkUsedAlloc( h, 2, 0 );
    assertTrue( h.used( -2 ) );
    checkUsedAlloc( h, 0, 0 );
  }
View Full Code Here

 
  /** @throws Exception */
  @Test
  public void used3() throws Exception
  {
    History h = new History( 0, 10, 5 );
    checkUsedAlloc( h, 0, 0 );
    assertTrue( h.used( 1 ) );
    checkUsedAlloc( h, 1, 0 );
    assertTrue( h.used( 1 ) );
    checkUsedAlloc( h, 2, 0 );
    assertTrue( h.used( -1 ) );
    checkUsedAlloc( h, 1, 0 );
    assertTrue( h.used( -1 ) );
    checkUsedAlloc( h, 0, 0 );
  }
View Full Code Here

 
  /** @throws Exception */
  @Test
  public void used4() throws Exception
  {
    History h = new History( 0, 10, 5 );
    checkUsedAlloc( h, 0, 0 );
    // try to overflow
    assertFalse( h.used( 11 ) );
    checkUsedAlloc( h, 0, 0 );
  }
View Full Code Here

TOP

Related Classes of etch.util.core.nio.History

Copyright © 2018 www.massapicom. 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.