Simplify unit tests using check_preallocated_output