changes to unit tests
Esse commit está contido em:
@@ -1,48 +0,0 @@
|
||||
<?php
|
||||
require(dirname(__FILE__) . '/../../../../../Tests/config.php');
|
||||
|
||||
/**
|
||||
* Test class for Tokenizer.
|
||||
* Generated by PHPUnit on 2011-02-21 at 11:46:35.
|
||||
*/
|
||||
class TokenizerTest extends PHPUnit_Framework_TestCase {
|
||||
|
||||
/**
|
||||
* @var Tokenizer
|
||||
*/
|
||||
protected $object;
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test is executed.
|
||||
*/
|
||||
protected function setUp() {
|
||||
Mind::$currentProject['idiom']= 'pt';
|
||||
Mind::$langPath= dirname(__FILE__) . '/../../../../../mind3rd/API/languages/';
|
||||
require_once dirname(__FILE__) . '/../../../../../mind3rd/API/languages/pt/IgnoreForms.php';
|
||||
require_once dirname(__FILE__) . '/../../../../../mind3rd/API/languages/pt/Verbalizer.php';
|
||||
Tokenizer::loadModifiers(dirname(__FILE__) . '/../../../../../mind3rd/API/languages/pt/');
|
||||
$this->object = new Tokenizer;
|
||||
//$this->object->loadModifiers('../../languages/en/');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test is executed.
|
||||
*/
|
||||
protected function tearDown() {
|
||||
|
||||
}
|
||||
|
||||
public function testSweep1() {
|
||||
$ar= Array('cada','professor','dever', 'ter', 'um','ou','muitos','aluno','.');
|
||||
$exp= Array(2, 2, 64, 1, 8, 16, 32, 2, -2);
|
||||
$this->assertEquals($this->object->sweep($ar), $exp);
|
||||
}
|
||||
public function testSweep2() {
|
||||
$ar= Array('professor', 'ter', 'um','aluno','.');
|
||||
$exp= Array(2, 1, 8, 2, -2);
|
||||
$this->assertEquals($this->object->sweep($ar), $exp);
|
||||
}
|
||||
|
||||
}
|
||||
+27
-9
@@ -5,25 +5,32 @@ require(dirname(__FILE__) . '/../../../../../Tests/config.php');
|
||||
* Test class for Tokenizer.
|
||||
* Generated by PHPUnit on 2011-02-21 at 11:46:35.
|
||||
*/
|
||||
class TokenizerTest extends PHPUnit_Framework_TestCase {
|
||||
class TokenizerPTTest extends PHPUnit_Framework_TestCase {
|
||||
|
||||
/**
|
||||
* @var Tokenizer
|
||||
*/
|
||||
protected $object;
|
||||
|
||||
protected $idiom= 'en';
|
||||
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test is executed.
|
||||
*/
|
||||
protected function setUp() {
|
||||
Mind::$currentProject['idiom']= 'en';
|
||||
$this->setIdiom();
|
||||
}
|
||||
|
||||
public function setIdiom($idiom='en')
|
||||
{
|
||||
Mind::$currentProject['idiom']= $idiom;
|
||||
Mind::$langPath= dirname(__FILE__) . '/../../../../../mind3rd/API/languages/';
|
||||
require_once dirname(__FILE__) . '/../../../../../mind3rd/API/languages/en/IgnoreForms.php';
|
||||
require_once dirname(__FILE__) . '/../../../../../mind3rd/API/languages/en/Verbalizer.php';
|
||||
Tokenizer::loadModifiers(dirname(__FILE__) . '/../../../../../mind3rd/API/languages/en/');
|
||||
require_once dirname(__FILE__) . '/../../../../../mind3rd/API/languages/'.$idiom.'/IgnoreForms.php';
|
||||
require_once dirname(__FILE__) . '/../../../../../mind3rd/API/languages/'.$idiom.'/Verbalizer.php';
|
||||
Tokenizer::loadModifiers(dirname(__FILE__) . '/../../../../../mind3rd/API/languages/'.$idiom.'/');
|
||||
$this->object = new Tokenizer;
|
||||
//$this->object->loadModifiers('../../languages/en/');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -33,16 +40,27 @@ class TokenizerTest extends PHPUnit_Framework_TestCase {
|
||||
protected function tearDown() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function testSweep1() {
|
||||
$ar= Array('each','teacher','must', 'have', 'one','or','many','student','.');
|
||||
$this->setIdiom('pt');
|
||||
$ar= Array('cada','professor','dever', 'ter', 'um','ou','muitos','aluno','.');
|
||||
$exp= Array(2, 2, 64, 1, 8, 16, 32, 2, -2);
|
||||
$this->assertEquals($this->object->sweep($ar), $exp);
|
||||
}
|
||||
public function testSweep2() {
|
||||
$this->setIdiom('pt');
|
||||
$ar= Array('professor', 'ter', 'um','aluno','.');
|
||||
$exp= Array(2, 1, 8, 2, -2);
|
||||
$this->assertEquals($this->object->sweep($ar), $exp);
|
||||
}
|
||||
public function testSweep3() {
|
||||
$ar= Array('each','teacher','must', 'have', 'one','or','many','student','.');
|
||||
$exp= Array(2, 2, 64, 1, 8, 16, 32, 2, -2);
|
||||
$this->assertEquals($this->object->sweep($ar), $exp);
|
||||
}
|
||||
public function testSweep4() {
|
||||
$ar= Array('teacher', 'have', 'one','student','.');
|
||||
$exp= Array(2, 1, 8, 2, -2);
|
||||
$this->assertEquals($this->object->sweep($ar), $exp);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -151,8 +151,8 @@ class Tokenizer extends Token{
|
||||
*/
|
||||
public static function loadModifiers($modifiersSrc= false)
|
||||
{
|
||||
if(self::$quantifiers) // it is already loaded
|
||||
return true;
|
||||
/*if(self::$quantifiers) // it is already loaded
|
||||
return true;*/
|
||||
if(!$modifiersSrc && !file_exists('sintatics.list'))
|
||||
{
|
||||
self::loadSintatics(fopen(Mind::$langPath.Mind::$currentProject['idiom'].
|
||||
@@ -193,7 +193,7 @@ class Tokenizer extends Token{
|
||||
$cont= $content;
|
||||
else
|
||||
$cont= &Mind::$content;
|
||||
print_r($cont);
|
||||
//print_r($cont);
|
||||
// seek for data types
|
||||
foreach(self::$dataTypes as $type=>$options)
|
||||
{
|
||||
@@ -211,7 +211,7 @@ class Tokenizer extends Token{
|
||||
}
|
||||
|
||||
Mind::$syntaxer= new Syntaxer();
|
||||
print_r(Token::$spine);
|
||||
//print_r(Token::$spine);
|
||||
return Token::$spine;
|
||||
}
|
||||
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário