My Project
Classes | Functions
ut.hpp File Reference
#include "color.hpp"
#include "debug.hpp"
#include "discard.hpp"
#include "exit_code.hpp"
#include "main.hpp"
#include "source_location.hpp"
#include "string_view.hpp"
#include <stdlib.h>

Go to the source code of this file.

Classes

class  bsl::ut_scenario
 Defines a unit test scenario. A scenario defines a user story, describing the "scenario" being tested. A scenario should be paired with ut_given, ut_when and ut_then to define the scenario in english. More...
 
class  bsl::ut_given
 Defines the initial state of a unit test scenario including the creation of any objects that might participate in the unit test. More...
 
class  bsl::ut_when
 Defines the "action" of a unit test scenario. More...
 
class  bsl::ut_then
 Defines the expected "result" of a unit test scenario. More...
 

Functions

void bsl::details::ut_print_here (sloc_type const &sloc) noexcept
 Prints the current source location to the console. More...
 
constexpr bsl::exit_code bsl::ut_success () noexcept
 Outputs a message and returns bsl::exit_success. More...
 
void bsl::ut_check_failed () noexcept
 This is a non-constexpr function that can be used to detect when a unit test check fails. If this function is called at compile-time, it will not compile, resulting in a human readable error message.
 
constexpr bool bsl::ut_check (bool const test, sloc_type const &sloc=here()) noexcept
 Checks to see if "test" is true. If test is false, this function will exit fast with a failure code. More...
 

Detailed Description

Function Documentation

◆ ut_print_here()

void bsl::details::ut_print_here ( sloc_type const &  sloc)
inlinenoexcept

Prints the current source location to the console.

Parameters
slocthe current source location to print

◆ ut_success()

constexpr bsl::exit_code bsl::ut_success ( )
noexcept

Outputs a message and returns bsl::exit_success.

Returns
returns bsl::exit_success

◆ ut_check()

constexpr bool bsl::ut_check ( bool const  test,
sloc_type const &  sloc = here() 
)
noexcept

Checks to see if "test" is true. If test is false, this function will exit fast with a failure code.

Parameters
testif test is true, this function returns true. If test is false, this function will exit fast with a failure code.
slocused to identify the location in the unit test that a check failed.
Returns
returns test