Fixing the previous commit

This commit is contained in:
Pavel Kirienko
2015-05-20 00:41:44 +03:00
parent 228785b8f8
commit 4398cceb4c
2 changed files with 18 additions and 4 deletions
+17 -3
View File
@@ -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;
}
};
+1 -1
View File
@@ -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;
}