2020-12-04 00:00:03 -06:00
|
|
|
#include "storm/Atomic.hpp"
|
|
|
|
|
#include "test/Test.hpp"
|
|
|
|
|
|
|
|
|
|
TEST_CASE("SInterlockedDecrement", "[atomic]") {
|
|
|
|
|
SECTION("decrements value") {
|
2020-12-04 00:19:19 -06:00
|
|
|
ATOMIC32 value = 1;
|
2020-12-04 00:00:03 -06:00
|
|
|
auto decremented = SInterlockedDecrement(&value);
|
|
|
|
|
CHECK(value == 0);
|
|
|
|
|
CHECK(decremented == 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST_CASE("SInterlockedIncrement", "[atomic]") {
|
|
|
|
|
SECTION("increments value") {
|
2020-12-04 00:19:19 -06:00
|
|
|
ATOMIC32 value = 1;
|
2020-12-04 00:00:03 -06:00
|
|
|
auto incremented = SInterlockedIncrement(&value);
|
|
|
|
|
CHECK(value == 2);
|
|
|
|
|
CHECK(incremented == 2);
|
|
|
|
|
}
|
|
|
|
|
}
|