1
0
mirror of https://github.com/esphome/esphome.git synced 2025-11-20 00:35:44 +00:00
Files
esphome/tests/components
Claude b85c98abb4 [tcal6416] Add support for TCAL6416 I2C I/O expander
Implements support for the TI TCAL6416 16-bit I2C I/O expander with the following features:
- 16 GPIO pins (2 banks of 8)
- Bidirectional I/O with configurable input/output modes
- Support for inverted pins
- Compatible with ESP32, ESP8266, and RP2040 platforms
- I2C interface with configurable address (default: 0x20)

The TCAL6416 provides higher current latched outputs suitable for directly
driving LEDs or keypads. It operates at voltages from 1.08V to 3.6V and
supports I2C speeds up to 1MHz.

Addresses: https://github.com/orgs/esphome/discussions/3233
2025-11-17 22:43:46 +00:00
..
2025-09-26 08:53:21 +12:00
2025-11-03 18:29:30 -06:00

How to write C++ ESPHome unit tests

  1. Locate the folder with your component or create a new one with the same name as the component.
  2. Write the tests. You can add as many .cpp and .h files as you need to organize your tests.

IMPORTANT: wrap all your testing code in a unique namespace to avoid linker collisions when compiling testing binaries that combine many components. By convention, this unique namespace is esphome::component::testing (where "component" is the component under test), for example: esphome::uart::testing.

Running component unit tests

(from the repository root)

./script/cpp_unit_test.py component1 component2 ...

The above will compile and run the provided components and their tests.

To run all tests, you can invoke cpp_unit_test.py with the special --all flag:

./script/cpp_unit_test.py --all

To run a specific test suite, you can provide a Google Test filter:

GTEST_FILTER='UART*' ./script/cpp_unit_test.py uart modbus

The process will return 0 for success or nonzero for failure. In case of failure, the errors will be printed out to the console.