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

#include "unity.h"
#include "adc.hpp"

extern "C" {

void setUp(void)
{
    // Set up test fixtures before each test
}

void tearDown(void)
{
    // Clean up test fixtures after each test
}

/**
 * @brief Test ADC initialization
 */
void test_adc_initialize(void)
{
    Adc adc;
    bool result = adc.initialize();
    TEST_ASSERT_TRUE(result);
    TEST_ASSERT_TRUE(adc.isInitialized());
}

/**
 * @brief Test ADC deinitialize
 */
void test_adc_deinitialize(void)
{
    Adc adc;
    adc.initialize();
    
    bool result = adc.deinitialize();
    TEST_ASSERT_TRUE(result);
    TEST_ASSERT_FALSE(adc.isInitialized());
}

/**
 * @brief Test ADC read voltage without initialization
 */
void test_adc_read_voltage_not_initialized(void)
{
    Adc adc;
    int32_t result = adc.readVoltage(AdcChannel::CHANNEL_0, AdcAttenuation::ATTEN_0dB);
    TEST_ASSERT_EQUAL(-1, result);
}

/**
 * @brief Test ADC read raw without initialization
 */
void test_adc_read_raw_not_initialized(void)
{
    Adc adc;
    int32_t result = adc.readRaw(AdcChannel::CHANNEL_0, AdcAttenuation::ATTEN_0dB);
    TEST_ASSERT_EQUAL(-1, result);
}

} // extern "C"

