/**
 * @file test_gpio.cpp
 * @brief Unit tests for GPIO wrapper component
 * @author Mahmoud Elmohtady
 * @company Nabd solutions - ASF
 * @copyright Copyright (c) 2025
 */

#include "unity.h"
#include "gpio.hpp"

extern "C" {

void setUp(void)
{
}

void tearDown(void)
{
}

/**
 * @brief Test GPIO configuration
 */
void test_gpio_configure(void)
{
    Gpio gpio;
    bool result = gpio.configure(2, GpioMode::OUTPUT);
    TEST_ASSERT_TRUE(result);
}

/**
 * @brief Test GPIO set level
 */
void test_gpio_set_level(void)
{
    Gpio gpio;
    gpio.configure(2, GpioMode::OUTPUT);
    bool result = gpio.setLevel(2, 1);
    TEST_ASSERT_TRUE(result);
}

/**
 * @brief Test GPIO get level
 */
void test_gpio_get_level(void)
{
    Gpio gpio;
    gpio.configure(2, GpioMode::INPUT);
    int32_t result = gpio.getLevel(2);
    TEST_ASSERT_TRUE(result >= 0);
}

/**
 * @brief Test GPIO ISR installation
 */
void test_gpio_install_isr(void)
{
    Gpio gpio;
    bool result = gpio.installIsr();
    TEST_ASSERT_TRUE(result);
}

} // extern "C"

