<commit_before><?php
/**
 * Lithium: the most rad php framework
 *
 * @copyright     Copyright 2010, Union of RAD (http://union-of-rad.org)
 * @license       http://opensource.org/licenses/bsd-license.php The BSD License
 */

namespace lithium\tests\cases\Test;

class UnitTest extends \lithium\test\Unit {

	public function compare($type, $expected, $result = null) {
		return $this->_compare($type, $expected, $result);
	}

	/**
	 * @todo Figure out a way to expect failures
	 * @return void
	 */
	public function testBaseAssertions() {
		$this->assert(true);
		//$this->assert(false);
		$this->assertTrue(true);
		$this->assertFalse(false);
	}

	public function testCompare() {
		$expected = array('trace' => null, 'expected' => 'array', 'result' => 'string');
		$result = $this->compare('equal', array(), 'string');
		$this->assertEqual($expected, $result);
	}

	public function testAssertEqualNumeric() {
		$expected = array(1, 2, 3);
		$result = array(1, 2, 3);
		$this->assertEqual($expected, $result);
	}

	/**
	 * undocumented function
	 *
	 * @return void
	 * @todo See @todo above.
	 */
	public function testAssertEqualNumericFail() {
		$result = array(1, 2);
		$expected = array(1, 2, 3);
		//$this->assertEqual($expected, $result);
	}

	public function testAssertEqualAssociativeArray() {
		$expected = array(
			'expected' => 'array',
			'result' => 'string'
		);
		$result = array(
			'expected' => 'array',
			'result' => 'string'
		);
		$this->assertEqual($expected, $result);
	}

	/**
	 * undocumented function
	 *
	 * @return void
	 * @todo See @todo above.
	 */
	public function testAssertEqualThreeDFail() {
		$result = array(
			array(array(1, 2), array(1)),
			array(array(1, 2), array(1))
		);
		$expected = array(
			array(array(1, 2), array(1, 2)),
			array(array(1, 2), array(1, 2))
		);
		//$this->assertEqual($expected, $result);
	}

	public function testAssertIdentical() {

	}

	public function testTestMethods() {
		$expected = array(
			'testBaseAssertions', 'testCompare', 'testAssertEqualNumeric',
			'testAssertEqualNumericFail', 'testAssertEqualAssociativeArray',
			'testAssertEqualThreeDFail', 'testAssertIdentical', 'testTestMethods',
			'testCleanUp', 'testCleanUpWithFullPath', 'testCleanUpWithRelativePath'
		);
		$this->assertEqual($expected, $this->methods());
	}

	public function testCleanUp() {
		$base = LITHIUM_APP_PATH . '/resources/tmp/tests';
		$this->assertTrue(mkdir("{$base}/cleanup_test"));
		$this->assertTrue(touch("{$base}/cleanup_test/file"));
		$this->assertTrue(touch("{$base}/cleanup_test/.hideme"));

		$this->_cleanUp();
		$this->assertFalse(file_exists("{$base}/cleanup_test"));
	}

	public function testCleanUpWithFullPath() {
		$base = LITHIUM_APP_PATH . '/resources/tmp/tests';
		$this->assertTrue(mkdir("{$base}/cleanup_test"));
		$this->assertTrue(touch("{$base}/cleanup_test/file"));
		$this->assertTrue(touch("{$base}/cleanup_test/.hideme"));

		$this->_cleanUp("{$base}/cleanup_test");
		$this->assertTrue(file_exists("{$base}/cleanup_test"));
		$this->assertFalse(file_exists("{$base}/cleanup_test/file"));
		$this->assertFalse(file_exists("{$base}/cleanup_test/.hideme"));

		$this->_cleanUp();
	}

	public function testCleanUpWithRelativePath() {
		$base = LITHIUM_APP_PATH . '/resources/tmp/tests';
		$this->assertTrue(mkdir("{$base}/cleanup_test"));
		$this->assertTrue(touch("{$base}/cleanup_test/file"));
		$this->assertTrue(touch("{$base}/cleanup_test/.hideme"));

		$this->_cleanUp("tests/cleanup_test");
		$this->assertTrue(file_exists("{$base}/cleanup_test"));
		$this->assertFalse(file_exists("{$base}/cleanup_test/file"));
		$this->assertFalse(file_exists("{$base}/cleanup_test/.hideme"));

		$this->_cleanUp();
	}
}

?><commit_msg>Correcting namespace of `Unit` test case.<commit_after><?php
/**
 * Lithium: the most rad php framework
 *
 * @copyright     Copyright 2010, Union of RAD (http://union-of-rad.org)
 * @license       http://opensource.org/licenses/bsd-license.php The BSD License
 */

