Loading...
Searching...
No Matches
testlib.hpp File Reference

A small test library. More...

`#include "utils.hpp"`
`#include <armadillo>`
`#include <string>`
`#include <type_traits>`

Go to the source code of this file.

## Macros

#define | ASSERT(expr, msg) details::m_assert(expr, #expr, __METHOD_NAME__, __FILE__, __LINE__, msg)
| A prettier assertion function.

## Functions

void | details::m_assert (bool expr, std::string expr_str, std::string func, std::string file, int line, std::string msg)
| Test an expression, confirm that test is ok, or abort execution.

## Detailed Description

A small test library.

Author
  Cory Alexander Balaton (coryab)
  Janita Ovidie Sandtrøen Willumsen (janitaws)

Version
  1.0

This a small testing library that is tailored for the needs of the project. Anything that is in the details namespace should not be used directly, or else it might cause undefined behavior if not used correctly.

Bug:
  No known bugs

Definition in file testlib.hpp.

## Macro Definition Documentation

## ASSERT

#define ASSERT | ( |  | expr,
|  |  | msg
| ) |  | details::m_assert(expr, #expr, __METHOD_NAME__, __FILE__, __LINE__, msg)

A prettier assertion function.

This macro calls the m_assert function which is a more informative assertion function than the regular assert function from cassert.

Definition at line 31 of file testlib.hpp.

## Function Documentation

## m_assert()

void details::m_assert | ( | bool | expr,
|  | std::string | expr_str,
|  | std::string | func,
|  | std::string | file,
|  | int | line,
|  | std::string | msg
| ) |  |

Test an expression, confirm that test is ok, or abort execution.

This function takes in an expression and prints an OK message if it's true, or it prints a fail message and aborts execution if it fails.

Parameters

  expr | The expression to be evaluated
  expr_str | The stringified version of the expression
  func | The function name of the caller
  file | The file of the caller
  line | The line number where this function is called from
  msg | The message to be displayed

Definition at line 15 of file testlib.cpp.