<commit_before><?php
/*
 * Limb PHP Framework
 *
 * @link http://limb-project.com 
 * @copyright  Copyright &copy; 2004-2007 BIT(http://bit-creative.com)
 * @license    LGPL http://www.gnu.org/copyleft/lesser.html 
 */
lmb_require('limb/core/src/lmbObject.class.php');

class CacheableFooBarClass{}

abstract class lmbCacheBackendTest extends UnitTestCase
{
  protected $cache;

  abstract function _createPersisterImp();

  function setUp()
  {
    $this->cache = $this->_createPersisterImp();
    $this->cache->flush();
  }

  function tearDown()
  {
    $this->cache->flush();
  }

  
  function testGetFalse()
  {
    $this->assertFalse($this->cache->get(1));
  }

  function testGetTrue()
  {
    $this->cache->set(1, $v = 'value');
    $var = $this->cache->get(1);
    $this->assertEqual($v, $var);
  }
  
  function testAddLock()
  {
    $set = $this->cache->set(1, $v = 'value');
    $add = $this->cache->add(1, $v = 'value');
    
    $this->assertTrue($set);
    $this->assertFalse($add);
    
    $add2 = $this->cache->add(2, $v2 = 'value2');
    $this->assertTrue($add2);
    $this->assertEqual($v2, 'value2');<commit_msg>[svn r6903] -- cache test fix<commit_after><?php
/*
 * Limb PHP Framework
 *
 * @link http://limb-project.com 
 * @copyright  Copyright &copy; 2004-2007 BIT(http://bit-creative.com)
 * @license    LGPL http://www.gnu.org/copyleft/lesser.html 
 */
lmb_require('limb/core/src/lmbObject.class.php');

class CacheableFooBarClass{}

abstract class lmbCacheBackendTest extends UnitTestCase
{
  protected $cache;

  abstract function _createPersisterImp();

  function setUp()
  {
    $this->cache = $this->_createPersisterImp();
    $this->cache->flush();
  }

  function tearDown()
  {
    $this->cache->flush();
  }

  
  function testGetFalse()
  {
    $this->assertFalse($this->cache->get(1));
  }

  function testGetTrue()
  {
    $this->cache->set(1, $v = 'value');
    $var = $this->cache->get(1);
    $this->assertEqual($v, $var);
  }
  
  function testAddLock()
  {
    $set = $this->cache->set(1, $v = 'value');
    $add = $this->cache->add(1, $v_add = 'value_add');
    
    $this->assertTrue($set);
    $this->assertFalse($add);
    
    $add2 = $this->cache->add(2, $v2 = 'value2');
    $this->assertTrue($add2);
    $this->assertEqual($v2, 'value2');
{'fraction_non_alphanumeric': 0.19720767888307156, 'fraction_numerical': 0.019197207678883072, 'mean_word_length': 3.3264150943396227, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 51, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5895522', 'n_tokens_mistral': 859, 'n_tokens_neox': 829, 'n_words': 135}