<commit_before><?php 

class Meta extends BaseUnit
{
    public function testSize(){
        $big = str_repeat( "a", 50000 );

        $this->assertEqual( $this->client->set( 'aaa', 'bar' ), 'bar' );
        $this->assertEqual( $this->client->set( 'aab', '1' ), '1' );
        $this->assertEqual( $this->client->set( 'aac', $big ), $big );
        
        $this->assertEqual( $this->client->meta( 'aaa', 'size' ), 3 );
        $this->assertEqual( $this->client->meta( 'aab', 'size' ), 1 );
        $this->assertTrue( $this->client->meta( 'aac', 'size' ) < 50000 ); 
    }       

    public function testAccess(){
        $this->assertEqual( $this->client->set( 'aaa', 'bar' ), 'bar' );
        $this->assertEqual( $this->client->meta( 'aaa', 'access' ), time() );
    }

    public function testCreated(){
        $this->assertEqual( $this->client->set( 'aaa', 'bar' ), 'bar' );
        $this->assertEqual( $this->client->meta( 'aaa', 'created' ), time() );
    }

    public function testTTL(){
        $this->assertEqual( $this->client->set( 'aaa', 'bar' ), 'bar' );
        $this->assertEqual( $this->client->meta( 'aaa', 'ttl' ), -1 );
        $this->assertTrue( $this->client->ttl( 'aaa', 10 ) );
        $this->assertEqual( $this->client->meta( 'aaa', 'ttl' ), 10 );
    }

    public function testLeft(){
        $this->assertEqual( $this->client->set( 'aaa', 'bar' ), 'bar' );
        $this->assertEqual( $this->client->meta( 'aaa', 'left' ), -1 );
        $this->assertTrue( $this->client->ttl( 'aaa', 10 ) );
        $this->assertEqual( $this->client->meta( 'aaa', 'left' ), 10 );

        sleep(1);

        $this->assertEqual( $this->client->meta( 'aaa', 'left' ), 9 );
    }

    public function testLock(){
        $this->assertEqual( $this->client->set( 'aaa', 'bar' ), 'bar' );
        $this->assertEqual( $this->client->meta( 'aaa', 'lock' ), 0 );
        $this->assertTrue( $this->client->lock( 'aaa', 10 ) );
        $this->assertEqual( $this->client->meta( 'aaa', 'lock' ), 10 );
    }

    public function testEncoding(){
        $big = str_repeat( "a", 50000 );

        $this->assertEqual( $this->client->set( 'aaa', 'bar' ), 'bar' );
        $this->assertEqual( $this->client->set( 'aab', '1' ), '1' );
        $this->assertEqual( $this->client->set( 'aac', $big ), $big );

        $this->assertEqual( $this->client->inc( 'aab' ), 2 );
        $this->assertEqual( $this->client->meta( 'aaa', 'encoding' ), Gibson::ENC_PLAIN );
        $this->assertEqual( $this->client->meta( 'aab', 'encoding' ), Gibson::ENC_NUMBER );
        $this->assertEqual( $this->client->meta( 'aac', 'encoding' ), Gibson::ENC_LZF ); 
    }

    public function clean(){
        $this->client->unlock('aaa');
        $this->client->mdel('a');
    }
}

?>
<commit_msg>testBetween instead of testEqual for created/access META tests<commit_after><?php 

class Meta extends BaseUnit
{
    public function testSize(){
        $big = str_repeat( "a", 50000 );

        $this->assertEqual( $this->client->set( 'aaa', 'bar' ), 'bar' );
        $this->assertEqual( $this->client->set( 'aab', '1' ), '1' );
        $this->assertEqual( $this->client->set( 'aac', $big ), $big );
        
        $this->assertEqual( $this->client->meta( 'aaa', 'size' ), 3 );
        $this->assertEqual( $this->client->meta( 'aab', 'size' ), 1 );
        $this->assertTrue( $this->client->meta( 'aac', 'size' ) < 50000 ); 
    }       

    public function testAccess(){
        $now = time();

        $this->assertEqual( $this->client->set( 'aaa', 'bar' ), 'bar' );
        $this->assertBetween( $this->client->meta( 'aaa', 'access' ), $now - 1, $now + 1 );
    }

    public function testCreated(){
        $now = time();

        $this->assertEqual( $this->client->set( 'aaa', 'bar' ), 'bar' );
        $this->assertBetween( $this->client->meta( 'aaa', 'created' ), $now - 1, $now + 1 );
    }

    public function testTTL(){
        $this->assertEqual( $this->client->set( 'aaa', 'bar' ), 'bar' );
        $this->assertEqual( $this->client->meta( 'aaa', 'ttl' ), -1 );
        $this->assertTrue( $this->client->ttl( 'aaa', 10 ) );
        $this->assertEqual( $this->client->meta( 'aaa', 'ttl' ), 10 );
    }

    public function testLeft(){
        $this->assertEqual( $this->client->set( 'aaa', 'bar' ), 'bar' );
        $this->assertEqual( $this->client->meta( 'aaa', 'left' ), -1 );
        $this->assertTrue( $this->client->ttl( 'aaa', 10 ) );
        $this->assertEqual( $this->client->meta( 'aaa', 'left' ), 10 );

        sleep(1);

        $this->assertEqual( $this->client->meta( 'aaa', 'left' ), 9 );
    }

    public function testLock(){
        $this->assertEqual( $this->client->set( 'aaa', 'bar' ), 'bar' );
        $this->assertEqual( $this->client->meta( 'aaa', 'lock' ), 0 );
        $this->assertTrue( $this->client->lock( 'aaa', 10 ) );
        $this->assertEqual( $this->client->meta( 'aaa', 'lock' ), 10 );
    }

    public function testEncoding(){
        $big = str_repeat( "a", 50000 );

        $this->assertEqual( $this->client->set( 'aaa', 'bar' ), 'bar' );
        $this->assertEqual( $this->client->set( 'aab', '1' ), '1' );
        $this->assertEqual( $this->client->set( 'aac', $big ), $big );

        $this->assertEqual( $this->client->inc( 'aab' ), 2 );
        $this->assertEqual( $this->client->meta( 'aaa', 'encoding' ), Gibson::ENC_PLAIN );
        $this->assertEqual( $this->client->meta( 'aab', 'encoding' ), Gibson::ENC_NUMBER );
        $this->assertEqual( $this->client->meta( 'aac', 'encoding' ), Gibson::ENC_LZF ); 
    }

    public function clean(){
        $this->client->unlock('aaa');
        $this->client->mdel('a');
    }
}

?>

{'fraction_non_alphanumeric': 0.2390037095919449, 'fraction_numerical': 0.01448507330860272, 'mean_word_length': 2.7372937293729374, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 193, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '7180840', 'n_tokens_mistral': 1983, 'n_tokens_neox': 1844, 'n_words': 389}