34 inline void assert_bool_with_log(std::string assert_name,
bool v, std::string log) {
44 [[deprecated(
"Please use the supplied testing macros instead")]]
51 std::move(assert_name),
52 "failed assert location : " + loc.format_one_line()});
56 template<
class T1,
class T2>
57 [[deprecated(
"Please use the supplied testing macros instead")]]
62 std::string comment =
"";
65 comment =
"left=" + std::to_string(a) +
" right=" + std::to_string(b);
72 template<
class Acca,
class Accb>
73 [[deprecated(
"Please use the supplied testing macros instead")]]
75 std::string assert_name,
82 std::string comment =
"";
84 for (
u32 i = 0; i < len; i++) {
85 t = t && (acc_a[i] == acc_b[i]);
89 comment +=
"left : \n";
91 comment +=
"right : \n";
107 [[deprecated(
"Please use the supplied testing macros instead")]]
110 f64 diff = sycl::fabs(a - b);
113 std::string comment =
"";
116 comment =
"left=" + std::to_string(a) +
" right=" + std::to_string(b)
117 +
" diff=" + std::to_string(diff);
125 std::string assert_name,
135 void serialize(std::basic_stringstream<byte> &stream);
137 static TestAssertList
deserialize(std::basic_stringstream<byte> &reader);
double f64
Alias for double.
std::uint32_t u32
32 bit unsigned integer
std::string format_array(const It &iter, u32 len, u32 column_count, fmt::format_string< Tformat... > fmt)
Format an array of elements into a string.
implementation details of the test library
provide information about the source location
std::string format_multiline() const
format the location in multiple lines
Class to hold the list of assertion related to a test.
static TestAssertList deserialize(std::basic_stringstream< byte > &reader)
DeSerialize the assertion from binary format.
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.
u32 get_assert_success_count()
Get the number of successful assertions.
void assert_equal(std::string assert_name, T1 a, T2 b, SourceLocation loc=SourceLocation{})
Test for an equality.
void serialize(std::basic_stringstream< byte > &stream)
Serialize the assertion in binary format.
u32 get_assert_count()
Get number of assertion in the list.
std::string serialize_json()
Serialize the assertion in JSON.
void assert_bool(std::string assert_name, bool v, SourceLocation loc=SourceLocation{})
Test if the supplied boolean is true.
static std::string gen_comment(std::string s, SourceLocation loc)
Append the source location to the the supplied string to generate a comment.
std::vector< TestAssert > asserts
List of assertion held by the class.
void assert_add_comment(std::string assert_name, bool v, std::string comment, SourceLocation loc=SourceLocation{})
add an assertion with a comment
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.