Added test cases to test for correctness.