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

Functions for checking semantics of types lacking copy semantics but which are otherwise regular. More...

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

Go to the source code of this file.

Functions

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

Detailed Description

Functions for checking semantics of types lacking copy semantics but which are otherwise regular.

Within this library, a type is defined to have move-only semantics if possesses the following:

move constructor move assignment swap operator== operator!=

but lacks

copy constructor copy assignment

Note that a default constructor is not a strict requirement.

This file adds one function to the check_semantics overload set, inside which consistency of the first list of operators above will be checked. There is an important difference compared to the corresponding overloads for regular semantics. Whereas the latter takes just two instance of T, x and y, in the move-only case 4 are taken. This is because, by definition, we cannot copy x and y and so, to be able to compare to the original values (essential for the mechanics of testing), immutable clones must be supplied.

Function Documentation

◆ check_semantics() [1/2]

template<test_mode Mode, moveonly T, class U , class V >
requires checkable_against_for_semantics<Mode, T, U> && checkable_against_for_semantics<Mode, T, V>
bool sequoia::testing::check_semantics ( std::string  description,
test_logger< Mode > &  logger,
T &&  x,
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/2]

template<test_mode Mode, moveonly T, class U , class V >
requires std::totally_ordered<T> && checkable_against_for_semantics<Mode, T, U> && checkable_against_for_semantics<Mode, T, V>
bool sequoia::testing::check_semantics ( std::string  description,
test_logger< Mode > &  logger,
T &&  x,
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 x equivalent to xEquivalent y equivalent to yEquivalent