Concept Based Testing

Dietmar Kühl

Dietmar Kühl is a senior software developer at Bloomberg L.P. working on the data distribution environment used both internally and by enterprise installations at clients. Before joining Bloomberg he has done mainly consulting for software projects in the finance area. He is a regular attendee of the ANSI/ISO C++ standards committee, presents at conferences, and he used to be a moderator of the newsgroup comp.lang.c++.moderated. He frequently answers questions on Stackoverflow.

With concepts being added to the next revision of C++ it is expected that new concepts get defined. Each concept defines a set of operations used by generic code. One such use could be a generic test verifying that all parts of a concept are defined and checking generic interactions between a concept’s operations. Ideally, such a test even works with classes only partially modelling a concept to guide the implementation of classes.

This presentation doesn’t use the actual concept extensions but shows how generic tests can be created using features of C++17. For the generic tests the detection idiom and constexpr if are used to determine availability of required operations and gracefully dealing with the abseence of operations. The generic tests should be able to cover basics of classes modelling a concept. Obviously, specific behaviour for classes will still require corresponding tests.

Attendees are expected to be familiar basic C++. However, deep knowledge of template meta programming is not needed.

Slides in pdf

Platinum sponsor

Gold sponsors

Silver sponsors

Community sponsors