Generalized algorithmic debugging and testing