added sum and average test function