Completes the initial implementation of the integer encoding function
along with its unit tests.