diff --git a/libuavcan/test/node/test_node.hpp b/libuavcan/test/node/test_node.hpp index d36fcc8e2e..4329fc7c21 100644 --- a/libuavcan/test/node/test_node.hpp +++ b/libuavcan/test/node/test_node.hpp @@ -4,6 +4,11 @@ #pragma once +#if __GNUC__ +// We need auto_ptr for compatibility reasons +# pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif + #include #include #include @@ -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; + } }; diff --git a/libuavcan/test/node/test_node_test.cpp b/libuavcan/test/node/test_node_test.cpp index c5731640eb..b40357be21 100644 --- a/libuavcan/test/node/test_node_test.cpp +++ b/libuavcan/test/node/test_node_test.cpp @@ -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; }