#include #include #include #include #include #include #include #include #include UTEST(gpio_read, invalid_params) { ASSERT_EQ(gpio_read(NULL, NULL), EXIT_FAILURE); } UTEST(gpio_read, value_0) { unsigned int result; struct gpio gpio_1; struct ftdi_dev ftdi_obj; ftdi_obj.status_mask = ~0x08; gpio_1.pin = 0x08; gpio_1.ftdi_dev = &ftdi_obj; ASSERT_EQ(gpio_read(&gpio_1, &result), EXIT_SUCCESS); result = ((ftdi_obj.status_mask) & (gpio_1.pin)) >> 3; ASSERT_EQ(result, 0) } UTEST(gpio_read, value_1) { unsigned int result; struct gpio gpio_1; struct ftdi_dev ftdi_obj; ftdi_obj.status_mask = 0x08; gpio_1.pin = 0x08; gpio_1.ftdi_dev = &ftdi_obj; ASSERT_EQ(gpio_read(&gpio_1, &result), EXIT_SUCCESS); result = ((ftdi_obj.status_mask) & (gpio_1.pin)) >> 3; ASSERT_EQ(result, 1) }