A predictive cost model for automatic test pattern generation