Skip to content

Commit

Permalink
Release v7.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
arobenko committed Jan 18, 2025
2 parents 15a82a8 + a7a8a49 commit 3f8df8f
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 5 deletions.
8 changes: 4 additions & 4 deletions app/commsdsl2comms/src/CommsPayloadLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,12 @@ std::string CommsPayloadLayer::commsCustomFieldDataViewOptsImpl() const
static const std::string Templ =
"/// @brief Extra options for @ref\n"
"/// #^#SCOPE#$##^#SUFFIX#$#::Field field.\n"
"struct #^#CLASS_NAME#$##^#SUFFIX#$# : public TBase::#^#OPT_SCOPE#$#\n"
"struct #^#CLASS_NAME#$##^#SUFFIX#$# : public TBase::#^#OPT_SCOPE#$##^#SUFFIX#$#\n"
"{\n"
" using Field =\n"
" std::tuple<\n"
" comms::option::app::OrigDataView,\n"
" typename TBase::#^#OPT_SCOPE#$#::Field\n"
" typename TBase::#^#OPT_SCOPE#$##^#SUFFIX#$#::Field\n"
" >;\n"
"}; // struct #^#CLASS_NAME#$##^#SUFFIX#$#\n";

Expand All @@ -151,12 +151,12 @@ std::string CommsPayloadLayer::commsCustomFieldBareMetalOptsImpl() const
static const std::string Templ =
"/// @brief Extra options for @ref\n"
"/// #^#SCOPE#$##^#SUFFIX#$#::Field field.\n"
"struct #^#CLASS_NAME#$##^#SUFFIX#$# : public TBase::#^#OPT_SCOPE#$#\n"
"struct #^#CLASS_NAME#$##^#SUFFIX#$# : public TBase::#^#OPT_SCOPE#$##^#SUFFIX#$#\n"
"{\n"
" using Field =\n"
" std::tuple<\n"
" comms::option::app::FixedSizeStorage<DEFAULT_SEQ_FIXED_STORAGE_SIZE * 8>,\n"
" typename TBase::#^#OPT_SCOPE#$#::Field\n"
" typename TBase::#^#OPT_SCOPE#$##^#SUFFIX#$#::Field\n"
" >;\n"
"}; // struct #^#CLASS_NAME#$##^#SUFFIX#$#\n";

Expand Down
44 changes: 44 additions & 0 deletions app/commsdsl2comms/test/test1/test1Test.th
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@
#include "test1/frame/Frame.h"
#include "test1/message/Msg1.h"
#include "test1/message/Msg2.h"
#include "test1/options/DataViewDefaultOptions.h"
#include "test1/options/BareMetalDefaultOptions.h"
#include "test1/dispatch/DispatchMessage.h"

class TestSuite : public CxxTest::TestSuite
{
public:
void test1();
void test2();
void test3();
void test4();

using Interface =
test1::Message<
Expand All @@ -25,7 +29,12 @@ public:
>;

TEST1_ALIASES_FOR_ALL_MESSAGES(,,Interface, test1::options::DefaultOptions)
TEST1_ALIASES_FOR_ALL_MESSAGES(DataView,,Interface, test1::options::DataViewDefaultOptions)
TEST1_ALIASES_FOR_ALL_MESSAGES(BareMetal,,Interface, test1::options::BareMetalDefaultOptions)

using Frame = test1::frame::Frame<Interface>;
using DataViewFrame = test1::frame::Frame<Interface, test1::input::AllMessages<Interface, test1::options::DataViewDefaultOptions>, test1::options::DataViewDefaultOptions>;
using BareMetalFrame = test1::frame::Frame<Interface, test1::input::AllMessages<Interface, test1::options::BareMetalDefaultOptions>, test1::options::BareMetalDefaultOptions>;

void polymorphicNameCheck(const Interface& msg, const char* value)
{
Expand Down Expand Up @@ -82,3 +91,38 @@ void TestSuite::test2()
test1::dispatch::dispatchMessageDefaultOptions(test1::MsgId_Msg1, *msg, handler);
TS_ASSERT_EQUALS(handler.m_msg1, 1U);
}

void TestSuite::test3()
{
DataViewFrame frame;
DataViewFrame::AllFields frameFields;
DataViewFrame::MsgPtr msg;
static const std::uint8_t Buf[] = {1, 0x1, 0x2, 0x3, 0x4};
static const std::size_t BufSize = std::extent<decltype(Buf)>::value;
auto readIter = comms::readIteratorFor<Interface>(&Buf[0]);
auto es = frame.readFieldsCached(frameFields, msg, readIter, BufSize);
TS_ASSERT_EQUALS(es, comms::ErrorStatus::Success);
TS_ASSERT_EQUALS(msg->getId(), 1U);

auto& payload = std::get<1>(frameFields).value();
TS_ASSERT_EQUALS(payload.size(), BufSize - 1U);
TS_ASSERT(std::equal(payload.begin(), payload.end(), std::begin(Buf) + 1));
}

void TestSuite::test4()
{
BareMetalFrame frame;
BareMetalFrame::AllFields frameFields;
BareMetalFrame::MsgPtr msg;
static const std::uint8_t Buf[] = {1, 0x1, 0x2, 0x3, 0x4};
static const std::size_t BufSize = std::extent<decltype(Buf)>::value;
auto readIter = comms::readIteratorFor<Interface>(&Buf[0]);
auto es = frame.readFieldsCached(frameFields, msg, readIter, BufSize);
TS_ASSERT_EQUALS(es, comms::ErrorStatus::Success);
TS_ASSERT_EQUALS(msg->getId(), 1U);

auto& payload = std::get<1>(frameFields).value();
TS_ASSERT_EQUALS(payload.size(), BufSize - 1U);
TS_ASSERT(std::equal(payload.begin(), payload.end(), std::begin(Buf) + 1));
}

2 changes: 1 addition & 1 deletion lib/include/commsdsl/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#define COMMSDSL_MINOR_VERSION 0U

/// @brief Patch level of the library
#define COMMSDSL_PATCH_VERSION 1U
#define COMMSDSL_PATCH_VERSION 2U

/// @brief Macro to create numeric version as single unsigned number
#define COMMSDSL_MAKE_VERSION(major_, minor_, patch_) \
Expand Down

0 comments on commit 3f8df8f

Please sign in to comment.