Add MAC Address Tests to Catch2 Test Suite#157
Open
kyriesk wants to merge 3 commits intothoth-tech:mainfrom
Open
Add MAC Address Tests to Catch2 Test Suite#157kyriesk wants to merge 3 commits intothoth-tech:mainfrom
kyriesk wants to merge 3 commits intothoth-tech:mainfrom
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This pull request migrates MAC address conversion and validation tests from the legacy
test_networking.cpptest functions to the modern Catch2 test framework inunit_test_network.cpp.The following test cases have been converted from standalone C++ functions to Catch2 TEST_CASE format:
mac_to_hex_test()→TEST_CASE("can convert mac address string to hex string")hex_to_mac_test()→TEST_CASE("can convert hex string to mac address string")is_valid_mac_test()→TEST_CASE("check the validation of mac address")All test logic, assertions, and coverage remain identical to the original tests, ensuring no regression in functionality. This consolidation modernizes the test suite and improves maintainability by using a consistent test framework across the codebase.
Type of Change
Note: This is primarily a test refactoring with no changes to core functionality.
Changes Made
Added three new Catch2 test cases to
unit_test_network.cpp:TEST_CASE("can convert mac address string to hex string")- Tests MAC to hex conversion with positive, negative, and edge casesTEST_CASE("can convert hex string to mac address string")- Tests hex to MAC conversion with validationTEST_CASE("check the validation of mac address")- Tests MAC address validation for valid and invalid formatsTest Coverage Includes:
How Has This Been Tested?
The converted tests maintain 100% parity with the original
test_networking.cppfunctions. All assertions from the original standalone tests have been preserved and converted to Catch2REQUIREmacros. The tests have been executed against the networking library functions:mac_to_hex()- Converts MAC address string to hexadecimal stringhex_to_mac()- Converts hexadecimal string to MAC address formatis_valid_mac()- Validates MAC address formatTesting Checklist
Checklist