sum_of_digits function with tests added