You've already forked bitshift-validate
110 lines
2.4 KiB
C++
110 lines
2.4 KiB
C++
#ifndef bitshift__validate__test_case_hxx_
|
|
#define bitshift__validate__test_case_hxx_
|
|
|
|
#include <bitshift/validate/types.hxx>
|
|
|
|
#include <bitshift/validate/intrusive-list.hxx>
|
|
|
|
namespace bitshift::validate
|
|
{
|
|
|
|
class test_case
|
|
: intrusive_list<test_case>
|
|
{
|
|
friend intrusive_list<test_case>;
|
|
|
|
public:
|
|
/// @brief Constructor.
|
|
///
|
|
/// @param name The name of the test case.
|
|
/// @param description A description of the test case.
|
|
/// @param file The file in which the test case function is defined.
|
|
/// @param line The line on which the test case function is defined.
|
|
/// @param func The test case function.
|
|
///
|
|
test_case(string name,
|
|
string description,
|
|
string file,
|
|
int line,
|
|
function<void()> func);
|
|
|
|
/// @brief Copy-construction is disabled.
|
|
///
|
|
test_case(test_case const&) = delete;
|
|
|
|
/// @brief Move-construction is disabled.
|
|
///
|
|
test_case(test_case&&) = delete;
|
|
|
|
/// @brief Destructor.
|
|
///
|
|
~test_case() noexcept;
|
|
|
|
/// @brief Get the name of the test case.
|
|
///
|
|
string const&
|
|
name() const;
|
|
|
|
/// @brief Get the description of the test case.
|
|
///
|
|
string const&
|
|
description() const;
|
|
|
|
/// @brief Get the file in which the test case function is defined.
|
|
///
|
|
string const&
|
|
file() const;
|
|
|
|
/// @brief Get the line on which the test case function is defined.
|
|
///
|
|
int
|
|
line() const;
|
|
|
|
/// @brief Get a pointer to the next test case function.
|
|
///
|
|
test_case*
|
|
next();
|
|
|
|
/// @brief Get a pointer to the previous test case function.
|
|
///
|
|
test_case*
|
|
previous();
|
|
|
|
/// @brief Run the test case function.
|
|
///
|
|
void
|
|
run();
|
|
|
|
/// @brief Copy-construction is disabled.
|
|
///
|
|
test_case& operator=(test_case const&) = delete;
|
|
|
|
/// @brief Move-construction is disabled.
|
|
///
|
|
test_case& operator=(test_case&&) = delete;
|
|
|
|
/// @brief Get a pointer to the first test case function.
|
|
///
|
|
static
|
|
test_case*
|
|
first();
|
|
|
|
/// @brief Get a pointer to the last test case function.
|
|
///
|
|
static
|
|
test_case*
|
|
last();
|
|
|
|
private:
|
|
string _name;
|
|
string _description;
|
|
string _file;
|
|
int _line{};
|
|
function<void()> _func;
|
|
|
|
};
|
|
|
|
} // namespace bitshift::validate
|
|
|
|
#endif
|