HF Interface Wrapper 0.1.0-dev
Embedded C++ hardware abstraction layer
Loading...
Searching...
No Matches
UartComprehensiveTest.cpp File Reference

Comprehensive UART testing suite for ESP32-C6 DevKit-M-1 (noexcept) More...

#include "TestFramework.h"
#include "base/BaseUart.h"
#include "mcu/esp32/EspGpio.h"
#include "mcu/esp32/EspUart.h"
#include "mcu/esp32/utils/EspTypes_UART.h"
#include "driver/uart.h"
#include "soc/uart_reg.h"
Include dependency graph for UartComprehensiveTest.cpp:

Functions

bool test_uart_construction () noexcept
 
bool test_uart_initialization () noexcept
 
bool test_uart_basic_communication () noexcept
 
bool test_uart_baud_rate_configuration () noexcept
 
bool test_uart_flow_control () noexcept
 
bool test_uart_pattern_detection () noexcept
 
bool test_uart_buffer_operations () noexcept
 
bool test_uart_advanced_features () noexcept
 
bool test_uart_communication_modes () noexcept
 
bool test_uart_async_operations () noexcept
 
bool test_uart_callbacks () noexcept
 
bool test_uart_statistics_diagnostics () noexcept
 
bool test_uart_printf_support () noexcept
 
bool test_uart_error_handling () noexcept
 
bool test_uart_esp32c6_features () noexcept
 
bool test_uart_performance () noexcept
 
bool test_uart_callback_verification () noexcept
 
bool test_uart_user_event_task () noexcept
 
bool test_uart_event_driven_pattern_detection () noexcept
 
bool test_uart_cleanup () noexcept
 
bool uart_event_callback (const hf_uart_event_t *event, void *user_data) noexcept
 
bool uart_break_callback (hf_u32_t break_duration, void *user_data) noexcept
 
static void user_uart_event_task (void *arg) noexcept
 
bool flush_uart_buffers (EspUart *uart) noexcept
 Flush UART buffers before each test to ensure clean test isolation.
 
hf_uart_config_t create_test_config (hf_u8_t port=TEST_UART_PORT_1) noexcept
 
bool verify_uart_state (EspUart &uart, bool should_be_initialized) noexcept
 
void app_main (void)
 

Variables

static const char * TAG = "UART_Test"
 
static TestResults g_test_results
 
static constexpr hf_u8_t TEST_UART_PORT_1 = 1
 
static constexpr hf_u32_t TEST_BAUD_RATE = 115200
 
static constexpr hf_u8_t TEST_TX_PIN = 5
 
static constexpr hf_u8_t TEST_RX_PIN = 4
 
static constexpr hf_u8_t TEST_RTS_PIN = 6
 
static constexpr hf_u8_t TEST_CTS_PIN = 7
 
static const uint8_t TEST_PATTERN = 0x0A
 
static constexpr hf_u16_t TEST_BUFFER_SIZE = 256
 
static bool g_event_callback_triggered = false
 
static bool g_break_callback_triggered = false
 
static TaskHandle_t g_user_event_task_handle = nullptr
 
static bool g_pattern_detected = false
 
static int g_pattern_position = -1
 
static bool g_stop_event_task = false
 
static constexpr bool ENABLE_CORE_TESTS = true
 
static constexpr bool ENABLE_BASIC_TESTS = true
 
static constexpr bool ENABLE_ADVANCED_TESTS
 
static constexpr bool ENABLE_CALLBACK_TESTS
 
static constexpr bool ENABLE_ESP_SPECIFIC_TESTS = true
 
static constexpr bool ENABLE_EVENT_TESTS = true
 
static constexpr bool ENABLE_CLEANUP_TESTS = true
 

Detailed Description

Comprehensive UART testing suite for ESP32-C6 DevKit-M-1 (noexcept)

This file contains a dedicated, comprehensive test suite for the EspUart class targeting ESP32-C6 with ESP-IDF v5.5+. It provides thorough testing of all UART functionalities including basic operations, async communication, flow control, advanced features, callbacks, and hardware-specific capabilities.

All functions are noexcept - no exception handling used.

Author
Nebiyu Tadesse
Date
2025

Function Documentation

◆ app_main()

void app_main ( void )

◆ create_test_config()

hf_uart_config_t create_test_config ( hf_u8_t port = TEST_UART_PORT_1)
noexcept

◆ flush_uart_buffers()

bool flush_uart_buffers ( EspUart * uart)
noexcept

Flush UART buffers before each test to ensure clean test isolation.

Parameters
uartUART instance to flush
Returns
true if flush successful, false otherwise

◆ test_uart_advanced_features()

bool test_uart_advanced_features ( )
noexcept

◆ test_uart_async_operations()

bool test_uart_async_operations ( )
noexcept

◆ test_uart_basic_communication()

bool test_uart_basic_communication ( )
noexcept

◆ test_uart_baud_rate_configuration()

bool test_uart_baud_rate_configuration ( )
noexcept

◆ test_uart_buffer_operations()

bool test_uart_buffer_operations ( )
noexcept

◆ test_uart_callback_verification()

bool test_uart_callback_verification ( )
noexcept

◆ test_uart_callbacks()

bool test_uart_callbacks ( )
noexcept

◆ test_uart_cleanup()

bool test_uart_cleanup ( )
noexcept

◆ test_uart_communication_modes()

bool test_uart_communication_modes ( )
noexcept

◆ test_uart_construction()

bool test_uart_construction ( )
noexcept

◆ test_uart_error_handling()

bool test_uart_error_handling ( )
noexcept

◆ test_uart_esp32c6_features()

bool test_uart_esp32c6_features ( )
noexcept

◆ test_uart_event_driven_pattern_detection()

bool test_uart_event_driven_pattern_detection ( )
noexcept

◆ test_uart_flow_control()

bool test_uart_flow_control ( )
noexcept

◆ test_uart_initialization()

bool test_uart_initialization ( )
noexcept

◆ test_uart_pattern_detection()

bool test_uart_pattern_detection ( )
noexcept

◆ test_uart_performance()

bool test_uart_performance ( )
noexcept

◆ test_uart_printf_support()

bool test_uart_printf_support ( )
noexcept

◆ test_uart_statistics_diagnostics()

bool test_uart_statistics_diagnostics ( )
noexcept

◆ test_uart_user_event_task()

bool test_uart_user_event_task ( )
noexcept

◆ uart_break_callback()

bool uart_break_callback ( hf_u32_t break_duration,
void * user_data )
noexcept

◆ uart_event_callback()

bool uart_event_callback ( const hf_uart_event_t * event,
void * user_data )
noexcept

◆ user_uart_event_task()

static void user_uart_event_task ( void * arg)
staticnoexcept

◆ verify_uart_state()

bool verify_uart_state ( EspUart & uart,
bool should_be_initialized )
noexcept

Variable Documentation

◆ ENABLE_ADVANCED_TESTS

constexpr bool ENABLE_ADVANCED_TESTS
staticconstexpr
Initial value:
=
true

◆ ENABLE_BASIC_TESTS

constexpr bool ENABLE_BASIC_TESTS = true
staticconstexpr

◆ ENABLE_CALLBACK_TESTS

constexpr bool ENABLE_CALLBACK_TESTS
staticconstexpr
Initial value:
=
true

◆ ENABLE_CLEANUP_TESTS

constexpr bool ENABLE_CLEANUP_TESTS = true
staticconstexpr

◆ ENABLE_CORE_TESTS

constexpr bool ENABLE_CORE_TESTS = true
staticconstexpr

◆ ENABLE_ESP_SPECIFIC_TESTS

constexpr bool ENABLE_ESP_SPECIFIC_TESTS = true
staticconstexpr

◆ ENABLE_EVENT_TESTS

constexpr bool ENABLE_EVENT_TESTS = true
staticconstexpr

◆ g_break_callback_triggered

bool g_break_callback_triggered = false
static

◆ g_event_callback_triggered

bool g_event_callback_triggered = false
static

◆ g_pattern_detected

bool g_pattern_detected = false
static

◆ g_pattern_position

int g_pattern_position = -1
static

◆ g_stop_event_task

bool g_stop_event_task = false
static

◆ g_test_results

TestResults g_test_results
static

◆ g_user_event_task_handle

TaskHandle_t g_user_event_task_handle = nullptr
static

◆ TAG

const char* TAG = "UART_Test"
static

◆ TEST_BAUD_RATE

constexpr hf_u32_t TEST_BAUD_RATE = 115200
staticconstexpr

◆ TEST_BUFFER_SIZE

constexpr hf_u16_t TEST_BUFFER_SIZE = 256
staticconstexpr

◆ TEST_CTS_PIN

constexpr hf_u8_t TEST_CTS_PIN = 7
staticconstexpr

◆ TEST_PATTERN

const uint8_t TEST_PATTERN = 0x0A
static

◆ TEST_RTS_PIN

constexpr hf_u8_t TEST_RTS_PIN = 6
staticconstexpr

◆ TEST_RX_PIN

constexpr hf_u8_t TEST_RX_PIN = 4
staticconstexpr

◆ TEST_TX_PIN

constexpr hf_u8_t TEST_TX_PIN = 5
staticconstexpr

◆ TEST_UART_PORT_1

constexpr hf_u8_t TEST_UART_PORT_1 = 1
staticconstexpr