blob: d9a38f948bdc96871eb4f8533993482587d83f3e [file] [log] [blame]
Ashlesh Gawandeeb582eb2014-05-01 14:25:20 -05001/**
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
9namespace nlsr {
10
11namespace test {
12
13using namespace std;
14
15BOOST_AUTO_TEST_SUITE(TestConfParameter)
16
17BOOST_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 Gawandeeb582eb2014-05-01 14:25:20 -050031 cp1.setInterestRetryNumber(2);
32
33 cp1.setInterestResendTime(1000);
34
35 cp1.setLsaRefreshTime(1500);
36
37 cp1.setRouterDeadInterval(10);
38
39 cp1.setMaxFacesPerPrefix(50);
40
akmhoque157b0a42014-05-13 00:26:37 -050041 cp1.setHyperbolicState(1);
Ashlesh Gawandeeb582eb2014-05-01 14:25:20 -050042
43 cp1.setCorR(2.5);
44
45 cp1.setCorTheta(102.5);
46
Ashlesh Gawandeeb582eb2014-05-01 14:25:20 -050047 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
akmhoquefdbddb12014-05-02 18:35:19 -050059 BOOST_CHECK_EQUAL(cp1.getInterestRetryNumber(), (uint32_t)2);
Ashlesh Gawandeeb582eb2014-05-01 14:25:20 -050060
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
akmhoque157b0a42014-05-13 00:26:37 -050069 BOOST_CHECK_EQUAL(cp1.getHyperbolicState(), 1);
Ashlesh Gawandeeb582eb2014-05-01 14:25:20 -050070
71 BOOST_CHECK_CLOSE(cp1.getCorTheta(), 102.5, 0.0001);
72
Ashlesh Gawandeeb582eb2014-05-01 14:25:20 -050073 BOOST_CHECK_EQUAL(cp1.getInfoInterestInterval(), 3);
74}
75
76BOOST_AUTO_TEST_SUITE_END()
77
78} // namespace test
79} // namespace nlsr