BitShift Validate 0.1.0
BitShift Validate API Reference Documentation
Loading...
Searching...
No Matches
Assertions

Macros

#define BV_TEST_SETUP(desc)
#define BV_TEST_TEARDOWN(desc)
#define BV_TEST(name, desc)
#define BV_IGNORE
#define BV_ASSERT_TRUE(expr)
#define BV_ASSERT_FALSE(expr)
#define BV_ASSERT_NULLPTR(expr)
#define BV_ASSERT_EQUAL(lhs, rhs)
#define BV_ASSERT_NOT_EQUAL(lhs, rhs)

Detailed Description

Describes the BitShift Validate assertion macros.

Macro Definition Documentation

◆ BV_TEST_SETUP

#define BV_TEST_SETUP ( desc)

Register a test setup function.

Parameters
descA description of the setup function.

Usage Example:

BV_TEST_SETUP(setup environment)
{
// ...
}
#define BV_TEST_SETUP(desc)
Register a test setup function.
Definition macro.hxx:40

◆ BV_TEST_TEARDOWN

#define BV_TEST_TEARDOWN ( desc)

Register a test teardown function.

Parameters
descA description of the teardown function.

Usage Example:

BV_TEST_TEARDOWN(cleanup resources)
{
// ...
}
#define BV_TEST_TEARDOWN(desc)
Register a test teardown function.
Definition macro.hxx:69

◆ BV_TEST

#define BV_TEST ( name,
desc )

Register a test function.

Parameters
nameAn identifier for the test.
descA decsription of the test.

Usage Example:

BV_TEST(str.length, "test string length")
{
// ...
}
#define BV_TEST(name, desc)
Register a test function.
Definition macro.hxx:99

◆ BV_IGNORE

#define BV_IGNORE

Ignore a test.

◆ BV_ASSERT_TRUE

#define BV_ASSERT_TRUE ( expr)

Assert a true value.

Parameters
exprThe expression to test.

Usage Example:

BV_TEST(str.empty, "test string 'empty'")
{
std::string empty{};
BV_ASSERT_TRUE(empty.empty());
}
#define BV_ASSERT_TRUE(expr)
Assert a true value.
Definition macro.hxx:123

◆ BV_ASSERT_FALSE

#define BV_ASSERT_FALSE ( expr)

Assert a false value.

Parameters
exprThe expression to test.

Usage Example:

BV_TEST(str.not_empty, "test string not 'empty'")
{
std::string not_empty{"hello, world"};
BV_ASSERT_FALSE(not_empty.empty());
}
#define BV_ASSERT_FALSE(expr)
Assert a false value.
Definition macro.hxx:141

◆ BV_ASSERT_NULLPTR

#define BV_ASSERT_NULLPTR ( expr)

Assert a nullptr value.

Parameters
exprThe expression to test.

Usage Example:

BV_TEST(ptr.is_null, "test null pointer")
{
char const* this_is_null{nullptr};
BV_ASSERT_NULLPTR(this_is_null);
}
#define BV_ASSERT_NULLPTR(expr)
Assert a nullptr value.
Definition macro.hxx:159

◆ BV_ASSERT_EQUAL

#define BV_ASSERT_EQUAL ( lhs,
rhs )

Assert lhs is equal to rhs.

Parameters
lhsThe left-hand side expression to test.
rhsThe right-hand side expression to test.

Usage Example:

BV_TEST(equal, "test equal")
{
int lhs = 1;
int rhs = 1;
BV_ASSERT_EQUAL(lhs, rhs);
}
#define BV_ASSERT_EQUAL(lhs, rhs)
Assert lhs is equal to rhs.
Definition macro.hxx:179

◆ BV_ASSERT_NOT_EQUAL

#define BV_ASSERT_NOT_EQUAL ( lhs,
rhs )

Assert lhs is not equal to rhs.

Parameters
lhsThe left-hand side expression to test.
rhsThe right-hand side expression to test.

Usage Example:

BV_TEST(not_equal, "test not equal")
{
int lhs = 1;
int rhs = 2;
}
#define BV_ASSERT_NOT_EQUAL(lhs, rhs)
Assert lhs is not equal to rhs.
Definition macro.hxx:199