Example #1
0
 /**
  * This method tests the add and the get method
  * of the TreeMap.
  *
  * @return void
  */
 public function testAddAndGetAndIsEmptyAndClear()
 {
     // initialize a new TreeMap
     $map = new TreeMap();
     // check that the TreeMap is empty
     $this->assertTrue($map->isEmpty());
     // add a new element
     $map->add(10, 'Test');
     // get the element
     $this->assertEquals('Test', $map->get(10));
     // check that the TreeMap is not empty
     $this->assertFalse($map->isEmpty());
     // remove all elements
     $map->clear();
     // check that the TreeMap is empty
     $this->assertTrue($map->isEmpty());
 }