Another simple test.
已通過所有檢查
The build was successful.

此提交包含在:
2019-04-08 08:57:45 +02:00
父節點 67f40db553
當前提交 58b63a9f16
共有 2 個檔案被更改,包括 18 行新增0 行删除

17
tests/bin_format.aer 一般檔案
查看文件

@@ -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 一般檔案
查看文件

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