mirror of
https://github.com/thunderbrewhq/squall.git
synced 2025-12-12 10:32:29 +00:00
feat(atomic): add SInterlockedIncrement and SInterlockedDecrement
This commit is contained in:
parent
4307fb2a1d
commit
653fa81853
3 changed files with 55 additions and 0 deletions
20
test/Atomic.cpp
Normal file
20
test/Atomic.cpp
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
#include "storm/Atomic.hpp"
|
||||
#include "test/Test.hpp"
|
||||
|
||||
TEST_CASE("SInterlockedDecrement", "[atomic]") {
|
||||
SECTION("decrements value") {
|
||||
int32_t value = 1;
|
||||
auto decremented = SInterlockedDecrement(&value);
|
||||
CHECK(value == 0);
|
||||
CHECK(decremented == 0);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("SInterlockedIncrement", "[atomic]") {
|
||||
SECTION("increments value") {
|
||||
int32_t value = { 1 };
|
||||
auto incremented = SInterlockedIncrement(&value);
|
||||
CHECK(value == 2);
|
||||
CHECK(incremented == 2);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue