blob: 2a31d9c76a5221b19f4f531918e4464d14bf845e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
/*
* Copyright 2023 jacqueline <me@jacqueline.id.au>
*
* SPDX-License-Identifier: GPL-3.0-only
*/
#include "gpio_expander.hpp"
#include "catch2/catch.hpp"
#include "i2c.hpp"
#include "i2c_fixture.hpp"
namespace drivers {
TEST_CASE("gpio expander", "[integration]") {
I2CFixture i2c;
GpioExpander expander;
SECTION("with() writes when ") {
// Initial value.
expander.Read();
REQUIRE(expander.get_input(GpioExpander::KEY_DOWN) == true);
expander.with(
[&](auto& gpio) { gpio.set_pin(GpioExpander::KEY_DOWN, false); });
expander.Read();
REQUIRE(expander.get_input(GpioExpander::KEY_DOWN) == false);
}
}
} // namespace drivers
|