<commit_before><?php
require_once dirname(__FILE__).'/../Yarrow/Doc.php';

class FileCollectorTest extends PHPUnit_Framework_TestCase {
	
	function testFilterAllFilesByIncludePattern() {
		$collector = new FileCollector(dirname(__FILE__));
		$collector->includeByPattern("/\.php$/");
		$this->assertEquals(4, count($collector->getManifest()));
	}
	
	function testFilterFilesByIncludePattern() {
		$collector = new FileCollector(dirname(__FILE__));
		$collector->includeByPattern("/\.class\.php$/");
		$this->assertEquals(1, count($collector->getManifest()));
	}
	
	function testFilterFilesByExcludePattern() {
		$collector = new FileCollector(dirname(__FILE__));
		$collector->excludeByPattern("/\.class\.php$/");
		$this->assertEquals(3, count($collector->getManifest()));
	}
	
	function testFullGeneratorRun() {
		//$generator = new Generator();
		//$generator->run(dirname(__FILE__)."/Samples");
	}
	
}<commit_msg>more comprehensive test of pattern collection<commit_after><?php
require_once dirname(__FILE__).'/../Yarrow/Doc.php';

class FileCollectorTest extends PHPUnit_Framework_TestCase {
	
	function testFilterAllFilesByIncludePattern() {
		$collector = new FileCollector(dirname(__FILE__).'/Samples');
		$collector->includeByPattern("/\.php$/");
		$manifest = $collector->getManifest();
		
		$this->assertEquals(3, count($manifest));
		$this->assertEquals('sample.class.php', $manifest[0]['filename']);
		$this->assertEquals('sample.php', $manifest[1]['filename']);
		$this->assertEquals('SampleObject.php', $manifest[2]['filename']);
	}
	
	function testFilterFilesByIncludePattern() {
		$collector = new FileCollector(dirname(__FILE__).'/Samples');
		$collector->includeByPattern("/\.class\.php$/");
		$manifest = $collector->getManifest();
		
		$this->assertEquals(1, count($manifest));
		$this->assertEquals('sample.class.php', $manifest[0]['filename']);
		$this->assertEquals('Samples/sample.class.php', $manifest[0]['relative_path']);
	}
	
	function testFilterFilesByExcludePattern() {
		$collector = new FileCollector(dirname(__FILE__).'/Samples');
		$collector->excludeByPattern("/\.class\.php$/");
		$manifest = $collector->getManifest();
		
		$this->assertEquals(2, count($manifest));
		$this->assertEquals('sample.php', $manifest[0]['filename']);
		$this->assertEquals('SampleObject.php', $manifest[1]['filename']);		
	}
}
{'fraction_non_alphanumeric': 0.19043552519214346, 'fraction_numerical': 0.005550811272416738, 'mean_word_length': 6.367924528301887, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 29, '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': '6244844', 'n_tokens_mistral': 782, 'n_tokens_neox': 697, 'n_words': 93}