Back to index

php5  5.3.10
gtFunctionTest.php
Go to the documentation of this file.
00001 cd
00002 <?php
00003 require_once 'PHPUnit/Framework.php';
00004 require_once dirname(__FILE__) . '/../src/gtAutoload.php';
00005 
00006 
00007 class gtFunctionTest extends PHPUnit_Framework_TestCase
00008 {
00009   public function testArguments() {
00010 
00011     $f = new gtFunction('cos');
00012     $f->setArgumentNames();
00013     $m = $f->getMandatoryArgumentNames();
00014     $this->assertEquals($m[0], 'number');
00015   }
00016 
00017   public function testArguments2() {
00018 
00019     $f = new gtFunction('version_compare');
00020     $f->setArgumentNames();
00021     $m = $f->getMandatoryArgumentNames();
00022     $o = $f->getOptionalArgumentNames();
00023     $this->assertEquals($m[0], 'ver1');
00024     $this->assertEquals($m[1], 'ver2');
00025     $this->assertEquals($o[0], 'oper');
00026 
00027   }
00028 
00029   public function testExtraArguments() {
00030 
00031     $f = new gtFunction('version_compare');
00032     $f->setArgumentNames();
00033     $f->setExtraArgumentList();
00034 
00035     $this->assertEquals('$ver1, $ver2, $oper, $extra_arg', $f->getExtraArgumentList());
00036   }
00037 
00038   public function testShortArguments() {
00039 
00040     $f = new gtFunction('version_compare');
00041     $f->setArgumentNames();
00042     $f->setShortArgumentList();
00043 
00044     $this->assertEquals('$ver1', $f->getShortArgumentList());
00045   }
00046   
00047    public function testAllArgumentList() {
00048 
00049     $f = new gtFunction('version_compare');
00050     $f->setArgumentNames();
00051     $f->setValidArgumentLists();
00052     $a = $f->getValidArgumentLists();
00053     
00054     $this->assertEquals('$ver1, $ver2', $a[0]);
00055     $this->assertEquals('$ver1, $ver2, $oper', $a[1]);
00056   }
00057   
00058    public function testInitialisation() {
00059 
00060     $f = new gtFunction('version_compare');
00061     $f->setArgumentNames();
00062     $f->setInitialisationStatements();
00063     $a = $f->getInitialisationStatements();
00064     
00065     $this->assertEquals('$ver1 = ', $a[0]);
00066     $this->assertEquals('$ver2 = ', $a[1]);
00067     $this->assertEquals('$oper = ', $a[2]);
00068   }
00069 
00070 }
00071 ?>