libhext: C++ Library Documentation  1.0.12-3ea013c
Public Member Functions | List of all members
hext::EqualsTest Class Referencefinal

Tests whether a string equals a given literal. More...

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

Public Member Functions

 EqualsTest (std::string literal) noexcept
 Constructs an EqualsTest that succeeds for subjects that equal a given literal. More...
 
bool test (const char *subject) const override
 Returns true if subject equals literal. More...
 
- Public Member Functions inherited from hext::Cloneable< EqualsTest, ValueTest >
virtual std::unique_ptr< ValueTestclone () const override
 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 equals a given literal.

Example:
EqualsTest equals("foo");
assert( equals.test("foo"));
assert(!equals.test("foob"));
assert(!equals.test("bfoo"));
EqualsTest(std::string literal) noexcept
Constructs an EqualsTest that succeeds for subjects that equal a given literal.

Definition at line 41 of file EqualsTest.h.

Constructor & Destructor Documentation

◆ EqualsTest()

hext::EqualsTest::EqualsTest ( std::string  literal)
explicitnoexcept

Constructs an EqualsTest that succeeds for subjects that equal a given literal.

Parameters
literalA string that a subject must equal.

Member Function Documentation

◆ test()

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

Returns true if subject equals literal.

Parameters
subjectThe string that is to be tested.

Implements hext::ValueTest.


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