Write a function to sort a given matrix in ascending order according to the sum of its rows.
def sort_matrix(M):
    result = sorted(M, key=sum)
    return result
<s>[INST]<<SYS>>Given a task and its code, generate test cases for the code.<</SYS>>Write a function to sort a given matrix in ascending order according to the sum of its rows.
def sort_matrix(M):
    result = sorted(M, key=sum)
    return result[/INST]assert sort_matrix([[1, 2, 3], [2, 4, 5], [1, 1, 1]])==[[1, 1, 1], [1, 2, 3], [2, 4, 5]]
assert sort_matrix([[1, 2, 3], [-2, 4, -5], [1, -1, 1]])==[[-2, 4, -5], [1, -1, 1], [1, 2, 3]]
assert sort_matrix([[5,8,9],[6,4,3],[2,1,4]])==[[2, 1, 4], [6, 4, 3], [5, 8, 9]]</s>