update cls

This commit is contained in:
2024-02-06 03:24:43 +01:00
parent 6bd0ecb2e5
commit fe34a86746
2 changed files with 13 additions and 13 deletions

View File

@@ -9,7 +9,7 @@ uint32_t hfdcan1 =0;
// Test when you register a new canid, it should return true.
void test_CanDataRegDataMsg_insert_valid() {
CanDataHandler_init(); // Reset the state of the module
CanDataHandler_reset(); // Reset the state of the module
CanDataId canid = 1; // Test with a valid canid
bool result = CanData_regDataMsg(canid);
TEST_ASSERT_TRUE(result); // Check that the function returned true
@@ -17,7 +17,7 @@ void test_CanDataRegDataMsg_insert_valid() {
// Test when you register a canid when all slots are filled, it should return false.
void test_CanDataRegDataMsg_insert_full() {
CanDataHandler_init(); // Reset the state of the module
CanDataHandler_reset(); // Reset the state of the module
// Fill all the slots
for (int i = 1; i < MAX_MESSAGE_SLOTS+1; i++) {
@@ -34,7 +34,7 @@ void test_CanDataRegDataMsg_insert_full() {
// Test when registering the same canid multible times there should be no error
void test_CanDataRegDataMsg_insert_duplicate() {
CanDataHandler_init(); // Reset the state of the module
CanDataHandler_reset(); // Reset the state of the module
CanDataId canid = 1; // Test with a valid canid
@@ -53,7 +53,7 @@ void dummyEventCallback(CanDataId canid, uint8_t* data, uint8_t len) {
// Test when you register a new event callback, it should return true.
void test_CanDataRegEventMsg_insert_valid() {
CanDataHandler_init(); // Reset the state of the module
CanDataHandler_reset(); // Reset the state of the module
CanDataId canid = 1; // Test with a valid canid
bool result = CanData_regEventMsg(canid, dummyEventCallback);
TEST_ASSERT_TRUE(result); // Check that the function returned true
@@ -61,7 +61,7 @@ void test_CanDataRegEventMsg_insert_valid() {
// Test when you register an event callback when all slots are filled, it should return false.
void test_CanDataRegEventMsg_insert_full() {
CanDataHandler_init(); // Reset the state of the module
CanDataHandler_reset(); // Reset the state of the module
// Fill all the slots
for (int i = 1; i < MAX_EVENT_SLOTS+1; i++) {
@@ -77,7 +77,7 @@ void test_CanDataRegEventMsg_insert_full() {
// Test when you register a canid with a NULL callback, it should return false.
void test_CanDataRegEventMsg_NullCallback() {
CanDataHandler_init(); // Reset the state of the module
CanDataHandler_reset(); // Reset the state of the module
CanDataId canid = 1; // Test with a valid canid
bool result = CanData_regEventMsg(canid, NULL);
TEST_ASSERT_FALSE(result); // Check that the function returned false
@@ -86,7 +86,7 @@ void test_CanDataRegEventMsg_NullCallback() {
// Test when you register a canid that has already been registered, it should return false.
void test_CanDataRegEventMsg_insert_duplicate() {
CanDataHandler_init(); // Reset the state of the module
CanDataHandler_reset(); // Reset the state of the module
CanDataId canid = 1; // Test with a valid canid
// Register the canid once
@@ -101,7 +101,7 @@ void test_CanDataRegEventMsg_insert_duplicate() {
// Test for CanData_canFifo0RxCallback(CanDataId canid, uint8_t* data, uint8_t len) function
void test_CanData_canFifo0RxCallback_data_valid() {
CanDataHandler_init(); // Reset the state of the module
CanDataHandler_reset(); // Reset the state of the module
CanDataId canid = 1; // Test with a valid canid
uint8_t data[8] = {1, 2, 3, 4, 5, 6, 7, 8}; // Test with valid data
uint8_t len = 8; // Test with a valid length
@@ -124,7 +124,7 @@ void test_CanData_canFifo0RxCallback_data_valid() {
// Test for CanData_canFifo0RxCallback(CanDataId canid, uint8_t* data, uint8_t len) function
// Test with an invalid canid or NULL data, the function should handle the error correctly.
void test_CanData_canFifo0RxCallback_data_invalid() {
CanDataHandler_init(); // Reset the state of the module
CanDataHandler_reset(); // Reset the state of the module
CanDataId canid = 1; // Test with a valid canid
uint8_t* data = NULL; // Test with NULL data
uint8_t len = 8; // Test with a valid length
@@ -153,7 +153,7 @@ void test_CanData_canFifo1RxCallback_callback(CanDataId canid, uint8_t* data, ui
}
// Test for CanData_canFifo1RxCallback(CanDataId canid, uint8_t* data, uint8_t len) function
void test_CanData_canFifo1RxCallback_data_valid() {
CanDataHandler_init(); // Reset the state of the module
CanDataHandler_reset(); // Reset the state of the module
CanDataId canid = 1; // Test with a valid canid
uint8_t data[8] = {1, 2, 3, 4, 5, 6, 7, 8}; // Test with valid data
uint8_t len = 8; // Test with a valid length
@@ -181,7 +181,7 @@ void test_CanData_removeEvent_callback(CanDataId canid, uint8_t* data, uint8_t l
// Test for CanData_removeEvent(CanDataId canid) function
void test_CanData_removeEvent() {
CanDataHandler_init(); // Reset the state of the module
CanDataHandler_reset(); // Reset the state of the module
CanDataId canid = 1; // Test with a valid canid
// Register the canid with the callback
@@ -203,7 +203,7 @@ void test_CanData_removeEvent() {
void test_CanData_regDataManualMsg(void) {
CanDataHandler_init(); // Reset the state of the module
CanDataHandler_reset(); // Reset the state of the module
{
CanDataId canids[] = {1, 2, 3};