route: Adjust cost to integer before registering
refs: #1907
Change-Id: I471cd2eafb65a8458b4f527a3c3d7ea6682f5627
diff --git a/tests/test-nexthop.cpp b/tests/test-nexthop.cpp
index 7c30069..da3a19f 100644
--- a/tests/test-nexthop.cpp
+++ b/tests/test-nexthop.cpp
@@ -31,14 +31,21 @@
BOOST_AUTO_TEST_CASE(NexthopSetAndGet)
{
- NextHop np1;
+ NextHop hop1;
+ hop1.setConnectingFaceUri("udp://test/uri");
+ hop1.setRouteCost(12.34);
- np1.setConnectingFaceUri("udp://test/uri");
+ BOOST_CHECK_EQUAL(hop1.getConnectingFaceUri(), "udp://test/uri");
+ BOOST_CHECK_EQUAL(hop1.getRouteCost(), 12.34);
+ BOOST_CHECK_EQUAL(hop1.getRouteCostAsAdjustedInteger(), 1234);
- np1.setRouteCost(10.1);
+ NextHop hop2;
- BOOST_CHECK_EQUAL(np1.getConnectingFaceUri(), "udp://test/uri");
- BOOST_CHECK_EQUAL(np1.getRouteCost(), 11);
+ hop2.setRouteCost(12.34);
+ BOOST_CHECK_EQUAL(hop1.getRouteCostAsAdjustedInteger(), hop2.getRouteCostAsAdjustedInteger());
+
+ hop2.setRouteCost(12.35);
+ BOOST_CHECK(hop1.getRouteCostAsAdjustedInteger() < hop2.getRouteCostAsAdjustedInteger());
}
BOOST_AUTO_TEST_SUITE_END()