Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
shamtest::details::TestAssertList Struct Reference

Class to hold the list of assertion related to a test. More...

#include <shamtest/details/TestAssertList.hpp>

+ Collaboration diagram for shamtest::details::TestAssertList:

Public Member Functions

void assert_bool_with_log (std::string assert_name, bool v, std::string log)
 
void assert_bool (std::string assert_name, bool v, SourceLocation loc=SourceLocation{})
 Test if the supplied boolean is true.
 
template<class T1 , class T2 >
void assert_equal (std::string assert_name, T1 a, T2 b, SourceLocation loc=SourceLocation{})
 Test for an equality.
 
template<class Acca , class Accb >
void assert_equal_array (std::string assert_name, Acca &acc_a, Accb &acc_b, u32 len, SourceLocation loc=SourceLocation{})
 Assert equal on an array of values.
 
void assert_float_equal (std::string assert_name, f64 a, f64 b, f64 eps, SourceLocation loc=SourceLocation{})
 Add an assertion testing a floating point equality up to precision eps.
 
void assert_add_comment (std::string assert_name, bool v, std::string comment, SourceLocation loc=SourceLocation{})
 add an assertion with a comment
 
std::string serialize_json ()
 Serialize the assertion in JSON.
 
void serialize (std::basic_stringstream< byte > &stream)
 Serialize the assertion in binary format.
 
u32 get_assert_count ()
 Get number of assertion in the list.
 
u32 get_assert_success_count ()
 Get the number of successful assertions.
 

Static Public Member Functions

static std::string gen_comment (std::string s, SourceLocation loc)
 Append the source location to the the supplied string to generate a comment.
 
static TestAssertList deserialize (std::basic_stringstream< byte > &reader)
 DeSerialize the assertion from binary format.
 

Public Attributes

std::vector< TestAssertasserts
 List of assertion held by the class.
 

Detailed Description

Class to hold the list of assertion related to a test.

Definition at line 26 of file TestAssertList.hpp.

Member Function Documentation

◆ assert_add_comment()

void shamtest::details::TestAssertList::assert_add_comment ( std::string  assert_name,
bool  v,
std::string  comment,
SourceLocation  loc = SourceLocation{} 
)
inline

add an assertion with a comment

Definition at line 124 of file TestAssertList.hpp.

◆ assert_bool()

void shamtest::details::TestAssertList::assert_bool ( std::string  assert_name,
bool  v,
SourceLocation  loc = SourceLocation{} 
)
inline

Test if the supplied boolean is true.

Definition at line 45 of file TestAssertList.hpp.

◆ assert_bool_with_log()

void shamtest::details::TestAssertList::assert_bool_with_log ( std::string  assert_name,
bool  v,
std::string  log 
)
inline

Definition at line 34 of file TestAssertList.hpp.

◆ assert_equal()

template<class T1 , class T2 >
void shamtest::details::TestAssertList::assert_equal ( std::string  assert_name,
T1  a,
T2  b,
SourceLocation  loc = SourceLocation{} 
)
inline

Test for an equality.

Definition at line 58 of file TestAssertList.hpp.

◆ assert_equal_array()

template<class Acca , class Accb >
void shamtest::details::TestAssertList::assert_equal_array ( std::string  assert_name,
Acca &  acc_a,
Accb &  acc_b,
u32  len,
SourceLocation  loc = SourceLocation{} 
)
inline

Assert equal on an array of values.

Definition at line 74 of file TestAssertList.hpp.

◆ assert_float_equal()

void shamtest::details::TestAssertList::assert_float_equal ( std::string  assert_name,
f64  a,
f64  b,
f64  eps,
SourceLocation  loc = SourceLocation{} 
)
inline

Add an assertion testing a floating point equality up to precision eps.

Parameters
assert_namename of the assertion
avalue a
bvalue b
epsprecision of the test
locsource location of the call

Definition at line 108 of file TestAssertList.hpp.

◆ deserialize()

TestAssertList shamtest::details::TestAssertList::deserialize ( std::basic_stringstream< byte > &  reader)
static

DeSerialize the assertion from binary format.

Definition at line 42 of file TestAssertList.cpp.

+ Here is the call graph for this function:

◆ gen_comment()

static std::string shamtest::details::TestAssertList::gen_comment ( std::string  s,
SourceLocation  loc 
)
inlinestatic

Append the source location to the the supplied string to generate a comment.

Definition at line 39 of file TestAssertList.hpp.

+ Here is the call graph for this function:

◆ get_assert_count()

u32 shamtest::details::TestAssertList::get_assert_count ( )
inline

Get number of assertion in the list.

Definition at line 140 of file TestAssertList.hpp.

◆ get_assert_success_count()

u32 shamtest::details::TestAssertList::get_assert_success_count ( )
inline

Get the number of successful assertions.

Definition at line 143 of file TestAssertList.hpp.

◆ serialize()

void shamtest::details::TestAssertList::serialize ( std::basic_stringstream< byte > &  stream)

Serialize the assertion in binary format.

Definition at line 38 of file TestAssertList.cpp.

+ Here is the call graph for this function:

◆ serialize_json()

std::string shamtest::details::TestAssertList::serialize_json ( )

Serialize the assertion in JSON.

Definition at line 24 of file TestAssertList.cpp.

+ Here is the call graph for this function:

Member Data Documentation

◆ asserts

std::vector<TestAssert> shamtest::details::TestAssertList::asserts

List of assertion held by the class.

Definition at line 29 of file TestAssertList.hpp.


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