mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-06-29 19:20:35 +08:00
Fixing the previous commit
This commit is contained in:
@@ -4,6 +4,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#if __GNUC__
|
||||
// We need auto_ptr for compatibility reasons
|
||||
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
#include <uavcan/node/abstract_node.hpp>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
@@ -212,20 +217,20 @@ struct TestNetwork
|
||||
{
|
||||
for (uavcan::uint8_t i = 0; i < NumNodes; i++)
|
||||
{
|
||||
nodes[i].reset(new NodeEnvironment(first_node_id + i));
|
||||
nodes[i].reset(new NodeEnvironment(uint8_t(first_node_id + i)));
|
||||
}
|
||||
|
||||
for (uavcan::uint8_t i = 0; i < NumNodes; i++)
|
||||
{
|
||||
for (uavcan::uint8_t k = 0; k < NumNodes; k++)
|
||||
{
|
||||
nodes[i]->linkTogether(nodes[k].get());
|
||||
nodes[i]->can_driver.linkTogether(&nodes[k]->can_driver);
|
||||
}
|
||||
}
|
||||
|
||||
for (uavcan::uint8_t i = 0; i < NumNodes; i++)
|
||||
{
|
||||
assert(nodes[i]->others.size() == (NumNodes - 1));
|
||||
assert(nodes[i]->can_driver.others.size() == (NumNodes - 1));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -247,4 +252,13 @@ struct TestNetwork
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
TestNode& operator[](unsigned index)
|
||||
{
|
||||
if (index >= NumNodes)
|
||||
{
|
||||
throw std::out_of_range("No such test node");
|
||||
}
|
||||
return nodes[index]->node;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -11,7 +11,7 @@ TEST(TestNode, TestNetwork)
|
||||
TestNetwork<4> nwk;
|
||||
|
||||
uavcan::CanFrame frame;
|
||||
for (int i = 0; i < 8; i++)
|
||||
for (uint8_t i = 0; i < 8; i++)
|
||||
{
|
||||
frame.data[i] = i;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user