[limb-svn] r6410 - 3.x/trunk/limb/core/tests/bench
svn at limb-project.com
svn at limb-project.com
Wed Oct 10 22:13:11 MSD 2007
Author: pachanga
Date: 2007-10-10 22:13:11 +0400 (Wed, 10 Oct 2007)
New Revision: 6410
URL: http://fisheye.limb-project.com/changelog/limb/?cs=6410
Added:
3.x/trunk/limb/core/tests/bench/class_content.inc
Removed:
3.x/trunk/limb/core/tests/bench/class_content.php
Modified:
3.x/trunk/limb/core/tests/bench/bundle.php
3.x/trunk/limb/core/tests/bench/object-attr.php
Log:
-- some bench refactoring
Modified: 3.x/trunk/limb/core/tests/bench/bundle.php
===================================================================
--- 3.x/trunk/limb/core/tests/bench/bundle.php 2007-10-10 18:05:03 UTC (rev 6409)
+++ 3.x/trunk/limb/core/tests/bench/bundle.php 2007-10-10 18:13:11 UTC (rev 6410)
@@ -1,11 +1,11 @@
<?php
-set_include_path(dirname(__FILE__) . '/../../../../;.');
+set_include_path(dirname(__FILE__) . '/../../../../');
require_once('limb/core/common.inc.php');
-require_once('limb/fs/src/lmbFS.class.php');
+require_once('limb/fs/src/lmbFs.class.php');
/*--------------------------------------*/
-lmbFS :: mkDir(dirname(__FILE__) . '/temp/');
+lmbFs :: mkDir(dirname(__FILE__) . '/temp/');
generateBundle('cc');
@@ -34,9 +34,9 @@
$object = new $class_name();
}
-echo "lmb_require many files: " . (microtime(true) - $mark) . "\n";
+echo "lmb_require $i files: " . (microtime(true) - $mark) . "\n";
-lmbFS :: rm(dirname(__FILE__) . '/temp/');
+lmbFs :: rm(dirname(__FILE__) . '/temp/');
/*--------------------------------------*/
@@ -65,7 +65,7 @@
function getContent($sufffix)
{
$content = 'class MyClass' . $sufffix;
- $content .= file_get_contents(dirname(__FILE__) . '/class_content.php');
+ $content .= file_get_contents(dirname(__FILE__) . '/class_content.inc');
return $content;
}
Copied: 3.x/trunk/limb/core/tests/bench/class_content.inc (from rev 6407, 3.x/trunk/limb/core/tests/bench/class_content.php)
===================================================================
--- 3.x/trunk/limb/core/tests/bench/class_content.inc (rev 0)
+++ 3.x/trunk/limb/core/tests/bench/class_content.inc 2007-10-10 18:13:11 UTC (rev 6410)
@@ -0,0 +1,50 @@
+ {
+ function testOpen()
+ {
+ $uri = new MockUri();
+ $reader = new lmbUriContentReader();
+ $uri->expectOnce('toString');
+ $uri->setReturnValue('toString', dirname(__FILE__) . '/../html/index.html');
+ $reader->open($uri);
+ $this->assertFalse($reader->getContentType()); // since opening a plain text file not html over http
+ $this->assertEqual($reader->getContent(),
+ file_get_contents(dirname(__FILE__) . '/../html/index.html'));
+ }
+
+ function testFilterAcceptedProtocols()
+ {
+ $links = array(new lmbUri('http://test1.com'),
+ new lmbUri('svn+ssh://test-broken.com'),
+ new lmbUri('https://test1.com'),
+ new lmbUri('ftp://test-broken.com'));
+
+ $this->filter->allowHost('test1.com');
+ $this->filter->allowPathRegex('~.*~');
+ $this->filter->allowProtocol('http');
+ $this->filter->allowProtocol('HTTPS');//protocols are lowercased
+
+ $this->assertTrue($this->filter->canPass($links[0]));
+ $this->assertFalse($this->filter->canPass($links[1]));
+ $this->assertTrue($this->filter->canPass($links[2]));
+ $this->assertFalse($this->filter->canPass($links[3]));
+ }
+
+ function testFilterAcceptedHosts()
+ {
+ $links = array(new lmbUri('http://www.test1.com/some/path'),
+ new lmbUri('http://test-broken.com'),
+ new lmbUri('http://test1.com'),
+ new lmbUri('http://microsoft.com'));
+
+ $this->filter->allowProtocol('http');
+ $this->filter->allowPathRegex('~.*~');
+ $this->filter->allowHost('test1.com');
+ $this->filter->allowHost('www.TEST1.com');//hosts are lowercased
+
+ $this->assertTrue($this->filter->canPass($links[0]));
+ $this->assertFalse($this->filter->canPass($links[1]));
+ $this->assertTrue($this->filter->canPass($links[2]));
+ $this->assertFalse($this->filter->canPass($links[3]));
+ }
+ }
+
Deleted: 3.x/trunk/limb/core/tests/bench/class_content.php
===================================================================
--- 3.x/trunk/limb/core/tests/bench/class_content.php 2007-10-10 18:05:03 UTC (rev 6409)
+++ 3.x/trunk/limb/core/tests/bench/class_content.php 2007-10-10 18:13:11 UTC (rev 6410)
@@ -1,50 +0,0 @@
- {
- function testOpen()
- {
- $uri = new MockUri();
- $reader = new lmbUriContentReader();
- $uri->expectOnce('toString');
- $uri->setReturnValue('toString', dirname(__FILE__) . '/../html/index.html');
- $reader->open($uri);
- $this->assertFalse($reader->getContentType()); // since opening a plain text file not html over http
- $this->assertEqual($reader->getContent(),
- file_get_contents(dirname(__FILE__) . '/../html/index.html'));
- }
-
- function testFilterAcceptedProtocols()
- {
- $links = array(new lmbUri('http://test1.com'),
- new lmbUri('svn+ssh://test-broken.com'),
- new lmbUri('https://test1.com'),
- new lmbUri('ftp://test-broken.com'));
-
- $this->filter->allowHost('test1.com');
- $this->filter->allowPathRegex('~.*~');
- $this->filter->allowProtocol('http');
- $this->filter->allowProtocol('HTTPS');//protocols are lowercased
-
- $this->assertTrue($this->filter->canPass($links[0]));
- $this->assertFalse($this->filter->canPass($links[1]));
- $this->assertTrue($this->filter->canPass($links[2]));
- $this->assertFalse($this->filter->canPass($links[3]));
- }
-
- function testFilterAcceptedHosts()
- {
- $links = array(new lmbUri('http://www.test1.com/some/path'),
- new lmbUri('http://test-broken.com'),
- new lmbUri('http://test1.com'),
- new lmbUri('http://microsoft.com'));
-
- $this->filter->allowProtocol('http');
- $this->filter->allowPathRegex('~.*~');
- $this->filter->allowHost('test1.com');
- $this->filter->allowHost('www.TEST1.com');//hosts are lowercased
-
- $this->assertTrue($this->filter->canPass($links[0]));
- $this->assertFalse($this->filter->canPass($links[1]));
- $this->assertTrue($this->filter->canPass($links[2]));
- $this->assertFalse($this->filter->canPass($links[3]));
- }
- }
-
Modified: 3.x/trunk/limb/core/tests/bench/object-attr.php
===================================================================
--- 3.x/trunk/limb/core/tests/bench/object-attr.php 2007-10-10 18:05:03 UTC (rev 6409)
+++ 3.x/trunk/limb/core/tests/bench/object-attr.php 2007-10-10 18:13:11 UTC (rev 6410)
@@ -42,7 +42,7 @@
for($i=0;$i<1000;$i++)
$object->getBar();
-echo "istance getBar(): " . (microtime(true) - $mark) . "\n";
+echo "instance getBar(): " . (microtime(true) - $mark) . "\n";
$mark = microtime(true);
More information about the limb-svn
mailing list