#include "CppUTest/TestHarness.h"
void fun(void);
void fun(void)
{
}
TEST_GROUP(PointersEqualTest)
{
};
TEST(PointersEqualTest, NULLS)
{
POINTERS_EQUAL(NULL,NULL);
}
TEST(PointersEqualTest, PointerToVariableEqual)
{
int var;
int* var_ptr;
var_ptr = &var;
POINTERS_EQUAL(&var,var_ptr);
}
TEST(PointersEqualTest, FunctionPointerEqual)
{
void (*funPtr)(void);
funPtr = fun;
POINTERS_EQUAL(&fun, funPtr);
}
--------------
Compiling this test gives me:
make -f MakefileCppUTest.mk
compiling PointersEqualTest.cpp
tests/PointersEqualTest.cpp:31:5: error: cast between pointer-to-function and pointer-to-object is an
extension [-Werror,-Wpedantic]
POINTERS_EQUAL(&fun, funPtr);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/mldelibero/tools/cpputest/include/CppUTest/UtestMacros.h:210:5: note: expanded from macro
'POINTERS_EQUAL'
POINTERS_EQUAL_LOCATION((expected), (actual), NULL, __FILE__, __LINE__)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/mldelibero/tools/cpputest/include/CppUTest/UtestMacros.h:216:51: note: expanded from macro
'POINTERS_EQUAL_LOCATION'
{ UtestShell::getCurrent()->assertPointersEqual((void *)expected, (void *)actual, text, file, line); }
^~~~~~~~~~~~~~~~
tests/PointersEqualTest.cpp:31:5: error: cast between pointer-to-function and pointer-to-object is an
extension [-Werror,-Wpedantic]
POINTERS_EQUAL(&fun, funPtr);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/mldelibero/tools/cpputest/include/CppUTest/UtestMacros.h:210:5: note: expanded from macro
'POINTERS_EQUAL'
POINTERS_EQUAL_LOCATION((expected), (actual), NULL, __FILE__, __LINE__)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/mldelibero/tools/cpputest/include/CppUTest/UtestMacros.h:216:69: note: expanded from macro
'POINTERS_EQUAL_LOCATION'
{ UtestShell::getCurrent()->assertPointersEqual((void *)expected, (void *)actual, text, file, line); }
^~~~~~~~~~~~~~
2 errors generated.
make: *** [objs/tests/PointersEqualTest.o] Error 1
-----
Has anyone run into this before?
--
You received this message because you are subscribed to the Google Groups "cpputest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cpputest+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
POINTERS_EQUAL(funPtr, fun);