mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-11 12:27:51 +00:00
test again
This commit is contained in:
parent
5d27a40a6e
commit
feea39a97f
@ -26,7 +26,9 @@ class PocketMinecraftServer{
|
|||||||
|
|
||||||
private function load(){
|
private function load(){
|
||||||
$this->version = new VersionString();
|
$this->version = new VersionString();
|
||||||
@cli_set_process_title("PocketMine-MP ".MAJOR_VERSION);
|
if(!defined("DEBUG") or DEBUG >= 0){
|
||||||
|
@cli_set_process_title("PocketMine-MP ".MAJOR_VERSION);
|
||||||
|
}
|
||||||
if($this->version->isDev()){
|
if($this->version->isDev()){
|
||||||
console("[INFO] \x1b[31;1mThis is a Development version");
|
console("[INFO] \x1b[31;1mThis is a Development version");
|
||||||
}
|
}
|
||||||
@ -87,7 +89,7 @@ class PocketMinecraftServer{
|
|||||||
|
|
||||||
public function titleTick(){
|
public function titleTick(){
|
||||||
$time = microtime(true);
|
$time = microtime(true);
|
||||||
if(ENABLE_ANSI === true){
|
if((!defined("DEBUG") or DEBUG >= 0) and ENABLE_ANSI === true){
|
||||||
echo "\x1b]0;PocketMine-MP ".MAJOR_VERSION." | Online ". count($this->clients)."/".$this->maxClients." | RAM ".round((memory_get_usage() / 1024) / 1024, 2)."MB | U ".round(($this->interface->bandwidth[1] / max(1, $time - $this->interface->bandwidth[2])) / 1024, 2)." D ".round(($this->interface->bandwidth[0] / max(1, $time - $this->interface->bandwidth[2])) / 1024, 2)." kB/s | TPS ".$this->getTPS()."\x07";
|
echo "\x1b]0;PocketMine-MP ".MAJOR_VERSION." | Online ". count($this->clients)."/".$this->maxClients." | RAM ".round((memory_get_usage() / 1024) / 1024, 2)."MB | U ".round(($this->interface->bandwidth[1] / max(1, $time - $this->interface->bandwidth[2])) / 1024, 2)." D ".round(($this->interface->bandwidth[0] / max(1, $time - $this->interface->bandwidth[2])) / 1024, 2)." kB/s | TPS ".$this->getTPS()."\x07";
|
||||||
}
|
}
|
||||||
$this->interface->bandwidth = array(0, 0, $time);
|
$this->interface->bandwidth = array(0, 0, $time);
|
||||||
|
@ -1,40 +1,35 @@
|
|||||||
<?php
|
<?php
|
||||||
/***REM_START***/
|
/***REM_START***/
|
||||||
if(class_exists("PocketMinecraftServer", false)){
|
if(!class_exists("PocketMinecraftServer", false)){
|
||||||
return;
|
class ServerSuiteTest extends PHPUnit_Framework_TestCase{
|
||||||
}
|
private $server;
|
||||||
|
public function testStart(){
|
||||||
|
define("NO_THREADS", true);
|
||||||
|
define("DEBUG", -1); //No output
|
||||||
|
require_once(dirname(__FILE__)."/../dependencies.php");
|
||||||
|
require_once(FILE_PATH."/src/functions.php");
|
||||||
|
require_once(FILE_PATH."/src/dependencies.php");
|
||||||
|
|
||||||
class ServerSuiteTest extends PHPUnit_Framework_TestCase{
|
//binary things
|
||||||
private $server;
|
$this->assertTrue(Utils::readTriad("\x02\x01\x03") === 131331, "Utils::readTriad");
|
||||||
public function hook(){
|
$this->assertTrue(Utils::readInt("\xff\x02\x01\x03") === -16645885, "Utils::readInt");
|
||||||
$this->assertTrue(true);
|
$this->assertTrue(abs(Utils::readFloat("\x49\x02\x01\x03") - 532496.1875) < 0.0001, "Utils::readFloat");
|
||||||
$server = ServerAPI::request();
|
$this->assertTrue(abs(Utils::readDouble("\x41\x02\x03\x04\x05\x06\x07\x08") - 147552.5024529) < 0.0001, "Utils::readDouble");
|
||||||
|
$this->assertTrue(Utils::readLong("\x41\x02\x03\x04\x05\x06\x07\x08") === "4684309878217770760", "Utils::readLong");
|
||||||
|
|
||||||
|
//PocketMine-MP server startup
|
||||||
|
$server = new ServerAPI();
|
||||||
|
$server->load();
|
||||||
|
$this->assertTrue(is_integer($server->event("server.start", array($this, "hook"))));
|
||||||
|
$server->init();
|
||||||
|
}
|
||||||
|
|
||||||
//Everything done!
|
public function hook(){
|
||||||
$server->close();
|
$this->server = ServerAPI::request();
|
||||||
}
|
|
||||||
|
|
||||||
public function testRead(){
|
//Everything done!
|
||||||
define("NO_THREADS", true);
|
$this->server->close();
|
||||||
define("DEBUG", -1); //No output
|
}
|
||||||
require_once(dirname(__FILE__)."/../dependencies.php");
|
|
||||||
require_once(FILE_PATH."/src/functions.php");
|
|
||||||
require_once(FILE_PATH."/src/dependencies.php");
|
|
||||||
|
|
||||||
//binary things
|
|
||||||
$this->assertTrue(Utils::readTriad("\x02\x01\x03") === 131331, "Utils::readTriad");
|
|
||||||
$this->assertTrue(Utils::readInt("\xff\x02\x01\x03") === -16645885, "Utils::readInt");
|
|
||||||
$this->assertTrue(abs(Utils::readFloat("\x49\x02\x01\x03") - 532496.1875) < 0.0001, "Utils::readFloat");
|
|
||||||
$this->assertTrue(abs(Utils::readDouble("\x41\x02\x03\x04\x05\x06\x07\x08") - 147552.5024529) < 0.0001, "Utils::readDouble");
|
|
||||||
$this->assertTrue(Utils::readLong("\x41\x02\x03\x04\x05\x06\x07\x08") === "4684309878217770760", "Utils::readLong");
|
|
||||||
|
|
||||||
//PocketMine-MP server startup
|
|
||||||
$this->server = new ServerAPI();
|
|
||||||
$this->server->load();
|
|
||||||
$this->assertTrue(is_integer($this->server->event("server.start", array($this, "hook"))));
|
|
||||||
$this->server->init();
|
|
||||||
exit(0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/***REM_END***/
|
/***REM_END***/
|
Loading…
x
Reference in New Issue
Block a user