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 | |
| 31 | cp1.setRootKeyPrefix("adminRootKey"); |
| 32 | |
| 33 | cp1.setInterestRetryNumber(2); |
| 34 | |
| 35 | cp1.setInterestResendTime(1000); |
| 36 | |
| 37 | cp1.setLsaRefreshTime(1500); |
| 38 | |
| 39 | cp1.setRouterDeadInterval(10); |
| 40 | |
| 41 | cp1.setMaxFacesPerPrefix(50); |
| 42 | |
| 43 | cp1.setLogDir("log"); |
| 44 | |
| 45 | cp1.setCertDir("cert"); |
| 46 | |
| 47 | cp1.setSeqFileDir("ssfd"); |
| 48 | |
| 49 | cp1.setDetailedLogging(1); |
| 50 | |
| 51 | cp1.setDebugging(1); |
| 52 | |
| 53 | cp1.setIsHyperbolicCalc(1); |
| 54 | |
| 55 | cp1.setCorR(2.5); |
| 56 | |
| 57 | cp1.setCorTheta(102.5); |
| 58 | |
| 59 | cp1.setTunnelType(2); |
| 60 | |
| 61 | const string a = "csp"; |
| 62 | cp1.setChronosyncSyncPrefix(a); |
| 63 | |
| 64 | cp1.setChronosyncLsaPrefix("cla"); |
| 65 | |
| 66 | cp1.setInfoInterestInterval(3); |
| 67 | |
| 68 | BOOST_CHECK_EQUAL(cp1.getRouterName(), "router1"); |
| 69 | |
| 70 | BOOST_CHECK_EQUAL(cp1.getSiteName(), "memphis"); |
| 71 | |
| 72 | BOOST_CHECK_EQUAL(cp1.getNetwork(), "ATT"); |
| 73 | |
| 74 | cp1.buildRouterPrefix(); |
| 75 | |
| 76 | BOOST_CHECK_EQUAL(cp1.getRouterPrefix(), "/ATT/memphis/router1"); |
| 77 | |
| 78 | BOOST_CHECK_EQUAL(cp1.getRootKeyPrefix(), "adminRootKey"); |
| 79 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 80 | BOOST_CHECK_EQUAL(cp1.getInterestRetryNumber(), (uint32_t)2); |
Ashlesh Gawande | eb582eb | 2014-05-01 14:25:20 -0500 | [diff] [blame] | 81 | |
| 82 | BOOST_CHECK_EQUAL(cp1.getInterestResendTime(), 1000); |
| 83 | |
| 84 | BOOST_CHECK_EQUAL(cp1.getLsaRefreshTime(), 1500); |
| 85 | |
| 86 | BOOST_CHECK_EQUAL(cp1.getRouterDeadInterval(), 10); |
| 87 | |
| 88 | BOOST_CHECK_EQUAL(cp1.getMaxFacesPerPrefix(), 50); |
| 89 | |
| 90 | BOOST_CHECK_EQUAL(cp1.getLogDir(), "log"); |
| 91 | |
| 92 | BOOST_CHECK_EQUAL(cp1.getCertDir(), "cert"); |
| 93 | |
| 94 | BOOST_CHECK_EQUAL(cp1.getSeqFileDir(), "ssfd"); |
| 95 | |
| 96 | BOOST_CHECK_EQUAL(cp1.getDetailedLogging(), 1); |
| 97 | |
| 98 | BOOST_CHECK_EQUAL(cp1.getDebugging(), 1); |
| 99 | |
| 100 | BOOST_CHECK_EQUAL(cp1.getIsHyperbolicCalc(), 1); |
| 101 | |
| 102 | BOOST_CHECK_CLOSE(cp1.getCorTheta(), 102.5, 0.0001); |
| 103 | |
| 104 | BOOST_CHECK_EQUAL(cp1.getTunnelType(), 2); |
| 105 | |
| 106 | BOOST_CHECK_EQUAL(cp1.getChronosyncSyncPrefix(), "csp"); |
| 107 | |
| 108 | BOOST_CHECK_EQUAL(cp1.getChronosyncLsaPrefix(), "cla"); |
| 109 | |
| 110 | BOOST_CHECK_EQUAL(cp1.getInfoInterestInterval(), 3); |
| 111 | } |
| 112 | |
| 113 | BOOST_AUTO_TEST_SUITE_END() |
| 114 | |
| 115 | } // namespace test |
| 116 | } // namespace nlsr |