<commit_before><?php

	/**
	 * @group date
	 */
	public function test_dateFrame() {
		
		// w/o criteria
		$dateframe = new DateFrame('2015-01-01', '3/31/2015');
		$this->assertEquals('2015-01-01 00:00:00', $dateframe->start);
		$this->assertEquals('2015-03-31 23:59:59', $dateframe->end);
		$this->assertNull($dateframe->criteria);	

		$criteria = $dateframe->getCriteria('completeddate');
		$this->assertInstanceOf('Criteria', $criteria);
		$this->assertInstanceOf('Criteria', $dateframe->criteria);
		$this->assertInstanceOf('Criterion_between', $dateframe->criteria->where[0]);

		$by_day = $dateframe->asDayIntervals();
		$this->assertEquals('2015-01-01 00:00:00', $by_day[0]->start);
		
		$by_day = $dateframe->asDayIntervals();
		$keys = array_keys($by_day);
		$this->assertEquals('2015-03-31 23:59:59', $by_day[end($keys)]->end);

		$by_7day = $dateframe->asSevenDayIntervals();
		$this->assertEquals('2015-01-01 00:00:00', $by_7day[0]->start);
		$this->assertEquals('2015-01-28 23:59:59', $by_7day[3]->end);
		$keys = array_keys($by_7day);
		$this->assertEquals('2015-03-31 23:59:59', $by_7day[end($keys)]->end);
		
		$by_week = $dateframe->asWeekIntervals();
		$this->assertEquals('2015-01-01 00:00:00', $by_week[0]->start);
		$this->assertEquals('2015-01-04 00:00:00', $by_week[1]->start);
		$this->assertEquals('2015-01-10 23:59:59', $by_week[1]->end);		
		$keys = array_keys($by_week);
		$this->assertEquals('2015-03-31 23:59:59', $by_week[end($keys)]->end);		
		
		$by_month = $dateframe->asMonthIntervals();
		$this->assertEquals('2015-01-31 23:59:59', $by_month[0]->end);		
	
	}<commit_msg>Fixed tests<commit_after><?php

require 'DateFrame.php';

class TestDateFrame{
  
	public function assertEquals($a, $b){
		if($a == $b) return true;
		die("$a NOT EQUALS $b");
	}

	public function assertNull($a){
		if($a === null) return true;
		die("$a NOT NULL");
	} 
  
	/**
	 * @group date
	 */
	public function test_dateFrame() {

		// w/o criteria
		$dateframe = new DateFrame('2015-01-01', '3/31/2015');
		$this->assertEquals('2015-01-01 00:00:00', $dateframe->start);
		$this->assertEquals('2015-03-31 23:59:59', $dateframe->end);
		$this->assertNull($dateframe->criteria);	
		$criteria = $dateframe->getCriteria('completeddate');
		$by_day = $dateframe->asDayIntervals();
		$this->assertEquals('2015-01-01 00:00:00', $by_day[0]->start);

		$by_day = $dateframe->asDayIntervals();
		$keys = array_keys($by_day);
		$this->assertEquals('2015-03-31 23:59:59', $by_day[end($keys)]->end);
		$by_7day = $dateframe->asSevenDayIntervals();
		$this->assertEquals('2015-01-01 00:00:00', $by_7day[0]->start);
		$this->assertEquals('2015-01-28 23:59:59', $by_7day[3]->end);
		$keys = array_keys($by_7day);
		$this->assertEquals('2015-03-31 23:59:59', $by_7day[end($keys)]->end);

		$by_week = $dateframe->asWeekIntervals();
		$this->assertEquals('2015-01-01 00:00:00', $by_week[0]->start);
		$this->assertEquals('2015-01-04 00:00:00', $by_week[1]->start);
		$this->assertEquals('2015-01-10 23:59:59', $by_week[1]->end);		
		$keys = array_keys($by_week);
		$this->assertEquals('2015-03-31 23:59:59', $by_week[end($keys)]->end);		

		$by_month = $dateframe->asMonthIntervals();
		$this->assertEquals('2015-01-31 23:59:59', $by_month[0]->end);	

		die("TEST PASSED!");
	}
}

$T = new TestDateFrame;
$T->test_dateFrame();
{'fraction_non_alphanumeric': 0.22898463392588128, 'fraction_numerical': 0.11780656824344682, 'mean_word_length': 5.3238095238095235, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 74, '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': '7614361', 'n_tokens_mistral': 1605, 'n_tokens_neox': 1277, 'n_words': 173}