microHAL
An abstraction layer for your future F4xx projects
Loading...
Searching...
No Matches
test_adc_driver.c File Reference

Unit tests for the ADC driver. More...

#include <stdint.h>
#include "unity.h"
#include "adc.h"

Functions

struct ADCRegsADC_ (const uint8_t number)
 
void Test_ADCSetPrescaler_EdgeCase_RegisterShouldSetProperly (void)
 
void Test_ADCSetPrescaler_PrescaleIsInvalid_RegisterShouldNotSet (void)
 
void Test_ADCSetResolution_EdgeCase_RegisterShouldSetProperly (void)
 
void Test_ADCSetResolution_ADCIsInvalid_RegisterShouldNotSet (void)
 
void Test_ADCSetResolution_ResolutionIsInvalid_RegisterShouldNotSet (void)
 
void Test_ADCSetSamplerate_EdgeCase_RegisterShouldSetProperly (void)
 
void Test_ADCSetSamplerate_ADCIsInvalid_RegisterShouldNotSet (void)
 
void Test_ADCSetSamplerate_ChannelIsInvalid_RegisterShouldNotSet (void)
 
void Test_ADCSetSamplerate_SamplerateIsInvalid_RegisterShouldNotSet (void)
 
void Test_ADCSetModes_EdgeCase_RegistersShouldSetProperly (void)
 
void Test_ADCSetModes_ADCIsInvalid_RegistersShouldNotSet (void)
 
void Test_ADCSetSeq_EdgeCase_RegistersShouldSetProperly (void)
 
void Test_ADCSetSeq_ADCIsInvalid_RegistersShouldNotSet (void)
 
void Test_ADCSetSeq_SomeSequencesAreInvalid_ShouldClearTheirRegisterBits (void)
 
void Test_ADCSetSeq_CountIsInvalid_ShouldClearItsRegisterBits (void)
 
void Test_ADCOn_EdgeCase_RegisterShouldSetProperly (void)
 
void Test_ADCOn_ADCIsInvalid_RegisterShouldNotSet (void)
 
void Test_ADCOff_EdgeCase_RegisterShouldSetProperly (void)
 
void Test_ADCOff_ADCIsInvalid_RegisterShouldNotSet (void)
 
void Test_ADCRead_EdgeCase_RegisterShouldBeReadProperly (void)
 
void Test_ADCRead_ADCIsInvalid_RegisterShouldNotBeRead (void)
 
void setUp (void)
 
void tearDown (void)
 
int main (void)
 

Variables

struct ADCRegs empty_regs = {0}
 
struct ADCRegs test_regs [ADC_PERIPH_LEN+1]
 
struct ADCCommonRegs empty_cregs = {0}
 
struct ADCCommonRegs test_cregs
 
struct ADCCommonRegsADC_COMMON = &test_cregs
 

Detailed Description

Unit tests for the ADC driver.

The unit tests defined in this file handle mostly invalid parameter and edge cases in a stubbed environment. The purpose of these tests is logic checking and does not reflect the actual behaviour of registers in real MCUs.

Author
Vasileios Ch. (BillisC)