expand serializeIF tests
This commit is contained in:
parent
8e05fc0417
commit
f2bf4b463e
@ -168,7 +168,7 @@ if(FSFW_BUILD_TESTS)
|
|||||||
configure_file(unittests/testcfg/TestsConfig.h.in tests/TestsConfig.h)
|
configure_file(unittests/testcfg/TestsConfig.h.in tests/TestsConfig.h)
|
||||||
|
|
||||||
project(${FSFW_TEST_TGT} CXX C)
|
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)
|
if(IPO_SUPPORTED AND FSFW_ENABLE_IPO)
|
||||||
set_property(TARGET ${FSFW_TEST_TGT} PROPERTY INTERPROCEDURAL_OPTIMIZATION
|
set_property(TARGET ${FSFW_TEST_TGT} PROPERTY INTERPROCEDURAL_OPTIMIZATION
|
||||||
TRUE)
|
TRUE)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
target_sources(${FSFW_TEST_TGT} PRIVATE
|
target_sources(${FSFW_TEST_TGT} PRIVATE
|
||||||
TestSerialBufferAdapter.cpp
|
testSerialBufferAdapter.cpp
|
||||||
TestSerialization.cpp
|
testSerializeAdapter.cpp
|
||||||
TestSerialLinkedPacket.cpp
|
testSerialLinkedPacket.cpp
|
||||||
|
testSerializeIF.cpp
|
||||||
)
|
)
|
||||||
|
@ -26,13 +26,13 @@ class TestPacket : public SerialLinkedListAdapter<SerializeIF> {
|
|||||||
setLinks();
|
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(); }
|
size_t getBufferLength() { return buffer.getSerializedSize(); }
|
||||||
|
|
||||||
uint16_t getTail() const { return tail.entry; }
|
[[nodiscard]] uint16_t getTail() const { return tail.entry; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setLinks() {
|
void setLinks() {
|
||||||
@ -47,4 +47,4 @@ class TestPacket : public SerialLinkedListAdapter<SerializeIF> {
|
|||||||
SerializeElement<uint32_t> tail = 0;
|
SerializeElement<uint32_t> tail = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* UNITTEST_TESTFW_NEWTESTS_TESTTEMPLATE_H_ */
|
#endif /* UNITTEST_HOSTED_TESTSERIALLINKEDPACKET_H_ */
|
@ -92,7 +92,7 @@ TEST_CASE("Serial Buffer Adapter", "[single-file]") {
|
|||||||
testArray[3] = 1;
|
testArray[3] = 1;
|
||||||
testArray[4] = 1;
|
testArray[4] = 1;
|
||||||
testArray[5] = 0;
|
testArray[5] = 0;
|
||||||
std::array<uint8_t, 4> test_recv_array;
|
std::array<uint8_t, 4> test_recv_array{};
|
||||||
arrayPtr = testArray.data();
|
arrayPtr = testArray.data();
|
||||||
// copy testArray[1] to testArray[4] into receive buffer, skip
|
// copy testArray[1] to testArray[4] into receive buffer, skip
|
||||||
// size field (testArray[0]) for deSerialization.
|
// size field (testArray[0]) for deSerialization.
|
||||||
@ -116,7 +116,7 @@ TEST_CASE("Serial Buffer Adapter", "[single-file]") {
|
|||||||
testArray[3] = 1;
|
testArray[3] = 1;
|
||||||
testArray[4] = 1;
|
testArray[4] = 1;
|
||||||
testArray[5] = 0;
|
testArray[5] = 0;
|
||||||
std::array<uint8_t, 4> test_recv_array;
|
std::array<uint8_t, 4> test_recv_array{};
|
||||||
arrayPtr = testArray.data() + 2;
|
arrayPtr = testArray.data() + 2;
|
||||||
// copy testArray[1] to testArray[4] into receive buffer, skip
|
// copy testArray[1] to testArray[4] into receive buffer, skip
|
||||||
// size field (testArray[0])
|
// size field (testArray[0])
|
@ -1,11 +1,10 @@
|
|||||||
#include "TestSerialLinkedPacket.h"
|
|
||||||
|
|
||||||
#include <fsfw/globalfunctions/arrayprinter.h>
|
#include <fsfw/globalfunctions/arrayprinter.h>
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <catch2/catch_test_macros.hpp>
|
#include <catch2/catch_test_macros.hpp>
|
||||||
|
|
||||||
#include "CatchDefinitions.h"
|
#include "CatchDefinitions.h"
|
||||||
|
#include "SerialLinkedListAdapterPacket.h"
|
||||||
|
|
||||||
TEST_CASE("Serial Linked Packet", "[SerLinkPacket]") {
|
TEST_CASE("Serial Linked Packet", "[SerLinkPacket]") {
|
||||||
// perform set-up here
|
// perform set-up here
|
6
unittests/serialize/testSerializeIF.cpp
Normal file
6
unittests/serialize/testSerializeIF.cpp
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
|
||||||
|
#include <catch2/catch_test_macros.hpp>
|
||||||
|
|
||||||
|
TEST_CASE("Simple Test", "[SerSizeTest]") {
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user