generated from saxbophone/CPP20-Cross-Platform-Template
-
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.
* Modified unit tests to move generate_random_bytes() into a common header * Wrote non-compiling but otherwise correct test for slot.read_card() * Wrote code to make test case compile but fail It's a shame array equality comparison is unusable for this example because Catch prints out the whole of both arrays and this takes ages (both are 128KiB for whole card) * Wrote failing test case for whole card writing * Wrote failing test case for card block reading Added stub methods for card block reading and writing * Added failing test for card writing by block * Add failing tests for card reading/writing by sector Also stubbed the methods for doing the same * Wrote minimal code to implement read memory card sector Missing things: - invalid sector number test - invalid checksum test (how on earth can this be tested?) * Validate card checksum when determining sector read success/failure * Implement whole block reading using template recursion This is needed if one wants to use subspans (good because much more intuitive to work with spans of subspans for data output) as we need const-size spans and that method is only available when constexpr * Wrote recursive implementation for reading entire card * Add separate docs test job to CI for PRs (so broken docs block PRs) * Swap to my version of doxygen-action to test my tweak The tweak to the action is intended to expose Doxygen's return status code to Github Actions to allow us to fail the build when Doxygen fails * Implemented writing of card sectors * Implemented writing cards by block and whole card * Fix mistakes in docs
- Loading branch information
1 parent
60e927b
commit 8f93d71
Showing
8 changed files
with
516 additions
and
13 deletions.
There are no files selected for viewing
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
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
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
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
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,27 @@ | ||
#ifndef COM_SAXBOPHONE_WONDERCARD_PRIVATE_TESTS_TEST_HELPERS_HPP | ||
#define COM_SAXBOPHONE_WONDERCARD_PRIVATE_TESTS_TEST_HELPERS_HPP | ||
|
||
#include <random> | ||
|
||
#include <cstdint> | ||
|
||
#include <wondercard/common.hpp> | ||
|
||
|
||
using namespace com::saxbophone::wondercard; | ||
|
||
namespace com::saxbophone::wondercard::PRIVATE::test_helpers { | ||
template<std::size_t SIZE> | ||
std::array<Byte, SIZE> generate_random_bytes() { | ||
std::array<Byte, SIZE> data; | ||
std::default_random_engine engine; | ||
// N.B: Can't use uint8_t for type as generator doesn't support char types | ||
std::uniform_int_distribution<std::uint16_t> prng(0x0000, 0x00FF); | ||
for (auto& d : data) { | ||
d = (Byte)prng(engine); | ||
} | ||
return data; | ||
} | ||
} | ||
|
||
#endif // include guard |
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
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
Oops, something went wrong.