qxLib
Classes | Public Member Functions | List of all members
qx::expected_assert_builder Class Reference

Selects assertion properties and the number of expected occurrences. More...

#include <expected_assert.h>

Public Member Functions

expected_assert_builder & condition (string_view svCondition, bool bRegex=false)
 Match the failed condition text. More...
 
expected_assert_builder & category (const qx::category &category)
 Require the specified assertion category. More...
 
expected_assert_builder & type (assert_type eType)
 Require the specified assertion type. More...
 
expected_assert_builder & message (string_view svPattern, bool bRegex=false)
 Match the formatted user message. More...
 
expected_assert_builder & function (string_view svFunction, bool bRegex=false)
 Match the function name. More...
 
expected_assert_builder & file (string_view svFile, bool bRegex=false)
 Match the source file name. More...
 
expected_assert_builder & line (i32 nLine)
 Require the exact source line number. More...
 
expected_assert_builder & count (size_t nCount)
 Require exactly this many matching assertions. More...
 
expected_assert build () const
 Start observing assertions using the selected criteria. More...
 

Detailed Description

Selects assertion properties and the number of expected occurrences.

Only specified properties are matched. Strings match exactly unless regex search is enabled; a selected category must outlive the expectation. The default expected count is one.

Author
Khrapov
Date
31.10.2026

Definition at line 37 of file expected_assert.h.

Member Function Documentation

◆ build()

expected_assert qx::expected_assert_builder::build ( ) const
inline

Start observing assertions using the selected criteria.

Returns
- scoped expectation that reports a count mismatch on destruction

Definition at line 82 of file expected_assert.inl.

◆ category()

expected_assert_builder & qx::expected_assert_builder::category ( const qx::category &  category)
inline

Require the specified assertion category.

Parameters
category- expected value

Definition at line 40 of file expected_assert.inl.

◆ condition()

expected_assert_builder & qx::expected_assert_builder::condition ( string_view  svCondition,
bool  bRegex = false 
)
inline

Match the failed condition text.

Parameters
svCondition- expected text or regex pattern
bRegex- search using a regex instead of comparing the complete text

Definition at line 34 of file expected_assert.inl.

◆ count()

expected_assert_builder & qx::expected_assert_builder::count ( size_t  nCount)
inline

Require exactly this many matching assertions.

Parameters
nCount- expected value

Definition at line 76 of file expected_assert.inl.

◆ file()

expected_assert_builder & qx::expected_assert_builder::file ( string_view  svFile,
bool  bRegex = false 
)
inline

Match the source file name.

Parameters
svFile- expected text or regex pattern
bRegex- search using a regex instead of comparing the complete text

Definition at line 64 of file expected_assert.inl.

◆ function()

expected_assert_builder & qx::expected_assert_builder::function ( string_view  svFunction,
bool  bRegex = false 
)
inline

Match the function name.

Parameters
svFunction- expected text or regex pattern
bRegex- search using a regex instead of comparing the complete text

Definition at line 58 of file expected_assert.inl.

◆ line()

expected_assert_builder & qx::expected_assert_builder::line ( i32  nLine)
inline

Require the exact source line number.

Parameters
nLine- expected value

Definition at line 70 of file expected_assert.inl.

◆ message()

expected_assert_builder & qx::expected_assert_builder::message ( string_view  svPattern,
bool  bRegex = false 
)
inline

Match the formatted user message.

Parameters
svPattern- expected text or regex pattern
bRegex- search using a regex instead of comparing the complete text

Definition at line 52 of file expected_assert.inl.

◆ type()

expected_assert_builder & qx::expected_assert_builder::type ( assert_type  eType)
inline

Require the specified assertion type.

Parameters
eType- expected value

Definition at line 46 of file expected_assert.inl.


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