Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
wrfz committed Nov 19, 2024
1 parent 9b98053 commit dc01e3b
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions components/daikin_rotex_uart/test/ daikin_rotex_uart_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#include <gtest/gtest.h>
#include "components/daikin_rotex_uart/daikin_rotex_uart.h"

using namespace esphome::daikin_rotex_uart;

TEST(DaikinRotexUART, TestSendData) {
DaikinRotexUART device;
std::vector<uint8_t> data_to_send = {0x01, 0x02, 0x03};

device.send_data(data_to_send);

ASSERT_EQ(data_to_send.size(), 3);
}

TEST(DaikinRotexUART, TestReceiveData) {
DaikinRotexUART device;

std::vector<uint8_t> simulated_received = {0x0A, 0x0B, 0x0C};
for (auto byte : simulated_received) {
device.write(byte);
}

auto received_data = device.receive_data();
ASSERT_EQ(received_data, simulated_received);
}

0 comments on commit dc01e3b

Please sign in to comment.