Add more tests
The build was successful.
Details
The build was successful.
Details
This commit is contained in:
parent
7711bdb6bc
commit
c419b8605d
|
@ -0,0 +1,40 @@
|
||||||
|
class Main {
|
||||||
|
private $s = 'monkey';
|
||||||
|
private $t = 'many monkeys';
|
||||||
|
private $n = 43951789;
|
||||||
|
private $u = -43951789;
|
||||||
|
private $c = 65;
|
||||||
|
|
||||||
|
public function __construct() {
|
||||||
|
$this->testMonkey();
|
||||||
|
$this->testNumbers();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function testMonkey() {
|
||||||
|
printf("[%s]\n", $this->s);
|
||||||
|
printf("[%10s]\n", $this->s);
|
||||||
|
printf("[%-10s]\n", $this->s);
|
||||||
|
printf("[%010s]\n", $this->s);
|
||||||
|
printf("[%'#10s]\n", $this->s);
|
||||||
|
printf("[%10.10s]\n", $this->t);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function testNumbers() {
|
||||||
|
printf("%%b = '%b'\n", $this->n);
|
||||||
|
printf("%%c = '%c'\n", $this->c);
|
||||||
|
printf("%%d = '%d'\n", $this->n);
|
||||||
|
printf("%%e = '%e'\n", $this->n);
|
||||||
|
printf("%%u = '%u'\n", $this->n);
|
||||||
|
printf("%%u = '%u'\n", $this->u);
|
||||||
|
printf("%%f = '%f'\n", $this->n);
|
||||||
|
printf("%%o = '%o'\n", $this->n);
|
||||||
|
printf("%%s = '%s'\n", $this->n);
|
||||||
|
printf("%%x = '%x'\n", $this->n);
|
||||||
|
printf("%%X = '%X'\n", $this->n);
|
||||||
|
printf("%%+d = '%+d'\n", $this->n);
|
||||||
|
printf("%%+d = '%+d'\n", $this->u);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
new Main();
|
|
@ -0,0 +1,19 @@
|
||||||
|
[monkey]
|
||||||
|
[ monkey]
|
||||||
|
[monkey ]
|
||||||
|
[0000monkey]
|
||||||
|
[####monkey]
|
||||||
|
[many monke]
|
||||||
|
%b = '10100111101010011010101101'
|
||||||
|
%c = 'A'
|
||||||
|
%d = '43951789'
|
||||||
|
%e = '4.395179e+07'
|
||||||
|
%u = '43951789'
|
||||||
|
%u = '43951789'
|
||||||
|
%f = '43951789.000000'
|
||||||
|
%o = '247523255'
|
||||||
|
%s = '43951789'
|
||||||
|
%x = '29ea6ad'
|
||||||
|
%X = '29EA6AD'
|
||||||
|
%+d = '+43951789'
|
||||||
|
%+d = '-43951789'
|
|
@ -0,0 +1,27 @@
|
||||||
|
class Main {
|
||||||
|
|
||||||
|
function __construct() {
|
||||||
|
$foo = '0';
|
||||||
|
var_dump($foo);
|
||||||
|
$foo += 2;
|
||||||
|
var_dump($foo);
|
||||||
|
$foo = 1;
|
||||||
|
var_dump($foo);
|
||||||
|
$foo += 1.3;
|
||||||
|
var_dump($foo);
|
||||||
|
$foo = 5 + "10 Little Piggies";
|
||||||
|
var_dump($foo);
|
||||||
|
$foo = 5 + 10;
|
||||||
|
var_dump($foo);
|
||||||
|
$foo = 'car';
|
||||||
|
$foo[0] = 'b';
|
||||||
|
var_dump($foo);
|
||||||
|
$foo = 10;
|
||||||
|
$foo = (bool) $foo;
|
||||||
|
var_dump($foo);
|
||||||
|
$foo = '';
|
||||||
|
var_dump($foo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
new Main();
|
|
@ -0,0 +1,9 @@
|
||||||
|
string(1 '0')
|
||||||
|
string(2 '02')
|
||||||
|
int(1)
|
||||||
|
float(2.3)
|
||||||
|
string(18 '510 Little Piggies')
|
||||||
|
int(15)
|
||||||
|
string(3 'bar')
|
||||||
|
bool(TRUE)
|
||||||
|
string(0 '')
|
Loading…
Reference in New Issue