Поддельный заголовок
Код: Выделить всё
#pragma once
#include "fff.h"
#include "osdp.h"
DECLARE_FAKE_VALUE_FUNC(osdp_t*, osdp_cp_setup, int, const osdp_pd_info_t *);
DECLARE_FAKE_VOID_FUNC(osdp_cp_teardown, osdp_t *);
...
// List of fakes used by these unit tests
#define FFF_FAKES_LIST(FUNC) \
FUNC(osdp_cp_setup) \
FUNC(osdp_cp_teardown) \
...
Код: Выделить всё
#include "FakeLibosdp.h"
DEFINE_FFF_GLOBALS
DEFINE_FAKE_VALUE_FUNC(osdp_t*, osdp_cp_setup, int, const osdp_pd_info_t *);
DEFINE_FAKE_VOID_FUNC(osdp_cp_teardown, osdp_t *);
...
Код: Выделить всё
#include "FakeLibosdp.h"
#include "MockSerial.hh"
class OsdpPdACRTest : public ::testing::Test {
protected:
void SetUp() {
// Register resets
// Linker can't find _reset function
FFF_FAKES_LIST(RESET_FAKE);
// This also doesn't work
RESET_FAKE(osdp_pd_notify_event);
// Reset common FFF internal structures
FFF_RESET_HISTORY();
}
};
...
Код: Выделить всё
x86_64-buildroot-linux-gnu_sdk-buildroot/bin/../lib/gcc/x86_64-buildroot-linux-gnu/9.3.0/../../../../x86_64-buildroot-linux-gnu/bin/ld: tests/gtests/module/osdp/CMakeFiles/test-osdp.dir/test-osdp-pd-acreader.cc.o: in function `OsdpPdACRTest::SetUp()':
/tests/gtests/module/osdp/test-osdp-pd-acreader.cc:17: undefined reference to `osdp_pd_notify_event_reset()'
Подробнее здесь: https://stackoverflow.com/questions/792 ... rror-for-r