Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
facontidavide committed Nov 29, 2023
1 parent 477b527 commit aab9d12
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 21 deletions.
4 changes: 2 additions & 2 deletions data_tamer/examples/custom_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@ int main()
// Print the schema to understand how they are serialized
std::cout << channel->getSchema() << std::endl;

// Note has the size of the message is almost the same as the raw data
size_t expected_size = sizeof(double) * 3 + // pointA
sizeof(double) * 3 + // pointB
sizeof(double) * 7 + // my_pose
sizeof(uint32_t) + 5 * (sizeof(double) * 3) + //points_vect
sizeof(int32_t) * 3;
sizeof(int32_t) * 3; // value_array

channel->takeSnapshot();
std::this_thread::sleep_for(std::chrono::milliseconds(10));

std::cout << "\nMessage size: " << dummy_sink->latest_snapshot.payload.size()
<< " exepcted: " << expected_size << std::endl;

}
9 changes: 3 additions & 6 deletions data_tamer/tests/custom_types_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ struct TypeDefinition<TestType>

TEST(DataTamerCustom, CustomType1)
{
ChannelsRegistry registry;
auto channel = registry.getChannel("chan");
auto channel = LogChannel::create("chan");
auto sink = std::make_shared<DummySink>();
channel->addDataSink(sink);

Expand Down Expand Up @@ -116,8 +115,7 @@ TEST(DataTamerCustom, CustomType1)

TEST(DataTamerCustom, CustomType2)
{
ChannelsRegistry registry;
auto channel = registry.getChannel("chan");
auto channel = LogChannel::create("chan");
auto sink = std::make_shared<DummySink>();
channel->addDataSink(sink);

Expand Down Expand Up @@ -211,8 +209,7 @@ class Pos2D_Serializer: public CustomSerializer

TEST(DataTamerCustom, CustomType3)
{
ChannelsRegistry registry;
auto channel = registry.getChannel("chan");
auto channel = LogChannel::create("chan");
auto sink = std::make_shared<DummySink>();
channel->addDataSink(sink);

Expand Down
9 changes: 3 additions & 6 deletions data_tamer/tests/dt_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ TEST(DataTamerBasic, SerializeVariant)

TEST(DataTamerBasic, TestRegistration)
{
ChannelsRegistry registry;
auto channel = registry.getChannel("chan");
auto channel = LogChannel::create("chan");
auto sink = std::make_shared<DummySink>();
channel->addDataSink(sink);

Expand Down Expand Up @@ -154,8 +153,7 @@ TEST(DataTamerBasic, TestRegistration)

TEST(DataTamerBasic, Vector)
{
ChannelsRegistry registry;
auto channel = registry.getChannel("chan");
auto channel = LogChannel::create("chan");
auto sink = std::make_shared<DummySink>();
channel->addDataSink(sink);

Expand All @@ -172,8 +170,7 @@ TEST(DataTamerBasic, Vector)

TEST(DataTamerBasic, Disable)
{
ChannelsRegistry registry;
auto channel = registry.getChannel("chan");
auto channel = LogChannel::create("chan");
auto sink = std::make_shared<DummySink>();
channel->addDataSink(sink);

Expand Down
10 changes: 3 additions & 7 deletions data_tamer/tests/parser_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ uint16 my/short

TEST(DataTamerParser, SchemaHash)
{
// Create (or get) a channel using the global registry (singleton)
DataTamer::ChannelsRegistry registry;
auto channel = registry.getChannel("channel");
auto channel = DataTamer::LogChannel::create("chan");

// logs in channelA
std::vector<double> v1(10, 0);
Expand Down Expand Up @@ -92,8 +90,7 @@ TEST(DataTamerParser, SchemaHash)

TEST(DataTamerParser, CustomTypes)
{
DataTamer::ChannelsRegistry registry;
auto channel = registry.getChannel("channel");
auto channel = DataTamer::LogChannel::create("chan");

Pose pose;
channel->registerValue("pose", &pose);
Expand Down Expand Up @@ -137,8 +134,7 @@ SnapshotView ConvertSnapshot(const DataTamer::Snapshot& snapshot)

TEST(DataTamerParser, PlainParsing)
{
DataTamer::ChannelsRegistry registry;
auto channel = registry.getChannel("channel");
auto channel = DataTamer::LogChannel::create("channel");
auto dummy_sink = std::make_shared<DataTamer::DummySink>();
channel->addDataSink(dummy_sink);

Expand Down

0 comments on commit aab9d12

Please sign in to comment.