Test case not working

in maximum sum of subarray
maximum sum is showing 0 when all the elements are negative why?