namespace lithium\tests\cases\test;

class UnitTest extends \lithium\test\Unit {

	public function compare($type, $expected, $result = null) {
		return $this->_compare($type, $expected, $result);
	}

	/**
	 * @todo Figure out a way to expect failures
	 * @return void
	 */
	public function testBaseAssertions() {
		$this->assert(true);
		//$this->assert(false);
		$this->assertTrue(true);
		$this->assertFalse(false);
	}

	public function testCompare() {
		$expected = array('trace' => null, 'expected' => 'array', 'result' => 'string');
		$result = $this->compare('equal', array(), 'string');
		$this->assertEqual($expected, $result);
	}

	public function testAssertEqualNumeric() {
		$expected = array(1, 2, 3);
		$result = array(1, 2, 3);
		$this->assertEqual($expected, $result);
	}

	/**
	 * undocumented function
	 *
	 * @return void
	 * @todo See @todo above.
	 */
	public function testAssertEqualNumericFail() {
		$result = array(1, 2);
		$expected = array(1, 2, 3);
		//$this->assertEqual($expected, $result);
	}

	public function testAssertEqualAssociativeArray() {
		$expected = array(
			'expected' => 'array',
			'result' => 'string'
		);
		$result = array(
			'expected' => 'array',
			'result' => 'string'
		);
		$this->assertEqual($expected, $result);
	}

	/**
	 * undocumented function
	 *
	 * @return void
	 * @todo See @todo above.
	 */
	public function testAssertEqualThreeDFail() {
		$result = array(
			array(array(1, 2), array(1)),
			array(array(1, 2), array(1))
		);
		$expected = array(
			array(array(1, 2), array(1, 2)),
			array(array(1, 2), array(1, 2))
		);
		//$this->assertEqual($expected, $result);
	}

	public function testAssertIdentical() {

	}

	public function testTestMethods() {
		$expected = array(
			'testBaseAssertions', 'testCompare', 'testAssertEqualNumeric',
			'testAssertEqualNumericFail', 'testAssertEqualAssociativeArray',
			'testAssertEqualThreeDFail', 'testAssertIdentical', 'testTestMethods',
			'testCleanUp', 'testCleanUpWithFullPath', 'testCleanUpWithRelativePath'
		);
		$this->assertEqual($expected, $this->methods());
	}

	public function testCleanUp() {
		$base = LITHIUM_APP_PATH . '/resources/tmp/tests';
		$this->assertTrue(mkdir("{$base}/cleanup_test"));
		$this->assertTrue(touch("{$base}/cleanup_test/file"));
		$this->assertTrue(touch("{$base}/cleanup_test/.hideme"));

		$this->_cleanUp();
		$this->assertFalse(file_exists("{$base}/cleanup_test"));
	}

	public function testCleanUpWithFullPath() {
		$base = LITHIUM_APP_PATH . '/resources/tmp/tests';
		$this->assertTrue(mkdir("{$base}/cleanup_test"));
		$this->assertTrue(touch("{$base}/cleanup_test/file"));
		$this->assertTrue(touch("{$base}/cleanup_test/.hideme"));

		$this->_cleanUp("{$base}/cleanup_test");
		$this->assertTrue(file_exists("{$base}/cleanup_test"));
		$this->assertFalse(file_exists("{$base}/cleanup_test/file"));
		$this->assertFalse(file_exists("{$base}/cleanup_test/.hideme"));

		$this->_cleanUp();
	}

	public function testCleanUpWithRelativePath() {
		$base = LITHIUM_APP_PATH . '/resources/tmp/tests';
		$this->assertTrue(mkdir("{$base}/cleanup_test"));
		$this->assertTrue(touch("{$base}/cleanup_test/file"));
		$this->assertTrue(touch("{$base}/cleanup_test/.hideme"));

		$this->_cleanUp("tests/cleanup_test");
		$this->assertTrue(file_exists("{$base}/cleanup_test"));
		$this->assertFalse(file_exists("{$base}/cleanup_test/file"));
		$this->assertFalse(file_exists("{$base}/cleanup_test/.hideme"));

		$this->_cleanUp();
	}
}

?>
{'fraction_non_alphanumeric': 0.1940278521692555, 'fraction_numerical': 0.007766470273165506, 'mean_word_length': 4.923076923076923, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 87, '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': '4324854', 'n_tokens_mistral': 2706, 'n_tokens_neox': 2472, 'n_words': 423}