Version: SMASH-1.5
unittest.h File Reference
#include "assert.h"
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <memory>
#include <sstream>
#include <string>
#include <tuple>
#include <typeinfo>
#include <vector>
#include "../include/smash/fpenvironment.h"
#include "macros.h"
#include "ulp.h"

Go to the source code of this file.

Macros

#define TEST(function_name)
 Defines a test function. More...
 
#define TEST_CATCH(function_name, ExceptionType)
 Same as above, but expects the code to throw an exception of type ExceptionType. More...
 
#define TEST_BEGIN(T, function_name, typelist)
 Tests that should be tested with several types as template parameter can use this macro. More...
 
#define TEST_END
 Test functions created with TEST_BEGIN need to end with TEST_END. More...
 
#define VERIFY(condition)
 Verifies that condition is true. More...
 
#define COMPARE(test_value, reference)
 Verifies that test_value is equal to reference. More...
 
#define COMPARE_ABSOLUTE_ERROR(test_value, reference, allowed_difference)
 Verifies that the difference between test_value and reference is smaller than allowed_difference. More...
 
#define COMPARE_RELATIVE_ERROR(test_value, reference, allowed_relative_difference)
 Verifies that the difference between test_value and reference is smaller than allowed_relative_difference * reference. More...
 
#define FUZZY_COMPARE(test_value, reference)
 Verifies that test_value is equal to reference within a pre-defined distance in units of least precision (ulp). More...
 
#define FAIL()
 Call this to fail a test. More...
 
#define EXPECT_ASSERT_FAILURE(code)
 Wrap code that should fail an assertion with this macro. More...
 

Functions

static void EXPECT_FAILURE ()
 Use this to mark that the failure of a following test is expected. More...