Add unit tests for gpio ftdi driver.

This commit is contained in:
Thomas Klaehn
2019-07-16 16:40:42 +02:00
parent 862ebe5fae
commit 8f5d0dd7f8
11 changed files with 394 additions and 50 deletions

18
test/inc/mock_ftdi.h Normal file
View File

@@ -0,0 +1,18 @@
#ifndef __MOCK_FTDI_H__
#define __MOCK_FTDI_H__
#include <fff.h>
DEFINE_FFF_GLOBALS;
DECLARE_FAKE_VOID_FUNC(ftdi_free, struct ftdi_context *);
DECLARE_FAKE_VALUE_FUNC(int, ftdi_usb_open, struct ftdi_context *, int, int);
DECLARE_FAKE_VALUE_FUNC(int, ftdi_usb_close, struct ftdi_context *);
DECLARE_FAKE_VALUE_FUNC(struct ftdi_context *, ftdi_new);
DECLARE_FAKE_VALUE_FUNC(const char *, ftdi_get_error_string, struct ftdi_context *);
DECLARE_FAKE_VALUE_FUNC(int, ftdi_set_bitmode, struct ftdi_context *, unsigned char, unsigned char);
DECLARE_FAKE_VALUE_FUNC(int, ftdi_read_data, struct ftdi_context *, unsigned char *, int);
DECLARE_FAKE_VALUE_FUNC(int, ftdi_write_data, struct ftdi_context *, const unsigned char *, int);
#endif