Self-validating integration and approximation of piecewise analytic functions