Package etch.util.core.nio

Examples of etch.util.core.nio.History


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


  /** @throws Exception */
  @Test( expected = IllegalStateException.class )
  public void used6() throws Exception
  {
    // newUsed < 0
    History h = new History( 0, 10, 5 );
    checkUsedAlloc( h, 0, 0 );
    h.used( -1 );
  }
View Full Code Here

  /** @throws Exception */
  @Test( expected = IllegalStateException.class )
  public void used7() throws Exception
  {
    // newUsed < 0
    History h = new History( 0, 10, 5 );
    checkUsedAlloc( h, 0, 0 );
    h.used( 1 );
    checkUsedAlloc( h, 1, 0 );
    h.used( -2 );
  }
View Full Code Here

 
  /** @throws Exception */
  @Test
  public void used8() throws Exception
  {
    History h = new History( 0, 10, 5 );
    checkUsedAlloc( h, 0, 0 );
    h.used( 1 );
    checkUsedAlloc( h, 1, 0 );
    try
    {
      h.used( -2 );
      fail( "never reached" );
    }
    catch ( IllegalStateException e )
    {
      // make sure used was not adjusted...
View Full Code Here

  /** @throws Exception */
  @Test( expected = IllegalArgumentException.class )
  public void used9() throws Exception
  {
    // k == 0
    History h = new History( 0, 10, 5 );
    h.used( 0 );
  }
View Full Code Here

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

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

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

  /** @throws Exception */
  @Test( expected = IllegalStateException.class )
  public void alloc4() throws Exception
  {
    // newAlloc > limit
    History h = new History( 0, 10, 5 );
    checkUsedAlloc( h, 0, 0 );
    // try to overflow
    h.alloc( 11 );
  }
View Full Code Here

  /** @throws Exception */
  @Test( expected = IllegalStateException.class )
  public void alloc5() throws Exception
  {
    // newAlloc > limit
    History h = new History( 0, 10, 5 );
    checkUsedAlloc( h, 0, 0 );
    h.alloc( 1 );
    checkUsedAlloc( h, 0, 1 );
    h.alloc( 9 );
    checkUsedAlloc( h, 0, 10 );
    // try to overflow
    h.alloc( 1 );
  }
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.