// clang-format off
#include <volatile.hpp>
#include <cstdint>
#include <CppUTest/CommandLineTestRunner.h>
// clang-format on

using namespace embutil;

TEST_GROUP(VolatileTestGroup){};

TEST(VolatileTestGroup, LoadStoreNonVolatile)
{
	uint8_t test_value = 0;
	auto loaded_result = volatile_load(&test_value);
	CHECK(loaded_result == test_value);
	loaded_result++;
	volatile_store(&test_value, loaded_result);
	CHECK(test_value == 1);
}

TEST(VolatileTestGroup, LoadStoreVolatile)
{
	volatile uint8_t test_value = 0;
	auto loaded_result = volatile_load(&test_value);
	CHECK(loaded_result == test_value);
	loaded_result++;
	volatile_store(&test_value, loaded_result);
	CHECK(test_value == 1);
}
