CppCutter 3 CUTTER Library
CppCutter Cutter with C++ support.

## Synopsis

    #define             CPPCUTTER_ENABLED
    #define             CPPCUT_BEGIN_TEST_DECLS
    #define             CPPCUT_END_TEST_DECLS
    #define             cppcut_message                      (...)

## Description

CppCutter provides C++ friendly interface of Cutter. If you want to write tests with C++, it's good idea that you consider CppCutter to be used too.

It's easy to use CppCutter. You just include <cppcutter.h> instead of <cutter.h> and use cppcutter.pc instead of cutter.pc:

test-xxx.cpp:

    -#include <cutter.h>
    +#include <cppcutter.h>

configure.ac:

    -AC_CHECK_CUTTER
    +AC_CHECK_CPPCUTTER

Makefile.am:

    -XXX_CFLAGS = $(CUTTER_CFLAGS)
    -XXX_LIBS = $(CUTTER_LIBS)
    +XXX_CFLAGS = $(CPPCUTTER_CFLAGS)
    +XXX_LIBS = $(CPPCUTTER_LIBS)

Test functions are defined in namespace. Naming convention is the same as Cutter. i.e.: 'test_...' function is test function, 'setup' or 'cut_setup' is setup function and 'teardown' or 'cut_teardown' is teardown function.

test-calc.cpp:

    #include <cppcutter.h>

    namespace calc
    {
        void
        test_add (void)
        {
            cppcut_assert_equal(3, calc.add(1, 2));
        }

        void
        test_sub (void)
        {
            cppcut_assert_equal(5, calc.sub(9, 4));
        }
    }

You just define a function for adding a new test. You don't need to use magical macros.

## Details

### CPPCUTTER_ENABLED

    #define CPPCUTTER_ENABLED 1

Defined when CppCutter is enabled.

Since 1.0.9

CPPCUTTER_ENABLED

### CPPCUT_BEGIN_TEST_DECLS

    #define CPPCUT_BEGIN_TEST_DECLS extern "C" {

`CPPCUT_BEGIN_TEST_DECLS` has been deprecated since version 1.1.0 and should not be used in newly-written code. Use namespace instead.

Use `CPPCUT_BEGIN_TEST_DECLS` and `CPPCUT_END_TEST_DECLS` pair for prototype declarations for test functions:

    CPPCUT_BEGIN_TEST_DECLS
    void test_add ();
    void test_remove ();
    CPPCUT_END_TEST_DECLS

Those macros just surround prototype declarations for test functions with 'extern "C" {...}'.

Since 1.0.9

CPPCUT_BEGIN_TEST_DECLS
CPPCUT_BEGIN_TEST_DECLS

### CPPCUT_END_TEST_DECLS

    #define CPPCUT_END_TEST_DECLS }

`CPPCUT_END_TEST_DECLS` has been deprecated since version 1.1.0 and should not be used in newly-written code. Use namespace instead.

See `CPPCUT_BEGIN_TEST_DECLS`.

Since 1.0.9

CPPCUT_END_TEST_DECLS
CPPCUT_END_TEST_DECLS

### cppcut_message()

    #define             cppcut_message(...)

Specifies optional assertion message with C++ friendly API. The optional message can be specified with `printf()` style API or "<<" stream style API.

e.g.:

    cppcut_assert_equal("abc", "def",
                        cppcut_message("should fail!"));
    cppcut_assert_equal("abc", "def",
                        cppcut_message() << "should fail!");

... :

  the parameters to insert into the format string.

Returns :

Since 1.1.0

cppcut_message

## See Also

Assertions with C++ support