add test code for problem 7