mirror of
https://github.com/thunderbrewhq/squall.git
synced 2026-02-04 00:49:08 +00:00
feat(memory): add SMemZero
This commit is contained in:
parent
2efa5339e2
commit
60523c3fe8
3 changed files with 27 additions and 0 deletions
|
|
@ -103,3 +103,21 @@ TEST_CASE("SMemReAlloc", "[memory]") {
|
|||
SMemFree(ptr2);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("SMemZero", "[memory]") {
|
||||
std::vector<uint8_t> data = { 1, 255, 128, 42, 69, 99, 13, 37 };
|
||||
|
||||
SECTION("zeroes out memory") {
|
||||
std::vector<uint8_t> result = { 0, 0, 0, 0, 0, 99, 13, 37 };
|
||||
SMemZero(data.data(), 5);
|
||||
|
||||
CHECK_THAT(data, Catch::Matchers::Equals(result));
|
||||
}
|
||||
|
||||
SECTION("does nothing if size is 0") {
|
||||
std::vector<uint8_t> change = data;
|
||||
SMemZero(change.data(), 0);
|
||||
|
||||
CHECK_THAT(change, Catch::Matchers::Equals(data));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue