mirror of
https://github.com/espressif/esp-idf.git
synced 2025-09-30 19:19:21 +00:00
feat(hal): add util function to reverse a 8bit byte
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
idf_component_register(SRCS "test_app_main.c"
|
||||
"test_calc_clk_div.c"
|
||||
"test_hal_utils_misc.c"
|
||||
INCLUDE_DIRS "."
|
||||
REQUIRES unity hal
|
||||
WHOLE_ARCHIVE)
|
||||
|
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "unity.h"
|
||||
#include "hal/hal_utils.h"
|
||||
|
||||
TEST_CASE("test_hal_utils_bitwise_reverse", "[bit_ops]")
|
||||
{
|
||||
uint8_t input_data[] = {0x00, 0x0F, 0xAA, 0x55, 0xC3};
|
||||
uint8_t expected_data[] = {0x00, 0xF0, 0x55, 0xAA, 0xC3};
|
||||
int num_test_cases = sizeof(input_data) / sizeof(input_data[0]);
|
||||
|
||||
for (int i = 0; i < num_test_cases; i++) {
|
||||
uint8_t result = hal_utils_bitwise_reverse8(input_data[i]);
|
||||
TEST_ASSERT_EQUAL_HEX8(expected_data[i], result);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user