Better solution for testing

in addition, your testing was not checking all the "check" and assertions ...
so you were not able to catch all potential bugs.