public function test_increment()
{
$this->mem->save(__METHOD__, 100);
$call = $this->mem->increment(__METHOD__, 10);
$this->assertEquals($call, 110);
$check = $this->mem->read(__METHOD__);
$this->assertEquals($check - 110, 0);
$call = $this->mem->increment(__METHOD__, -10);
$this->assertEquals($call - 100, 0);
$check = $this->mem->read(__METHOD__);
$this->assertEquals($check - 100, 0);
$this->mem->save(__METHOD__, 'string');
$call = $this->mem->increment(__METHOD__, 10);
$this->assertEquals($call, 'string10');
$check = $this->mem->read(__METHOD__);
$this->assertEquals($check, 'string10');
$this->mem->save(__METHOD__, array(1, 2));
$this->assertEquals($this->mem->increment(__METHOD__, 3), array(1, 2, 3));
$this->assertEquals($this->mem->read(__METHOD__), array(1, 2, 3));
$this->mem->increment(__METHOD__ . 'inc', array('a'));
$this->mem->increment(__METHOD__ . 'inc', array('b'));
$this->assertEquals($this->mem->read(__METHOD__ . 'inc'), array('a', 'b'));
$this->mem->increment(__METHOD__ . 'inc', array('k1' => 'a'));
$this->mem->increment(__METHOD__ . 'inc', array('k2' => 'b'));
$this->mem->increment(__METHOD__ . 'inc', array('k2' => 'c'));
$this->assertEquals($this->mem->read(__METHOD__ . 'inc'), array('a', 'b', 'k1' => 'a', 'k2' => 'c'));
$this->mem->save(__METHOD__, array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11));
$call = $this->mem->increment(__METHOD__, 100, 10);
$this->assertEquals($call, array(3, 4, 5, 6, 7, 8, 9, 10, 11, 100));
$check = $this->mem->read(__METHOD__);
$this->assertEquals($check, array(3, 4, 5, 6, 7, 8, 9, 10, 11, 100));
$this->mem->save(__METHOD__, 1, 10);
$this->mem->increment(__METHOD__, 2, 0, 25);
$check = $this->mem->read(__METHOD__, $ttl_left);
$this->assertEquals($check - 3, 0);
$this->assertEquals($ttl_left, 25)->addCommentary('ttl_left');
}