expand serializeIF tests

This commit is contained in:
Robin Müller 2022-07-23 10:34:19 +02:00
parent 8e05fc0417
commit f2bf4b463e
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
7 changed files with 18 additions and 12 deletions

View File

@ -168,7 +168,7 @@ if(FSFW_BUILD_TESTS)
configure_file(unittests/testcfg/TestsConfig.h.in tests/TestsConfig.h)
project(${FSFW_TEST_TGT} CXX C)
add_executable(${FSFW_TEST_TGT})
add_executable(${FSFW_TEST_TGT} unittests/serialize/testSerializeIF.cpp)
if(IPO_SUPPORTED AND FSFW_ENABLE_IPO)
set_property(TARGET ${FSFW_TEST_TGT} PROPERTY INTERPROCEDURAL_OPTIMIZATION
TRUE)

View File

@ -1,5 +1,6 @@
target_sources(${FSFW_TEST_TGT} PRIVATE
TestSerialBufferAdapter.cpp
TestSerialization.cpp
TestSerialLinkedPacket.cpp
testSerialBufferAdapter.cpp
testSerializeAdapter.cpp
testSerialLinkedPacket.cpp
testSerializeIF.cpp
)

View File

@ -26,13 +26,13 @@ class TestPacket : public SerialLinkedListAdapter<SerializeIF> {
setLinks();
}
uint32_t getHeader() const { return header.entry; }
[[nodiscard]] uint32_t getHeader() const { return header.entry; }
const uint8_t* getBuffer() { return buffer.entry.getConstBuffer(); }
[[nodiscard]] const uint8_t* getBuffer() const { return buffer.entry.getConstBuffer(); }
size_t getBufferLength() { return buffer.getSerializedSize(); }
uint16_t getTail() const { return tail.entry; }
[[nodiscard]] uint16_t getTail() const { return tail.entry; }
private:
void setLinks() {
@ -47,4 +47,4 @@ class TestPacket : public SerialLinkedListAdapter<SerializeIF> {
SerializeElement<uint32_t> tail = 0;
};
#endif /* UNITTEST_TESTFW_NEWTESTS_TESTTEMPLATE_H_ */
#endif /* UNITTEST_HOSTED_TESTSERIALLINKEDPACKET_H_ */

View File

@ -92,7 +92,7 @@ TEST_CASE("Serial Buffer Adapter", "[single-file]") {
testArray[3] = 1;
testArray[4] = 1;
testArray[5] = 0;
std::array<uint8_t, 4> test_recv_array;
std::array<uint8_t, 4> test_recv_array{};
arrayPtr = testArray.data();
// copy testArray[1] to testArray[4] into receive buffer, skip
// size field (testArray[0]) for deSerialization.
@ -116,7 +116,7 @@ TEST_CASE("Serial Buffer Adapter", "[single-file]") {
testArray[3] = 1;
testArray[4] = 1;
testArray[5] = 0;
std::array<uint8_t, 4> test_recv_array;
std::array<uint8_t, 4> test_recv_array{};
arrayPtr = testArray.data() + 2;
// copy testArray[1] to testArray[4] into receive buffer, skip
// size field (testArray[0])

View File

@ -1,11 +1,10 @@
#include "TestSerialLinkedPacket.h"
#include <fsfw/globalfunctions/arrayprinter.h>
#include <array>
#include <catch2/catch_test_macros.hpp>
#include "CatchDefinitions.h"
#include "SerialLinkedListAdapterPacket.h"
TEST_CASE("Serial Linked Packet", "[SerLinkPacket]") {
// perform set-up here

View File

@ -0,0 +1,6 @@
#include <catch2/catch_test_macros.hpp>
TEST_CASE("Simple Test", "[SerSizeTest]") {
}