added tests for chapter 4