implemented the eval function with its unit tests