I don't know your true sorting crierion, but the program is working as expected. For instace the third element of the output list cannot be
3 - test line 3 (third)
because the fourth field in that element is 2, which is larger than the fourth field of five other elements.