Sequoia
Loading...
Searching...
No Matches
Functions
RegularCheckers.hpp File Reference

Functions for checking regular semantics. More...

#include "sequoia/TestFramework/FreeCheckers.hpp"
#include "sequoia/TestFramework/RegularCheckersDetails.hpp"

Go to the source code of this file.

Functions

template<test_mode Mode, pseudoregular T, class U >
requires checkable_against_for_semantics<Mode, T, U>
void sequoia::testing::check_semantics (std::string description, test_logger< Mode > &logger, const T &x, const T &y, optional_ref< const U > movedFromPostConstruction, optional_ref< const U > movedFromPostAssignment)
 Prerequisite: x != y.
 
template<test_mode Mode, pseudoregular T, class U , class V >
requires equivalence_checkable_for_semantics<Mode, T, U> && checkable_against_for_semantics<Mode, T, V>
void sequoia::testing::check_semantics (std::string description, test_logger< Mode > &logger, const T &x, const T &y, const U &xEquivalent, const U &yEquivalent, optional_ref< const V > movedFromPostConstruction, optional_ref< const V > movedFromPostAssignment)
 
template<test_mode Mode, pseudoregular T, class U >
requires std::totally_ordered<T> && checkable_against_for_semantics<Mode, T, U>
void sequoia::testing::check_semantics (std::string description, test_logger< Mode > &logger, const T &x, const T &y, optional_ref< const U > movedFromPostConstruction, optional_ref< const U > movedFromPostAssignment, std::weak_ordering order)
 Prerequisite: x != y with values consistent with order.
 
template<test_mode Mode, pseudoregular T, class U , class V >
requires std::totally_ordered<T> && equivalence_checkable_for_semantics<Mode, T, U> && checkable_against_for_semantics<Mode, T, V>
void sequoia::testing::check_semantics (std::string description, test_logger< Mode > &logger, const T &x, const T &y, const U &xEquivalent, const U &yEquivalent, optional_ref< const V > movedFromPostConstruction, optional_ref< const V > movedFromPostAssignment, std::weak_ordering order)
 
template<test_mode Mode, pseudoregular T, class U , std::invocable< T & > Mutator>
requires checkable_against_for_semantics<Mode, T, U>
void sequoia::testing::check_semantics (std::string description, test_logger< Mode > &logger, const T &x, const T &y, optional_ref< const U > movedFromPostConstruction, optional_ref< const U > movedFromPostAssignment, Mutator yMutator)
 Prerequisite: x != y.
 
template<test_mode Mode, pseudoregular T, class U , class V , std::invocable< T & > Mutator>
requires equivalence_checkable_for_semantics<Mode, T, U> && checkable_against_for_semantics<Mode, T, V>
void sequoia::testing::check_semantics (std::string description, test_logger< Mode > &logger, const T &x, const T &y, const U &xEquivalent, const U &yEquivalent, optional_ref< const V > movedFromPostConstruction, optional_ref< const V > movedFromPostAssignment, Mutator yMutator)
 
template<test_mode Mode, pseudoregular T, class U , std::invocable< T & > Mutator>
requires std::totally_ordered<T> && checkable_against_for_semantics<Mode, T, U>
void sequoia::testing::check_semantics (std::string description, test_logger< Mode > &logger, const T &x, const T &y, optional_ref< const U > movedFromPostConstruction, optional_ref< const U > movedFromPostAssignment, std::weak_ordering order, Mutator yMutator)
 Prerequisite: x != y, with values consistent with order.
 
template<test_mode Mode, pseudoregular T, class U , class V , std::invocable< T & > Mutator>
requires std::totally_ordered<T> && equivalence_checkable_for_semantics<Mode, T, U> && checkable_against_for_semantics<Mode, T, V>
void sequoia::testing::check_semantics (std::string description, test_logger< Mode > &logger, const T &x, const T &y, const U &xEquivalent, const U &yEquivalent, optional_ref< const V > movedFromPostConstruction, optional_ref< const V > movedFromPostAssignment, std::weak_ordering order, Mutator yMutator)
 

