Add mock objects for unit testing
This commit is contained in:
parent
f0c3514884
commit
12cf5c9bae
13
test/inc/mock_i2c.h
Normal file
13
test/inc/mock_i2c.h
Normal file
@ -0,0 +1,13 @@
|
||||
#ifndef __MOCK_I2C_H__
|
||||
#define __MOCK_I2C_H__
|
||||
|
||||
#include <fff.h>
|
||||
|
||||
DEFINE_FFF_GLOBALS;
|
||||
|
||||
DECLARE_FAKE_VALUE_FUNC(int, i2c_open, const struct i2c_bb *);
|
||||
DECLARE_FAKE_VALUE_FUNC(int, i2c_close, const struct i2c_bb *);
|
||||
DECLARE_FAKE_VALUE_FUNC(int, i2c_read, const struct i2c_bb *, uint8_t, char *, unsigned int);
|
||||
DECLARE_FAKE_VALUE_FUNC(int, i2c_write, const struct i2c_bb *, uint8_t, const char *, unsigned int);
|
||||
|
||||
#endif
|
9
test/unit/mock_i2c.c
Normal file
9
test/unit/mock_i2c.c
Normal file
@ -0,0 +1,9 @@
|
||||
#include <stdint.h>
|
||||
#include <mock_i2c.h>
|
||||
|
||||
DEFINE_FFF_GLOBALS;
|
||||
|
||||
DEFINE_FAKE_VALUE_FUNC(int, i2c_open, const struct i2c_bb *);
|
||||
DEFINE_FAKE_VALUE_FUNC(int, i2c_close, const struct i2c_bb *);
|
||||
DEFINE_FAKE_VALUE_FUNC(int, i2c_read, const struct i2c_bb *, uint8_t, char *, unsigned int);
|
||||
DEFINE_FAKE_VALUE_FUNC(int, i2c_write, const struct i2c_bb *, uint8_t, const char *, unsigned int);
|
Loading…
Reference in New Issue
Block a user