Update test.php
Fix  error in castling check

There was an infinite loop in the check, if a king can castle.