Another simple test.
All checks were successful
The build was successful.

This commit is contained in:
Rafal Kupiec 2019-04-08 08:57:45 +02:00
förälder 67f40db553
incheckning 58b63a9f16
Signerad av: belliash
GPG-nyckel ID: 4E829243E0CFE6B4
2 ändrade filer med 18 tillägg och 0 borttagningar

17
tests/bin_format.aer Normal file
Visa fil

@ -0,0 +1,17 @@
class Program {
string fmt_binary(int $x, int $numbits = 8) {
string $bin;
string $rtnval = '';
$bin = decbin($x);
$bin = substr(str_repeat(0, $numbits), 0, $numbits - strlen($bin)) + $bin;
for($x = 0; $x < $numbits / 4; $x++) {
$rtnval += ' ' + substr($bin, $x * 4, 4);
}
return ltrim($rtnval);
}
void main() {
var_dump($this->fmt_binary(2541));
}
}

1
tests/bin_format.exp Normal file
Visa fil

@ -0,0 +1 @@
string(9 '0000 1001')