ENH: Add tests from textbook