114 lines
2.9 KiB
C
114 lines
2.9 KiB
C
#include "unity.h"
|
|
#include "eeprom_m95.h"
|
|
|
|
void setUp(void)
|
|
{
|
|
// Set up code here
|
|
}
|
|
|
|
void tearDown(void)
|
|
{
|
|
// Tear down code here
|
|
}
|
|
|
|
void test_eeprom_m95_read(void)
|
|
{
|
|
// Test case for eeprom_m95_read function
|
|
m95_number_e num = M95_1;
|
|
uint32_t read_addr = 0x0000;
|
|
uint8_t data[10];
|
|
uint16_t length = 10;
|
|
|
|
// Perform the read operation
|
|
eeprom_m95_read(num, read_addr, data, length);
|
|
|
|
// Add assertions here to verify the correctness of the read operation
|
|
TEST_ASSERT_EQUAL_HEX8_ARRAY(expected_data, data, length);
|
|
}
|
|
|
|
void test_eeprom_m95_write(void)
|
|
{
|
|
// Test case for eeprom_m95_write function
|
|
m95_number_e num = M95_1;
|
|
uint32_t write_addr = 0x0000;
|
|
uint8_t data[10] = {0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22, 0x33, 0x44};
|
|
uint16_t length = 10;
|
|
|
|
// Perform the write operation
|
|
eeprom_m95_write(num, write_addr, data, length);
|
|
|
|
// Add assertions here to verify the correctness of the write operation
|
|
// You can perform a subsequent read operation to verify the written data
|
|
}
|
|
|
|
void test_eeprom_m95_enable(void)
|
|
{
|
|
// Test case for eeprom_m95_enable function
|
|
// Perform the enable operation
|
|
eeprom_m95_enable();
|
|
|
|
// Add assertions here to verify the correctness of the enable operation
|
|
// You can check the status of the M95 EEPROM to ensure it is enabled
|
|
}
|
|
|
|
void test_eeprom_m95_disable(void)
|
|
{
|
|
// Test case for eeprom_m95_disable function
|
|
// Perform the disable operation
|
|
eeprom_m95_disable();
|
|
|
|
// Add assertions here to verify the correctness of the disable operation
|
|
// You can check the status of the M95 EEPROM to ensure it is disabled
|
|
}
|
|
|
|
void test_eeprom_m95_init(void)
|
|
{
|
|
// Test case for eeprom_m95_init function
|
|
m95_number_e num = M95_1;
|
|
|
|
// Perform the initialization
|
|
eeprom_m95_init(num);
|
|
|
|
// Add assertions here to verify the correctness of the initialization
|
|
// You can check the values of the initialized variables and perform any necessary checks
|
|
}
|
|
|
|
void test_eeprom_m95_dinit(void)
|
|
{
|
|
// Test case for eeprom_m95_dinit function
|
|
m95_number_e num = M95_1;
|
|
|
|
// Perform the deinitialization
|
|
eeprom_m95_dinit(num);
|
|
|
|
// Add assertions here to verify the correctness of the deinitialization
|
|
// You can check the status of the M95 EEPROM to ensure it is properly deinitialized
|
|
}
|
|
|
|
void test_eeprom_m95_test(void)
|
|
{
|
|
// Test case for eeprom_m95_test function
|
|
m95_number_e num = M95_1;
|
|
|
|
// Perform the test
|
|
eeprom_m95_test(num);
|
|
|
|
// Add assertions here to verify the correctness of the test
|
|
// You can check the results of the test and perform any necessary checks
|
|
}
|
|
|
|
int main(void)
|
|
{
|
|
UNITY_BEGIN();
|
|
|
|
RUN_TEST(test_eeprom_m95_read);
|
|
RUN_TEST(test_eeprom_m95_write);
|
|
RUN_TEST(test_eeprom_m95_enable);
|
|
RUN_TEST(test_eeprom_m95_disable);
|
|
RUN_TEST(test_eeprom_m95_init);
|
|
RUN_TEST(test_eeprom_m95_dinit);
|
|
RUN_TEST(test_eeprom_m95_test);
|
|
|
|
return UNITY_END();
|
|
}
|