added nontrivial test cases for average function