OTest2
A C++ testing framework
Public Member Functions | List of all members
OTest2::LexicographicalAssertion Class Reference

Implementation of lexicographical container assertions. More...

#include <assertionslexi.h>

Inheritance diagram for OTest2::LexicographicalAssertion:
Inheritance graph
[legend]
Collaboration diagram for OTest2::LexicographicalAssertion:
Collaboration graph
[legend]

Public Member Functions

 LexicographicalAssertion (const LexicographicalAssertion &)=delete
 
LexicographicalAssertionoperator= (const LexicographicalAssertion &)=delete
 
template<template< typename, typename > class Compare_, typename IterA_ , typename IterB_ >
bool testAssertLexi (IterA_ begin_a_, IterA_ end_a_, IterB_ begin_b_, IterB_ end_b_)
 
template<template< typename, typename > class Compare_, typename ContainerA_ , typename IterB_ >
bool testAssertLexi (const ContainerA_ &a_, IterB_ begin_b_, IterB_ end_b_)
 
template<template< typename, typename > class Compare_, typename IterA_ , typename ContainerB_ >
bool testAssertLexi (IterA_ begin_a_, IterA_ end_a_, const ContainerB_ &b_)
 
template<template< typename, typename > class Compare_, typename ContainerA_ , typename ContainerB_ >
bool testAssertLexi (const ContainerA_ &a_, const ContainerB_ &b_)
 
 AssertContext (const AssertContext &)=delete
 
 AssertContext (const Context &context_, const std::string &file_, int lineno_, std::initializer_list< const char * > parameters_)
 Ctor. More...
 
- Public Member Functions inherited from OTest2::AssertContext
 AssertContext (const AssertContext &)=delete
 
AssertContextoperator= (const AssertContext &)=delete
 
 AssertContext (const Context &context_, const std::string &file_, int lineno_, std::initializer_list< const char * > parameters_)
 Ctor. More...
 

Additional Inherited Members

- Protected Member Functions inherited from OTest2::AssertContext
 ~AssertContext ()
 Dtor. More...
 
AssertStream enterAssertion (bool result_)
 Enter an assertion. More...
 
bool simpleAssertionImpl (bool condition_, const std::string &message_, bool print_expression_)
 Implementation of a simple assertion. More...
 
const Contextotest2Context () const
 Get the OTest2 context. More...
 

Detailed Description

Implementation of lexicographical container assertions.

The lexicographical assertions check two lists lexicographically. That means that the algorithm takes one item by one item from the both lists. If the items equal the algorithm moves forward. If the they don't the assertion passes or fails according to used comparator.

As the item-wise assertions do the lexicographical assertions use a comparator template. However, these comparators are different than the item-wise ones. They must resolve three relations: less, equal and greater. And the comparator must resolve result for remaining tails of the lists (if one list is a prefix of the other one).

Thus the comparator must implements two functions:

Definition at line 51 of file assertionslexi.h.

Constructor & Destructor Documentation

◆ LexicographicalAssertion()

OTest2::LexicographicalAssertion::LexicographicalAssertion ( const LexicographicalAssertion )
delete

Member Function Documentation

◆ AssertContext() [1/2]

OTest2::AssertContext::AssertContext
delete

◆ AssertContext() [2/2]

OTest2::AssertContext::AssertContext
explicit

Ctor.

Parameters
context_The OTest2 context
file_filename which the assertion is located in
lineno_line number of the assertion
parameters_Array of strings representing the parameters of the assertion. The initializer list is valid just inside one expression as well as the instance of the assertion context is.

Definition at line 31 of file assertcontext.cpp.

◆ operator=()

LexicographicalAssertion& OTest2::LexicographicalAssertion::operator= ( const LexicographicalAssertion )
delete

◆ testAssertLexi() [1/4]

template<template< typename, typename > class Compare_, typename ContainerA_ , typename ContainerB_ >
bool OTest2::LexicographicalAssertion::testAssertLexi ( const ContainerA_ &  a_,
const ContainerB_ &  b_ 
)

Definition at line 179 of file assertionslexiimpl.h.

◆ testAssertLexi() [2/4]

template<template< typename, typename > class Compare_, typename ContainerA_ , typename IterB_ >
bool OTest2::LexicographicalAssertion::testAssertLexi ( const ContainerA_ &  a_,
IterB_  begin_b_,
IterB_  end_b_ 
)

Definition at line 155 of file assertionslexiimpl.h.

◆ testAssertLexi() [3/4]

template<template< typename, typename > class Compare_, typename IterA_ , typename ContainerB_ >
bool OTest2::LexicographicalAssertion::testAssertLexi ( IterA_  begin_a_,
IterA_  end_a_,
const ContainerB_ &  b_ 
)

Definition at line 167 of file assertionslexiimpl.h.

◆ testAssertLexi() [4/4]

template<template< typename, typename > class Compare_, typename IterA_ , typename IterB_ >
bool OTest2::LexicographicalAssertion::testAssertLexi ( IterA_  begin_a_,
IterA_  end_a_,
IterB_  begin_b_,
IterB_  end_b_ 
)

Definition at line 146 of file assertionslexiimpl.h.


The documentation for this class was generated from the following files: