An optimal algorithm for the automatic generation of March tests