Assertions with C++ support: Cutter Reference Manual

## Assertions with C++ support Assertions with C++ support — Checks that your program works as you expect with C++ support. |

## Functions

#define | cppcut_assert_equal()
#define | cppcut_assert_not_equal()
#define | cppcut_assert_null()
#define | cppcut_assert_not_null()
#define | cppcut_assert_operator()

## Description

## Functions

### cppcut_assert_equal()

    #define             cppcut_assert_equal(expected, actual, ...)

This assertion is a generic method based on template. You can pass any object's reference as `expected` and `actual` .

Passes if `expected` == `actual` .

e.g.:

    1
    2
    3
    cppcut_assert_equal(3, 1 + 2);
    cppcut_assert_equal(3, 1 + 2, cppcut_message("easy expression"));
    cppcut_assert_equal(3, 1 + 2, cppcut_message() << "easy expression"));

#### Parameters

expected | an expected value. |
actual | an actual value. |
... | an optional message. Use `cppcut_message()` for this. |

Since: 1.0.9

### cppcut_assert_not_equal()

    #define             cppcut_assert_not_equal(expected, actual, ...)

This assertion is a generic method based on template. You can pass any object's reference as `expected` and `actual` .

Passes if `expected` != `actual` .

e.g.:

    1
    2
    3
    cppcut_assert_not_equal(3, 3 + 1);
    cppcut_assert_not_equal(3, 3 + 1, cppcut_message("easy expression"));
    cppcut_assert_not_equal(3, 3 + 1, cppcut_message() << "easy expression"));

#### Parameters

expected | an expected value. |
actual | an actual value. |
... | an optional message. Use `cppcut_message()` for this. |

Since: 1.2.0

### cppcut_assert_null()

    #define             cppcut_assert_null(object, ...)

This assertion is a generic method based on template. You can pass any object's pointer as `object` .

Passes if `object` is `NULL`.

e.g.:

    1
    2
    3
    4
    5
    std::string message("hello");
    std::string *not_null_string = &message;
    std::string *null_string = NULL;
    cppcut_assert_null(not_null_string); // fail
    cppcut_assert_null(null_string);     // pass

#### Parameters

object | the object to be checked. |
... | an optional message. Use `cppcut_message()` for this. |

Since: 1.2.0

### cppcut_assert_not_null()

    #define             cppcut_assert_not_null(object, ...)

This assertion is a generic method based on template. You can pass any object's pointer as `object` .

Passes if `object` is not `NULL`.

e.g.:

    1
    2
    3
    4
    5
    std::string message("hello");
    std::string *not_null_string = &message;
    std::string *null_string = NULL;
    cppcut_assert_not_null(not_null_string); // pass
    cppcut_assert_not_null(null_string);     // fail

#### Parameters

object | the object to be checked. |
... | an optional message. Use `cppcut_message()` for this. |

Since: 1.2.0

### cppcut_assert_operator()

    #define             cppcut_assert_operator(lhs, operator, rhs, ...)

This assertion is a generic method based on template. You can pass any object as `lhs` and `rhs` .

Passes if (`lhs` `operator` `rhs` ) is TRUE.

e.g.:

    1
    2
    cppcut_assert_operator(1, <, 2); // pass
    cppcut_assert_operator(1, >, 2); // fail

#### Parameters

lhs | a left hand side value. |
operator | a binary operator. |
rhs | a right hand side value. |
... | an optional message. Use `cppcut_message()` for this. |

Since: 1.2.0