test: extract "convert" as common code