2019-07-18 14:26:03 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <time.h>
|
|
|
|
#include <sys/syscall.h>
|
|
|
|
|
|
|
|
#include <utest.h>
|
2019-07-29 10:34:19 +00:00
|
|
|
#include <mock_gpio.h>
|
2019-07-18 14:26:03 +00:00
|
|
|
|
2019-07-29 13:26:14 +00:00
|
|
|
#include <i2c.h>
|
2019-07-18 14:26:03 +00:00
|
|
|
|
|
|
|
UTEST(i2c_close, success)
|
|
|
|
{
|
|
|
|
struct i2c_bb i2x_obj;
|
|
|
|
|
|
|
|
gpio_close_fake.return_val = EXIT_SUCCESS;
|
|
|
|
ASSERT_EQ(i2c_close(&i2x_obj), EXIT_SUCCESS);
|
|
|
|
}
|
|
|
|
|
|
|
|
UTEST(i2c_close, failure)
|
|
|
|
{
|
|
|
|
struct i2c_bb i2x_obj;
|
|
|
|
|
|
|
|
gpio_close_fake.return_val = EXIT_FAILURE;
|
|
|
|
ASSERT_EQ(i2c_close(&i2x_obj), EXIT_FAILURE);
|
|
|
|
}
|