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

Unit tests for the GPIO driver. More...

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

Macros

#define BANK_NUM(bank)
 

Functions

struct GPIORegsGPIO (const uint8_t bank)
 
void Test_GPIOSetDirection_EdgeCase_ShouldSetRegisterProperly (void)
 
void Test_GPIOSetDirection_DirectionIsInvalid_ShouldNotSetRegister (void)
 
void Test_GPIOSetDirection_BankIsInvalid_ShouldNotSetRegister (void)
 
void Test_GPIOSetDirection_PinIsInvalid_ShouldNotSetRegister (void)
 
void Test_GPIOSetOType_EdgeCase_ShouldSetRegisterProperly (void)
 
void Test_GPIOSetOType_TypeIsInvalid_ShouldNotSetRegister (void)
 
void Test_GPIOSetOType_BankIsInvalid_ShouldNotSetRegister (void)
 
void Test_GPIOSetOType_PinIsInvalid_ShouldNotSetRegister (void)
 
void Test_GPIOSetSpeed_EdgeCase_ShouldSetRegisterProperly (void)
 
void Test_GPIOSetSpeed_SpeedIsInvalid_ShouldNotSetRegister (void)
 
void Test_GPIOSetSpeed_BankIsInvalid_ShouldNotSetRegister (void)
 
void Test_GPIOSetSpeed_PinIsInvalid_ShouldNotSetRegister (void)
 
void Test_GPIOSetPUPD_EdgeCase_ShouldSetRegisterProperly (void)
 
void Test_GPIOSetPUPD_PUPDIsInvalid_ShouldNotSetRegister (void)
 
void Test_GPIOSetPUPD_BankIsInvalid_ShouldNotSetRegister (void)
 
void Test_GPIOSetPUPD_PinIsInvalid_ShouldNotSetRegister (void)
 
void Test_GPIOSetVal_EdgeCase_ShouldSetRegisterProperly (void)
 
void Test_GPIOSetVal_BankIsInvalid_ShouldNotSetRegister (void)
 
void Test_GPIOSetVal_PinIsInvalid_ShouldNotSetRegister (void)
 
void Test_GPIORead_EdgeCase_ShouldSetRegisterProperly (void)
 
void Test_GPIORead_BankIsInvalid_ShouldNotSetRegister (void)
 
void Test_GPIORead_PinIsInvalid_ShouldNotSetRegister (void)
 
void Test_GPIOSetAF_EdgeCase_ShouldSetRegisterProperly (void)
 
void Test_GPIOSetAF_AFIsInvalid_ShouldNotSetRegister (void)
 
void Test_GPIOSetAF_BankIsInvalid_ShouldNotSetRegister (void)
 
void Test_GPIOSetAF_PinIsInvalid_ShouldNotSetRegister (void)
 
void setUp ()
 
void tearDown ()
 
int main (void)
 

Variables

struct GPIORegs test_regs [(GP_BANK_LEN - 'A')+1] = {0}
 

Detailed Description

Unit tests for the GPIO 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)

Macro Definition Documentation

◆ BANK_NUM

#define BANK_NUM ( bank)
Value:
((uint8_t)bank - (uint8_t)'A')