-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added unit test for function_arg_helpers
- Loading branch information
1 parent
c1ce1c7
commit 58dec44
Showing
4 changed files
with
52 additions
and
6 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
firmware/Core/Inc/unit_tests/unit_test_function_arg_helpers.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#ifndef __INCLUDE_GUARD__UNIT_TEST_FUNCTION_ARG_HELPERS_H__ | ||
#define __INCLUDE_GUARD__UNIT_TEST_FUNCTION_ARG_HELPERS_H__ | ||
|
||
#include <stdint.h> | ||
|
||
uint8_t TEST__is_valid_hex_string(); | ||
|
||
#endif // __INCLUDE_GUARD__UNIT_TEST_FUNCTION_ARG_HELPERS_H__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
firmware/Core/Src/unit_tests/unit_test_function_arg_helpers.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include "unit_tests/unit_test_helpers.h" | ||
#include "unit_tests/unit_test_function_arg_helpers.h" | ||
#include "function_arg_helpers.h" | ||
|
||
#include <string.h> | ||
|
||
uint8_t TEST__is_valid_hex_string() | ||
{ | ||
char hex_color_code[20] = "\0"; | ||
uint8_t status; | ||
|
||
// Fail Criteria | ||
|
||
// Empty string | ||
status = is_valid_hex_string(hex_color_code, strlen(hex_color_code)); | ||
TEST_ASSERT_TRUE(status == 1); | ||
|
||
// Invalid Hex Value ie "#" is not a hex value | ||
strcpy(hex_color_code, "#FFAABB"); | ||
status = is_valid_hex_string(hex_color_code, strlen(hex_color_code)); | ||
TEST_ASSERT_TRUE(status == 2); | ||
|
||
// Pass Criteria | ||
strcpy(hex_color_code, "1234567890ABCDEF"); | ||
status = is_valid_hex_string(hex_color_code, strlen(hex_color_code)); | ||
TEST_ASSERT_TRUE(status == 0); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters