tested the code and test cases