<?php
include "MathcerClass.php";
echo "Begin tests Pattern MAtcher \n <hr>";
$p = new MatcherClass();
/*test simnple tests Stack */
echo "<h3>Test1 Multiply Patterns 1 </h3> ";
$p
->setPatterns(
array(
"0.56",
"56+5",
"78+5=0",
"pashkovdenis@gmail.com",
"Some.Value.String"
)
);
print_r($p->getRegular());
echo " <p>Testing Testing Mail Mail@gmail.com = " .$p->isMatch("Mail@gmail.com"). "</p>";
echo " <p>Testing 'Value.String.String' = " .$p->isMatch("Value.String.String"). "</p>";
echo " <p>Testing '45+5=9' = " .$p->isMatch("45+5=9"). "</p>";
echo " <p>Testing '0.56' = " .$p->isMatch("0.56"). "</p>";
echo " <p>Testing '65+6' = " .$p->isMatch("5+1"). "</p>";
echo " <p>Testing Bad Value = " .$p->isMatch("BAD value String That Return False "). "</p>";
echo " <p>Testing Bad Email 'bad.com@email' = " .$p->isMatch("bad.com@email "). "</p>";
echo "<hr>";
////////////////////////////////////////////
$p = new MatcherClass();
echo "<h3>Next testing: Single Pattern </h3> ";
echo " <p>Testing '65+6' = " .$p->setPatterns("5+6")->isMatch("5+1"). "</p>";
////////////////////////////////////////////////////////////
$p = new MatcherClass();
echo "<hr>";
echo "<h3> Each legth Tests Begin </h3> ";
$p->useEachLength(true)->setPatterns("sock@gmail.com");
print_r($p->getRegular());
echo " <p> Testing Email sock@gmail.com " . $p->isMatch("sowc@gmail.com"). "</p>";
//////////////////////////////////////////////
$p = new MatcherClass();
echo "<hr> ";
echo "<h3> Check Case Sensetive : </h3> ";
$p->caseSens(true)->useEachLength(true)->setPatterns("SOm");
print_r($p->getRegular());
echo " <p> Testing " . $p->isMatch("SOMK"). "</p>";
///////////////////////
echo "<hr>";
$p= new MatcherClass();
$p->setPatterns("pashkovdenis@gmail.com");
echo "<h2> Testing Similar String : </h2> ";
$resut = $p->getSimilar(array(
"pashkovdenis@gmail.com",
"pashkovdenif@gmail.com",
"pashkovdenig@gmail.com",
"pashkovdenos@gmail.com",
"somemail@gmail.com"
));
print_r( $resut );
echo "<hr>";
////////////////////////////////////////////////
$p= new MatcherClass();
$p->setPatterns("pashkovdenis@gmail.com");
$p->setCorector(array("value"=>".","mod"=>"reverse"));
$p->setCorector(array("value"=>"@","mod"=>"reverse"));
//$p->setCorector(array("value"=>"com","mod"=>"end","sym"=>"."));
echo "<h2> Begin Test 'ConverAgainst' com.hohoho@gmail </h2>" ;
print_r($p->setReverse("@")->comvertAgains("gmail.com@sdsdf"));
//////////////////////////////////////////////////////
echo "<hr>";
$p= new MatcherClass();
$p->setPatterns("pashkovdenis@gmail.com");
echo "<h2> Begin Test MatchAll</h2>" ;
echo "<p>Hello there This is simple string in this string we gonna match email as pattern pashkovdenis@gmail.com cool next string</p>";
print_r($p->MatchAll(" Hello there This is simple string in this string we gonna match email as pattern pashkovdenis@gmail.com cool next string "));
$p->setPatterns("2+5");
echo "<p>Hello there This is simple string in this string we gonna match email as pattern 6+5 cool next string </p>";
print_r($p->MatchAll(" Hello there This is simple string in this string we gonna match email as pattern 6+5 cool next string "));
|