Test pattern coding