All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
Public Member Functions | List of all members
hext::ContainsWordsTest Class Referencefinal

Tests whether a string contains all given words. More...

Inheritance diagram for hext::ContainsWordsTest:
Inheritance graph
[legend]
Collaboration diagram for hext::ContainsWordsTest:
Collaboration graph
[legend]

Public Member Functions

 ContainsWordsTest (std::string words)
 Constructs a ContainsWordsTest that succeeds for subjects that contain all words given in a string. More...
 
 ContainsWordsTest (std::vector< std::string > words) noexcept
 Constructs a ContainsWordsTest that succeeds for subjects that contain all words given in a vector. More...
 
bool test (const char *subject) const override
 Returns true if subject contains all given words. More...
 
- Public Member Functions inherited from hext::Cloneable< ContainsWordsTest, ValueTest >
virtual std::unique_ptr
< ValueTest
clone () const
 Clones objects of template type Derived and returns an owning pointer to the newly allocated Base. More...
 
- Public Member Functions inherited from hext::ValueTest
 ValueTest () noexcept=default
 
 ValueTest (const ValueTest &)=default
 
 ValueTest (ValueTest &&) noexcept=default
 
ValueTestoperator= (const ValueTest &)=default
 
ValueTestoperator= (ValueTest &&) noexcept=default
 
virtual ~ValueTest () noexcept=default
 

Detailed Description

Tests whether a string contains all given words.

Word boundaries are the beginning and end of subject, and spaces.

Example:
ContainsWordTest cw("foo baz bar");
assert( cw.test("bar baz foo"));
assert( cw.test("bar boing baz foo boing"));
assert(!cw.test("foobaz bar"));
assert(!cw.test("foo bar"));

Definition at line 43 of file ContainsWordsTest.h.

Constructor & Destructor Documentation

hext::ContainsWordsTest::ContainsWordsTest ( std::string  words)
explicit

Constructs a ContainsWordsTest that succeeds for subjects that contain all words given in a string.

Parameters
wordsA string that contains space-separated words.
hext::ContainsWordsTest::ContainsWordsTest ( std::vector< std::string >  words)
explicitnoexcept

Constructs a ContainsWordsTest that succeeds for subjects that contain all words given in a vector.

Parameters
wordsA vector of words.

Member Function Documentation

bool hext::ContainsWordsTest::test ( const char *  subject) const
overridevirtual

Returns true if subject contains all given words.

Parameters
subjectThe string that is to be tested.

Implements hext::ValueTest.


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