Skip to content

Commit

Permalink
Add ComplexNestedKey to message fixtures
Browse files Browse the repository at this point in the history
Signed-off-by: Miguel Company <[email protected]>
  • Loading branch information
MiguelCompany committed Apr 3, 2024
1 parent 278ffbf commit 3461ea5
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test_msgs/include/test_msgs/message_fixtures.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "test_msgs/msg/bounded_plain_sequences.hpp"
#include "test_msgs/msg/bounded_sequences.hpp"
#include "test_msgs/msg/builtins.hpp"
#include "test_msgs/msg/complex_nested_key.hpp"
#include "test_msgs/msg/constants.hpp"
#include "test_msgs/msg/defaults.hpp"
#include "test_msgs/msg/empty.hpp"
Expand Down Expand Up @@ -615,4 +616,19 @@ get_messages_non_keyed_with_nested_key()
return messages;
}

static inline std::vector<test_msgs::msg::ComplexNestedKey::SharedPtr>
get_messages_complex_nested_key()
{
std::vector<test_msgs::msg::ComplexNestedKey::SharedPtr> messages;
auto non_keyed_with_nested_key_msgs = get_messages_non_keyed_with_nested_key();
for (auto nested_msg : non_keyed_with_nested_key_msgs) {
auto msg = std::make_shared<test_msgs::msg::ComplexNestedKey>();
msg->nested_keys = *nested_msg;
msg->uint32_key = 3u;
msg->float64_value = 1.125;
messages.push_back(msg);
}
return messages;
}

#endif // TEST_MSGS__MESSAGE_FIXTURES_HPP_
17 changes: 17 additions & 0 deletions test_msgs/src/test_msgs/message_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from test_msgs.msg import BoundedPlainSequences
from test_msgs.msg import BoundedSequences
from test_msgs.msg import Builtins
from test_msgs.msg import ComplexNestedKey
from test_msgs.msg import Constants
from test_msgs.msg import Defaults
from test_msgs.msg import Empty
Expand Down Expand Up @@ -426,6 +427,20 @@ def get_msg_non_keyed_with_nested_key():
return msgs


def get_msg_complex_nested_key():
msgs = []

non_keyed_with_nested_key_msgs = get_msg_non_keyed_with_nested_key()
for nested_msg in non_keyed_with_nested_key_msgs:
msg = ComplexNestedKey()
msg.nested_keys = nested_msg
msg.uint32_key = 3
msg.float64_value = 1.125
msgs.append(msg)

return msgs


def get_test_msg(message_name):
if 'Builtins' == message_name:
msg = get_msg_builtins()
Expand Down Expand Up @@ -457,6 +472,8 @@ def get_test_msg(message_name):
msg = get_msg_keyed_string()
elif 'NonKeyedWithNestedKey' == message_name:
msg = get_msg_non_keyed_with_nested_key()
elif 'ComplexNestedKey' == message_name:
msg = get_msg_complex_nested_key()
else:
raise NotImplementedError
return msg

0 comments on commit 3461ea5

Please sign in to comment.