diff --git a/tests/base32_test.aer b/tests/base32_test.aer index d5d1119..c85aa2e 100644 --- a/tests/base32_test.aer +++ b/tests/base32_test.aer @@ -54,14 +54,16 @@ class Base32 { string $x = ''; if(!in_array($input[$i], Base32::$map)) return false; - for(int $j = 0; $j < 8; $j++) { + for(int $j = 0; $j < 8; $j++) { + if(array_key_exists($input[$i + $j], Base32::$flippedMap)) { $x += str_pad(base_convert(Base32::$flippedMap[$input[$i + $j]], 10, 2), 5, '0', STR_PAD_LEFT); } - string[] $eightBits = str_split($x, 8); - for(int $z = 0; $z < sizeof($eightBits); $z++) { - char $y; - $binaryString += (($y = chr(base_convert($eightBits[$z], 2, 10))) || ord($y) == 48) ? $y : ''; - } + } + string[] $eightBits = str_split($x, 8); + for(int $z = 0; $z < sizeof($eightBits); $z++) { + char $y; + $binaryString += (($y = chr(base_convert($eightBits[$z], 2, 10))) || ord($y) == 48) ? $y : ''; + } } return $binaryString; } diff --git a/tests/brainfuck_interpreter.aer b/tests/brainfuck_interpreter.aer index 89c336e..e2914e1 100644 --- a/tests/brainfuck_interpreter.aer +++ b/tests/brainfuck_interpreter.aer @@ -22,7 +22,7 @@ class Brainfuck { } private void interpret(string $command) { - if(!$this->cells[$this->pointer]) { + if(!array_key_exists($this->pointer, $this->cells)) { $this->cells[$this->pointer] = 0; } switch ($command) { diff --git a/tests/goto_statement.aer b/tests/goto_statement.aer index 9c68628..2184375 100644 --- a/tests/goto_statement.aer +++ b/tests/goto_statement.aer @@ -56,7 +56,7 @@ class Test { goto cIterator; } cIteratorExit: { - if($headers[++$pos]) { + if(array_key_exists(++$pos, $headers)) { goto hIterator; } } diff --git a/tests/static_var.aer b/tests/static_var.aer index 4335ea0..0c6971e 100644 --- a/tests/static_var.aer +++ b/tests/static_var.aer @@ -2,7 +2,7 @@ class Program { private string cycle(char $a, char $b, int $i = 0) { static bool[] $switches; - if($switches[$i]) + if(array_key_exists($i, $switches)) $switches[$i] = !$switches[$i]; else !($switches[$i] = true);