Detailed Description

Functions for checking regular semantics.

Types exhibiting regular semantics are pleasant to reason about. Within this library, a type is regular if it exhibits the following:

copy constructor move constructor copy assignment move assignment swap operator== operator!=

Note that a default constructor is not a strict requirement. To distinguish this Concept from std::regular, the Concept pseudoregular is used. Types additionally possessing the remaining comparison operators will be referred to as being std::totally_ordered.

This file adds functions to the check_semantics overload set: they are appropriate for testing the behaviour of types with regular/std::totally_ordered semantics. Inside the functions, consistency of the operators listed above will be checked. One of the overloads also accepts a mutator. This will modify a copy of y, checking both that the copy is indeed changed and also that y is left alone. The reason for this is to check that classes which e.g. wrap a pointer have faithful copy semantics. For example, suppose that the copy constructor of vector were incorrectly implemented with the pointer, rather than what it points to, being copied. The mutation check would catch this. There is a similar check for copy assignment.

Function Documentation

◆ check_semantics() [1/4]

template<test_mode Mode, pseudoregular T, class U , class V >
requires equivalence_checkable_for_semantics<Mode, T, U> && checkable_against_for_semantics<Mode, T, V>
void sequoia::testing::check_semantics ( std::string  description,
test_logger< Mode > &  logger,
const T &  x,
const T &  y,
const U &  xEquivalent,
const U &  yEquivalent,
optional_ref< const V >  movedFromPostConstruction,
optional_ref< const V >  movedFromPostAssignment 
)

Prerequisites: x != y x equivalent to xEquivalent y equivalent to yEquivalent

◆ check_semantics() [2/4]

template<test_mode Mode, pseudoregular T, class U , class V , std::invocable< T & > Mutator>
requires equivalence_checkable_for_semantics<Mode, T, U> && checkable_against_for_semantics<Mode, T, V>
void sequoia::testing::check_semantics ( std::string  description,
test_logger< Mode > &  logger,
const T &  x,
const T &  y,
const U &  xEquivalent,
const U &  yEquivalent,
optional_ref< const V >  movedFromPostConstruction,
optional_ref< const V >  movedFromPostAssignment,
Mutator  yMutator 
)

Prerequisites: x != y x equivalent to xEquivalent y equivalent to yEquivalent

◆ check_semantics() [3/4]

template<test_mode Mode, pseudoregular T, class U , class V >
requires std::totally_ordered<T> && equivalence_checkable_for_semantics<Mode, T, U> && checkable_against_for_semantics<Mode, T, V>
void sequoia::testing::check_semantics ( std::string  description,
test_logger< Mode > &  logger,
const T &  x,
const T &  y,
const U &  xEquivalent,
const U &  yEquivalent,
optional_ref< const V >  movedFromPostConstruction,
optional_ref< const V >  movedFromPostAssignment,
std::weak_ordering  order 
)

Prerequisites: x != y, with values consistent with order x equivalent to xEquivalent y equivalent to yEquivalent

◆ check_semantics() [4/4]

template<test_mode Mode, pseudoregular T, class U , class V , std::invocable< T & > Mutator>
requires std::totally_ordered<T> && equivalence_checkable_for_semantics<Mode, T, U> && checkable_against_for_semantics<Mode, T, V>
void sequoia::testing::check_semantics ( std::string  description,
test_logger< Mode > &  logger,
const T &  x,
const T &  y,
const U &  xEquivalent,
const U &  yEquivalent,
optional_ref< const V >  movedFromPostConstruction,
optional_ref< const V >  movedFromPostAssignment,
std::weak_ordering  order,
Mutator  yMutator 
)

Prerequisites: x != y, with values consistent with order x equivalent to xEquivalent y equivalent to yEquivalent