Add a conversion to integer function
Improve the testing