OTest2
A C++ testing framework
|
Implementation of map assertions. More...
#include <assertionsmap.h>
Public Member Functions | |
MapAssertion (const MapAssertion &)=delete | |
MapAssertion & | operator= (const MapAssertion &)=delete |
template<template< typename, typename > class Compare_, typename ContainerA_ , typename ContainerB_ > | |
bool | testAssertMap (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... | |
![]() | |
AssertContext (const AssertContext &)=delete | |
AssertContext & | operator= (const AssertContext &)=delete |
AssertContext (const Context &context_, const std::string &file_, int lineno_, std::initializer_list< const char * > parameters_) | |
Ctor. More... | |
Additional Inherited Members | |
![]() | |
~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 Context & | otest2Context () const |
Get the OTest2 context. More... | |
Implementation of map assertions.
The map assertions check content of map containers in the item-wise manner. Items are paired by their keys.
The default algorithm iterates first and then the second list and checks values in the other list. It's not the most time effective algorithm but it works for ordered maps as well as for unordered maps.
The std::multimap are supported too - items with the same key must keep the same order in both containers.
As the std::unordered_multimap doesn't keep any defined order of items with the same key, the container is supported only in a special case when there are only unique keys inside.
The algorithm is controlled by the MapContainerTrait. The default implementation works with STL-like maps.
Definition at line 48 of file assertionsmap.h.
|
delete |
|
delete |
|
explicit |
Ctor.
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.
|
delete |
bool OTest2::MapAssertion::testAssertMap | ( | const ContainerA_ & | a_, |
const ContainerB_ & | b_ | ||
) |
Definition at line 179 of file assertionsmapimpl.h.