Search

Testing with Axioms in C++ 2011

By: Anya Helene Bagge, Valentin David, Magne Haveraaen

Abstract

Unit testing is an important part of modern software development, where individual code units are tested in isolation. Such tests are typically case-based, checking a likely error scenario or an error that has previously been identified and fixed. Coming up with good test cases is challenging, particularly when testing generic code, and focusing on individual tests can distract from creating tests that cover the full functionality. Concepts provide a generic way of describing code interfaces for generic code. Together with axioms, program behaviour can be specified algebraically in a formal or semi-formal way. In this paper we show how concepts and axioms can be expressed in standard C++ 2011, and explore how to generate generic unit tests, by treating the axioms as code to be evaluated with test data. We also show a generic way to generate test data for axiom-based testing in C++ 2011.

Keywords

Algebraic Specification, Axiom-Based Testing, Axioms, C++, C++0x, C++11, Concepts, Generative Programming, Mouldable Programming, Test Generation, Unit Testing

Cite as:

Anya Helene Bagge, Valentin David, Magne Haveraaen, “Testing with Axioms in C++ 2011”, Journal of Object Technology, Volume 10, (2011), pp. 10:1-32, doi:10.5381/jot.2011.10.1.a10.

PDF | DOI | BiBTeX | Tweet this | Post to CiteULike | Share on LinkedIn