add some tests for chap3.erl