tests: fix range-loop-construct warning with clang 10 and later

Change-Id: I69a40705201f07147dccb21b3aea2db4f384b24e
diff --git a/tests/test-nlsr.cpp b/tests/test-nlsr.cpp
index 307a3a3..6c46205 100644
--- a/tests/test-nlsr.cpp
+++ b/tests/test-nlsr.cpp
@@ -89,7 +89,7 @@
 
   nlsr.initialize();
 
-  for (const auto neighbor : neighbors.getAdjList()) {
+  for (const auto& neighbor : neighbors.getAdjList()) {
     BOOST_CHECK_EQUAL(neighbor.getLinkCost(), 0);
   }
 }
@@ -111,9 +111,8 @@
 
   nlsr.initialize();
 
-  std::list<Adjacent> neighborList = neighbors.getAdjList();
-  for (std::list<Adjacent>::iterator it = neighborList.begin(); it != neighborList.end(); ++it) {
-    BOOST_CHECK(it->getLinkCost() != 0);
+  for (const auto& neighbor : neighbors.getAdjList()) {
+    BOOST_CHECK_NE(neighbor.getLinkCost(), 0);
   }
 }