re-run afmt
This commit is contained in:
parent
05d4162f5b
commit
54fc35eae7
@ -1,10 +1,10 @@
|
|||||||
#include "fsfw/container/SimpleRingBuffer.h"
|
#include "fsfw/container/SimpleRingBuffer.h"
|
||||||
#include "fsfw/FSFW.h"
|
|
||||||
|
|
||||||
#include "fsfw/serviceinterface.h"
|
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
|
#include "fsfw/FSFW.h"
|
||||||
|
#include "fsfw/serviceinterface.h"
|
||||||
|
|
||||||
SimpleRingBuffer::SimpleRingBuffer(const size_t size, bool overwriteOld, size_t maxExcessBytes)
|
SimpleRingBuffer::SimpleRingBuffer(const size_t size, bool overwriteOld, size_t maxExcessBytes)
|
||||||
: RingBufferBase<>(0, size, overwriteOld), maxExcessBytes(maxExcessBytes) {
|
: RingBufferBase<>(0, size, overwriteOld), maxExcessBytes(maxExcessBytes) {
|
||||||
if (maxExcessBytes > size) {
|
if (maxExcessBytes > size) {
|
||||||
@ -51,15 +51,15 @@ void SimpleRingBuffer::confirmBytesWritten(size_t amount) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t SimpleRingBuffer::writeData(const uint8_t* data, size_t amount) {
|
ReturnValue_t SimpleRingBuffer::writeData(const uint8_t* data, size_t amount) {
|
||||||
if(data == nullptr) {
|
if (data == nullptr) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
if(amount > getMaxSize()) {
|
if (amount > getMaxSize()) {
|
||||||
#if FSFW_VERBOSE_LEVEL >= 1
|
#if FSFW_VERBOSE_LEVEL >= 1
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::error << "SimpleRingBuffer::writeData: Amount of data too large" << std::endl;
|
sif::error << "SimpleRingBuffer::writeData: Amount of data too large" << std::endl;
|
||||||
#else
|
#else
|
||||||
sif::printError("SimpleRingBuffer::writeData: Amount of data too large\n");
|
sif::printError("SimpleRingBuffer::writeData: Amount of data too large\n");
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
|
@ -237,12 +237,12 @@ TEST_CASE("Ring Buffer Test3", "[RingBufferTest3]") {
|
|||||||
|
|
||||||
SECTION("Overflow") {
|
SECTION("Overflow") {
|
||||||
REQUIRE(ringBuffer.availableWriteSpace() == 9);
|
REQUIRE(ringBuffer.availableWriteSpace() == 9);
|
||||||
// Writing more than the buffer is large.
|
// Writing more than the buffer is large.
|
||||||
// This write will be rejected and is seen as a configuration mistake
|
// This write will be rejected and is seen as a configuration mistake
|
||||||
REQUIRE(ringBuffer.writeData(testData, 13) == retval::CATCH_FAILED);
|
REQUIRE(ringBuffer.writeData(testData, 13) == retval::CATCH_FAILED);
|
||||||
REQUIRE(ringBuffer.getAvailableReadData() == 0);
|
REQUIRE(ringBuffer.getAvailableReadData() == 0);
|
||||||
ringBuffer.clear();
|
ringBuffer.clear();
|
||||||
// Using FreeElement allows the usage of excessBytes but
|
// Using FreeElement allows the usage of excessBytes but
|
||||||
// should be used with caution
|
// should be used with caution
|
||||||
uint8_t *ptr = nullptr;
|
uint8_t *ptr = nullptr;
|
||||||
REQUIRE(ringBuffer.getFreeElement(&ptr, 13) == retval::CATCH_OK);
|
REQUIRE(ringBuffer.getFreeElement(&ptr, 13) == retval::CATCH_OK);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user