#include <stdint.h>
#include <assert.h>
// Mock Registers
volatile uint32_t SPI1_CR1 = 0;
volatile uint32_t SPI1_CR2 = 0;
void SPI_Init(void);
void
test_SPI_Init_ShouldInitializeSPIRegisters(void) {
SPI_Init();
assert((SPI1_CR1 & 0x0340) == 0x0340); //
Check if the Mode, Data Size, and other settings are
correct
assert((SPI1_CR2 & 0x0700) == 0x0700); //
Check if the NSSP, SSOE settings are correct
}
int main(void) {
test_SPI_Init_ShouldInitializeSPIRegisters();
return 0;
}#include <stdint.h>
#include <assert.h>
// Mock Registers
volatile uint32_t SPI1_CR1 = 0;
volatile uint32_t SPI1_CR2 = 0;
void SPI_Init(void);
void
test_SPI_Init_ShouldInitializeSPIRegisters(void) {
SPI_Init();
assert((SPI1_CR1 & 0x0340) == 0x0340); //
Check if the Mode, Data Size, and other settings are
correct
assert((SPI1_CR2 & 0x0700) == 0x0700); //
Check if the NSSP, SSOE settings are correct
}
int main(void) {
test_SPI_Init_ShouldInitializeSPIRegisters();
return 0;
}