Examples of keyCount()


Examples of org.luaj.vm2.LuaTable.keyCount()

  public void testRemove2() {
    LuaTable t = new_Table(0, 1);
   
    t.set( "test", LuaString.valueOf("foo") );
    t.set( "string", LuaInteger.valueOf( 10 ) );
    assertEquals( 2, t.keyCount() );
   
    t.set( "string", LuaValue.NIL );
    t.set( "three", LuaDouble.valueOf( 3.14 ) );
    assertEquals( 2, t.keyCount() );
   
View Full Code Here

Examples of org.luaj.vm2.LuaTable.keyCount()

    t.set( "string", LuaInteger.valueOf( 10 ) );
    assertEquals( 2, t.keyCount() );
   
    t.set( "string", LuaValue.NIL );
    t.set( "three", LuaDouble.valueOf( 3.14 ) );
    assertEquals( 2, t.keyCount() );
   
    t.set( "test", LuaValue.NIL );
    assertEquals( 1, t.keyCount() );
   
    t.set( 10, LuaInteger.valueOf( 5 ) );
View Full Code Here

Examples of org.luaj.vm2.LuaTable.keyCount()

    t.set( "string", LuaValue.NIL );
    t.set( "three", LuaDouble.valueOf( 3.14 ) );
    assertEquals( 2, t.keyCount() );
   
    t.set( "test", LuaValue.NIL );
    assertEquals( 1, t.keyCount() );
   
    t.set( 10, LuaInteger.valueOf( 5 ) );
    assertEquals( 2, t.keyCount() );
   
    t.set( 10, LuaValue.NIL );
View Full Code Here

Examples of org.luaj.vm2.LuaTable.keyCount()

   
    t.set( "test", LuaValue.NIL );
    assertEquals( 1, t.keyCount() );
   
    t.set( 10, LuaInteger.valueOf( 5 ) );
    assertEquals( 2, t.keyCount() );
   
    t.set( 10, LuaValue.NIL );
    assertEquals( 1, t.keyCount() );
   
    t.set( "three", LuaValue.NIL );
View Full Code Here

Examples of org.luaj.vm2.LuaTable.keyCount()

   
    t.set( 10, LuaInteger.valueOf( 5 ) );
    assertEquals( 2, t.keyCount() );
   
    t.set( 10, LuaValue.NIL );
    assertEquals( 1, t.keyCount() );
   
    t.set( "three", LuaValue.NIL );
    assertEquals( 0, t.keyCount() );
  }
View Full Code Here

Examples of org.luaj.vm2.LuaTable.keyCount()

   
    t.set( 10, LuaValue.NIL );
    assertEquals( 1, t.keyCount() );
   
    t.set( "three", LuaValue.NIL );
    assertEquals( 0, t.keyCount() );
  }

  public void testInOrderlen() {
    LuaTable t = new_Table();
   
View Full Code Here

Examples of org.luaj.vm2.LuaTable.keyCount()

  public void testSetRemove() {
    LuaTable t = new_Table();
   
    assertEquals( 0, t.getHashLength() );
    assertEquals( 0, t.length() );
    assertEquals( 0, t.keyCount() );
   
    String[] keys = { "abc", "def", "ghi", "jkl", "mno", "pqr", "stu", "wxy", "z01",
        "cd", "ef", "g", "hi", "jk", "lm", "no", "pq", "rs", };   
    int[] capacities = { 0, 2, 4, 4, 7, 7, 7, 10, 10, 14, 14, 14, 14, 19, 19, 19, 19, 25, 25, 25 };
    for ( int i = 0; i < keys.length; ++i ) {
View Full Code Here

Examples of org.luaj.vm2.LuaTable.keyCount()

    for ( int i = 0; i < keys.length; ++i ) {
      assertEquals( capacities[i], t.getHashLength() );
      String si = "Test Value! "+i;
      t.set( keys[i], si );
      assertEquals( 0, t.length() );
      assertEquals( i+1, t.keyCount() );
    }
    assertEquals( capacities[keys.length], t.getHashLength() );
    for ( int i = 0; i < keys.length; ++i ) {
      LuaValue vi = LuaString.valueOf( "Test Value! "+i );
      assertEquals( vi, t.get( keys[i] ) );
View Full Code Here

Examples of org.luaj.vm2.LuaTable.keyCount()

    // replace with new values
    for ( int i = 0; i < keys.length; ++i ) {
      t.set( keys[i], LuaString.valueOf( "Replacement Value! "+i ) );
      assertEquals( 0, t.length() );
      assertEquals( keys.length, t.keyCount() );
      assertEquals( capacities[keys.length], t.getHashLength() );
    }
    for ( int i = 0; i < keys.length; ++i ) {
      LuaValue vi = LuaString.valueOf( "Replacement Value! "+i );
      assertEquals( vi, t.get( keys[i] ) );
View Full Code Here

Examples of org.luaj.vm2.LuaTable.keyCount()

    // remove
    for ( int i = 0; i < keys.length; ++i ) {
      t.set( keys[i], LuaValue.NIL );
      assertEquals( 0, t.length() );
      assertEquals( keys.length-i-1, t.keyCount() );
      if ( i<keys.length-1 )
        assertEquals( capacities[keys.length], t.getHashLength() );
      else
        assertTrue( 0<=t.getHashLength()  );
    }
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.