diff --git a/.gitignore b/.gitignore index 23601ec..b9eb43a 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ CTestTestfile.cmake _deps build /.vs +/.vscode diff --git a/include/C_Callback.h b/include/C_Callback.h index 2ef6bf5..5775016 100644 --- a/include/C_Callback.h +++ b/include/C_Callback.h @@ -23,7 +23,7 @@ DLL_EXPORT CallbackFunction printNumberInHex(int number, char* buffer, size_t bu // Function that takes a function pointer as an argument and // set the callback function to the one passed in -DLL_EXPORT void setCallback(CallbackFunction callback); +DLL_EXPORT void registerCallback(CallbackFunction callback); // Run the callback function with the given number DLL_EXPORT void runCallback(int number, char* buffer, size_t bufferSize); diff --git a/src/C_Callback.c b/src/C_Callback.c index 436bc5a..f8b2692 100644 --- a/src/C_Callback.c +++ b/src/C_Callback.c @@ -20,7 +20,7 @@ CallbackFunction printNumberInHex(int number, char* buffer, size_t bufferSize) // Function that takes a function pointer as an argument and // set the callback function to the one passed in -void setCallback(CallbackFunction callback) +void registerCallback(CallbackFunction callback) { callbackFunction = callback; } diff --git a/tests/test_C_Callback.cpp b/tests/test_C_Callback.cpp index 7fe6e66..cc467db 100644 --- a/tests/test_C_Callback.cpp +++ b/tests/test_C_Callback.cpp @@ -33,21 +33,21 @@ TEST(C_Callback, testPrintNumberInHex) int number = 42; // Test when callback function is not set - setCallback(NULL); + registerCallback(NULL); runCallback(number, buffer, sizeof(buffer)); printf("Callback Function (NULL): %s\n", buffer); // Add assertions to check the output ASSERT_STREQ(buffer, "No callback function set\n"); // Test when callback function is set - setCallback((CallbackFunction) printNumberInDec); + registerCallback((CallbackFunction) printNumberInDec); runCallback(number, buffer, sizeof(buffer)); printf("Callback Function (printNumberInDec): %s\n", buffer); // Add assertions to check the output ASSERT_STREQ(buffer, "Number: 42\n"); // Test when callback function is set - setCallback((CallbackFunction)printNumberInHex); + registerCallback((CallbackFunction)printNumberInHex); runCallback(number, buffer, sizeof(buffer)); printf("Callback Function (printNumberInDec): %s\n", buffer); // Add assertions to check the output