CMSDK 2.0.1
Cross-platform C++ base library and SDK for the Psyclone AIOS platform
Loading...
Searching...
No Matches
cmlabs::UnitTestRecord Struct Reference

Registration and result record for a single unit test. More...

#include <UnitTestFramework.h>

Collaboration diagram for cmlabs::UnitTestRecord:
[legend]

Public Member Functions

 UnitTestRecord ()
 Default: unregistered, not run, in the default suite.

Public Attributes

std::string name
 Canonical name, used by test=<name>.
std::string description
 One-line human description.
std::string category
 Grouping label (e.g.
UnitTestFunc func
 The test function itself.
bool inDefaultRun
 Included when running the whole suite (test=cmsdk).
bool ran
 True once the runner attempted this test.
bool passed
 Outcome (only meaningful when ran).
uint64 durationUs
 Wall-clock duration in microseconds.
std::string failReason
 Reason set by the test via unittest::fail() (printed immediately).
std::string endNote
 Framework outcome note (timed out / crashed / no test function).
std::vector< UnitTestMetricmetrics
 Metrics recorded via unittest::metric().
std::vector< std::string > detailLog
 Ring of the most recent unittest::detail() lines, kept even when NOT verbose so they can be printed if the test then FAILS.

Detailed Description

Registration and result record for a single unit test.

Definition at line 179 of file UnitTestFramework.h.

Constructor & Destructor Documentation

◆ UnitTestRecord()

cmlabs::UnitTestRecord::UnitTestRecord ( )
inline

Default: unregistered, not run, in the default suite.

Definition at line 203 of file UnitTestFramework.h.

References durationUs, func, inDefaultRun, passed, and ran.

Member Data Documentation

◆ category

std::string cmlabs::UnitTestRecord::category

Grouping label (e.g.

"core")

Definition at line 182 of file UnitTestFramework.h.

Referenced by cmlabs::UnitTestRunner::registerTest().

◆ description

std::string cmlabs::UnitTestRecord::description

One-line human description.

Definition at line 181 of file UnitTestFramework.h.

Referenced by cmlabs::UnitTestRunner::registerTest().

◆ detailLog

std::vector<std::string> cmlabs::UnitTestRecord::detailLog

Ring of the most recent unittest::detail() lines, kept even when NOT verbose so they can be printed if the test then FAILS.

Rationale: detail() used to be dropped entirely unless verbose was on, so an intermittent failure produced a bare reason string and no diagnostics - and re-running to get them is exactly what a 2%-rate flake will not give you. The bakelive GAP4 investigation lost about a day to this. Bounded so a chatty passing test cannot grow unboundedly.

See also
unittest::detail()

Definition at line 200 of file UnitTestFramework.h.

◆ durationUs

uint64 cmlabs::UnitTestRecord::durationUs

Wall-clock duration in microseconds.

Definition at line 189 of file UnitTestFramework.h.

Referenced by UnitTestRecord().

◆ endNote

std::string cmlabs::UnitTestRecord::endNote

Framework outcome note (timed out / crashed / no test function).

Definition at line 191 of file UnitTestFramework.h.

◆ failReason

std::string cmlabs::UnitTestRecord::failReason

Reason set by the test via unittest::fail() (printed immediately).

Definition at line 190 of file UnitTestFramework.h.

Referenced by cmlabs::ut_readChildResult(), and cmlabs::ut_writeChildResult().

◆ func

UnitTestFunc cmlabs::UnitTestRecord::func

The test function itself.

Definition at line 183 of file UnitTestFramework.h.

Referenced by cmlabs::UnitTestRunner::registerTest(), and UnitTestRecord().

◆ inDefaultRun

bool cmlabs::UnitTestRecord::inDefaultRun

Included when running the whole suite (test=cmsdk).

Definition at line 184 of file UnitTestFramework.h.

Referenced by cmlabs::UnitTestRunner::registerTest(), and UnitTestRecord().

◆ metrics

std::vector<UnitTestMetric> cmlabs::UnitTestRecord::metrics

Metrics recorded via unittest::metric().

Definition at line 192 of file UnitTestFramework.h.

Referenced by cmlabs::ut_readChildResult(), and cmlabs::ut_writeChildResult().

◆ name

std::string cmlabs::UnitTestRecord::name

Canonical name, used by test=<name>.

Definition at line 180 of file UnitTestFramework.h.

Referenced by cmlabs::UnitTestRunner::registerTest(), and cmlabs::UnitTestRunner::runOne().

◆ passed

bool cmlabs::UnitTestRecord::passed

Outcome (only meaningful when ran).

Definition at line 188 of file UnitTestFramework.h.

Referenced by UnitTestRecord().

◆ ran

bool cmlabs::UnitTestRecord::ran

True once the runner attempted this test.

Definition at line 187 of file UnitTestFramework.h.

Referenced by UnitTestRecord().


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