Tasty/include/sta/tasty/utils.hpp

58 lines
1.3 KiB
C++

#ifndef STA_TASTY_UTILS_HPP
#define STA_TASTY_UTILS_HPP
#include <sta/config.hpp>
#ifdef STA_DEBUGGING_ENABLED
#include <cstdint>
namespace sta
{
namespace tasty
{
/**
* @brief Initialize Tasty for the test case.
*
*/
void test_init();
/**
* @brief Print a test result via serial.
*
* @param file The file the test case was in.
* @param line The line of the test case.
* @param rslt The result of the test case.
*/
void test_case(const char * file, uint32_t line, bool rslt);
/**
* @brief Send a message signaling the end of a test case.
*
*/
void test_terminate();
} // namespace tasty
} // namespace sta
/**
* @brief Initialize Tasty for the test case.
*
*/
#define STA_TASTY_INIT() ( (void)( sta::tasty::test_init() ) )
/**
* @brief Assert statement for automatic testing using tasty. Sends the test result to the host via serial.
*
*/
#define STA_TASTY_ASSERT(expr) ( (void)( sta::tasty::test_case(__FILE__, __LINE__, expr) ) )
/**
* @brief Send a message signaling the end of a test case.
*
*/
#define STA_TASTY_TERMINATE() ( (void)( sta::tasty::test_terminate() ) )
#endif // STA_DEBUGGING_ENABLED
#endif // STA_TASTY_UTILS_HPP