I do not understand why this test is not passing, everything seems to run correctly.
There’s probably some improvements that need to be made here @simonliaboe. The tests input -1 and 1001 to ensure it sees both messages. That could be explained better or perhaps the test needs to be changed. I changed your regex on line 25 and it passed.
if [[ $GUESS =~ ^-?[0-9]+$ ]]