Abstract
In this contribution we discuss the domain specific problems arising when implementing test suites for numerical algorithms. We propose a design approach based on gradual contracts and a support library to alleviate some of these issues. Gradual contracts do not need to represent a full specification of an algorithm’s interface and can include untestable mathematical concepts. This encourages the developer to express their current, possibly incomplete, understanding of the algorithm in code and allows them to use automatic test generation for further insights. We demonstrate the applicability of our approach with the example of the Newton-Raphson method.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
References
Astropy testing guidelines. https://web.archive.org/web/20210610143923/https://docs.astropy.org/en/latest/development/testguide.html. Accessed 10 June 2021
The Boost Test documentation. http://go.wwu.de/5femy. Accessed 11 June 2021
How to write code like a scientist. http://go.wwu.de/xo8eu. Accessed 10 June 2021
icontract - design-by-contract in Python3 with informative violation messages and inheritance. http://go.wwu.de/b2ws6. Accessed 19 Aug 2021
Numpy testing guidelines. http://go.wwu.de/9fzha. Accessed 10 June 2021
Petsc testing system. http://go.wwu.de/2mnad. Accessed 10 June 2021
Pragmatic unit testing for scientific codes. http://go.wwu.de/4o1tl. Accessed 10 June 2021
Stan’s user guide. http://go.wwu.de/mui45. Accessed 11 June 2021
Unit testing in R. http://go.wwu.de/qw4fl. Accessed 10 June 2021
Verify simulations with the method of manufactured solutions. http://go.wwu.de/f7dzl. Accessed 11 June 2021
Writing tests for scientific code. http://go.wwu.de/qzi0t. Accessed 10 June 2021
Mishap Investigation Board: Mars climate orbiter mishap investigation board phase I report (1999)
Dubois, P.F.: Testing scientific programs. Comput. Sci. Eng. 14(4), 69–73 (2012)
Gragg, W., Tapia, R.: Optimal error bounds for the Newton-Kantorovich theorem. SIAM J. Numer. Anal. 11(1), 10–13 (1974)
Harris, C.R., Millman, K.J., et al.: Array programming with NumPy. Nature 585(7825), 357–362 (2020)
Kanewala, U., Bieman, J.M.: Testing scientific software: a systematic literature review. Inf. Softw. Technol. 56(10), 1219–1232 (2014)
MacIver, D.R., Hatfield-Dodds, Z., Contributors, M.O.: Hypothesis: a new approach to property-based testing. J. Open Source Softw. 4(43), 1891 (2019)
Meyer, B.: Applying “design by contract’’. Computer 25(10), 40–51 (1992)
Miller, G.: A scientist’s nightmare: software problem leads to five retractions (2006)
Wang, Q., Zhang, X., Zhang, Y., Yi, Q.: AUGEM: automatically generate high performance dense linear algebra kernels on x86 CPUs. In: SC 2013: Proceedings of the International Conference on High Performance Computing, Networking, Storage and Analysis, pp. 1–12 (2013)
Acknowledgment
Funded by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) under Germany’s Excellence Strategy EXC 2044 -390685587, Mathematics Münster: Dynamics-Geometry-Structure and under RA 3055/1-1: pyMOR – Nachhaltige Software zur Modell-Ordnungs-Reduktion.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2022 IFIP International Federation for Information Processing
About this paper
Cite this paper
Fritze, R., Rave, S. (2022). Specification and Validation of Numerical Algorithms with the Gradual Contracts Pattern. In: Clark, D., Menendez, H., Cavalli, A.R. (eds) Testing Software and Systems. ICTSS 2021. Lecture Notes in Computer Science, vol 13045. Springer, Cham. https://doi.org/10.1007/978-3-031-04673-5_14
Download citation
DOI: https://doi.org/10.1007/978-3-031-04673-5_14
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-031-04672-8
Online ISBN: 978-3-031-04673-5
eBook Packages: Computer ScienceComputer Science (R0)