Ashlesh Gawande | eb582eb | 2014-05-01 14:25:20 -0500 | [diff] [blame] | 1 | /** |
| 2 | * Copyright (C) 2014 Regents of the University of Memphis. |
| 3 | * See COPYING for copyright and distribution information. |
| 4 | */ |
| 5 | |
| 6 | #include "conf-parameter.hpp" |
| 7 | #include <boost/test/unit_test.hpp> |
| 8 | |
| 9 | namespace nlsr { |
| 10 | |
| 11 | namespace test { |
| 12 | |
| 13 | using namespace std; |
| 14 | |
| 15 | BOOST_AUTO_TEST_SUITE(TestConfParameter) |
| 16 | |
| 17 | BOOST_AUTO_TEST_CASE(ConfParameterSettersAndGetters) |
| 18 | { |
| 19 | ConfParameter cp1; |
| 20 | |
| 21 | const string NAME = "router1"; |
| 22 | const string SITE = "memphis"; |
| 23 | const string NETWORK = "ATT"; |
| 24 | |
| 25 | cp1.setRouterName(NAME); |
| 26 | |
| 27 | cp1.setSiteName(SITE); |
| 28 | |
| 29 | cp1.setNetwork(NETWORK); |
| 30 | |
Ashlesh Gawande | eb582eb | 2014-05-01 14:25:20 -0500 | [diff] [blame] | 31 | cp1.setInterestRetryNumber(2); |
| 32 | |
| 33 | cp1.setInterestResendTime(1000); |
| 34 | |
| 35 | cp1.setLsaRefreshTime(1500); |
| 36 | |
| 37 | cp1.setRouterDeadInterval(10); |
| 38 | |
| 39 | cp1.setMaxFacesPerPrefix(50); |
| 40 | |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame^] | 41 | cp1.setHyperbolicState(1); |
Ashlesh Gawande | eb582eb | 2014-05-01 14:25:20 -0500 | [diff] [blame] | 42 | |
| 43 | cp1.setCorR(2.5); |
| 44 | |
| 45 | cp1.setCorTheta(102.5); |
| 46 | |
Ashlesh Gawande | eb582eb | 2014-05-01 14:25:20 -0500 | [diff] [blame] | 47 | cp1.setInfoInterestInterval(3); |
| 48 | |
| 49 | BOOST_CHECK_EQUAL(cp1.getRouterName(), "router1"); |
| 50 | |
| 51 | BOOST_CHECK_EQUAL(cp1.getSiteName(), "memphis"); |
| 52 | |
| 53 | BOOST_CHECK_EQUAL(cp1.getNetwork(), "ATT"); |
| 54 | |
| 55 | cp1.buildRouterPrefix(); |
| 56 | |
| 57 | BOOST_CHECK_EQUAL(cp1.getRouterPrefix(), "/ATT/memphis/router1"); |
| 58 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 59 | BOOST_CHECK_EQUAL(cp1.getInterestRetryNumber(), (uint32_t)2); |
Ashlesh Gawande | eb582eb | 2014-05-01 14:25:20 -0500 | [diff] [blame] | 60 | |
| 61 | BOOST_CHECK_EQUAL(cp1.getInterestResendTime(), 1000); |
| 62 | |
| 63 | BOOST_CHECK_EQUAL(cp1.getLsaRefreshTime(), 1500); |
| 64 | |
| 65 | BOOST_CHECK_EQUAL(cp1.getRouterDeadInterval(), 10); |
| 66 | |
| 67 | BOOST_CHECK_EQUAL(cp1.getMaxFacesPerPrefix(), 50); |
| 68 | |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame^] | 69 | BOOST_CHECK_EQUAL(cp1.getHyperbolicState(), 1); |
Ashlesh Gawande | eb582eb | 2014-05-01 14:25:20 -0500 | [diff] [blame] | 70 | |
| 71 | BOOST_CHECK_CLOSE(cp1.getCorTheta(), 102.5, 0.0001); |
| 72 | |
Ashlesh Gawande | eb582eb | 2014-05-01 14:25:20 -0500 | [diff] [blame] | 73 | BOOST_CHECK_EQUAL(cp1.getInfoInterestInterval(), 3); |
| 74 | } |
| 75 | |
| 76 | BOOST_AUTO_TEST_SUITE_END() |
| 77 | |
| 78 | } // namespace test |
| 79 | } // namespace nlsr |