I have started to get to grips with Eclipse CDT and CppUTest.
I can run simple tests OK, but usage of mock cause build errors.
What have I done wrong? I setup eclipse as per this guide
schuchert.wikispaces.com,
MinGw and msys (latest)
CppUTest v3.3
Eclipse Library : "<path>\CPPUTEST\lib."
Eclipse Include "<path>\CPPUTEST\include"
Actual Error:
\Debug/../Tests/mocks.cpp:33: undefined reference to `mock(SimpleString const&)'
Code:
#include <CppUTest/TestHarness.h>
#include <CppUTestExt/MockSupport.h>
using namespace std;
TEST_GROUP(MockDocumentation)
{
void teardown()
{
mock().clear();
}
};
void productionCode()
{
mock().actualCall("productionCode");
}
TEST(MockDocumentation, SimpleScenario)
{
mock().expectOneCall("productionCode");
productionCode();
mock().checkExpectations();
}