blob: f4c0f270d03af9ef85819dd2f4a3e3400d0605ee [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 "adjacency-list.hpp"
7#include "adjacent.hpp"
8#include <boost/test/unit_test.hpp>
9
10namespace nlsr {
11
12namespace test {
13
14using namespace std;
15
16BOOST_AUTO_TEST_SUITE(TestAdjacenctList)
17
18BOOST_AUTO_TEST_CASE(AdjacenctListBasic)
19{
20 const string ADJ_NAME_1 = "testname";
21 const string ADJ_NAME_2 = "testname2";
22
23//adjacent needed to test adjacency list.
24 Adjacent adjacent1(ADJ_NAME_1);
25 Adjacent adjacent2(ADJ_NAME_2);
26
27 adjacent1.setLinkCost(4);
28 adjacent2.setLinkCost(5);
29
30 AdjacencyList adjacentList1;
31 AdjacencyList adjacentList2;
32
33 adjacentList1.insert(adjacent1);
34 adjacentList2.insert(adjacent2);
35
akmhoquefdbddb12014-05-02 18:35:19 -050036 BOOST_CHECK_EQUAL(adjacentList1.getSize(), (uint32_t)1);
37 BOOST_CHECK_EQUAL(adjacentList1 == adjacentList2, false);
Ashlesh Gawandeeb582eb2014-05-01 14:25:20 -050038
39 BOOST_CHECK(adjacentList1.isNeighbor("testname"));
40 BOOST_CHECK_EQUAL(adjacentList1.isNeighbor("adjacent"), false);
41
42 string n1 = "testname";
akmhoquefdbddb12014-05-02 18:35:19 -050043 BOOST_CHECK_EQUAL(adjacentList1.getStatusOfNeighbor(n1), (uint32_t)0);
Ashlesh Gawandeeb582eb2014-05-01 14:25:20 -050044
45 adjacentList1.setStatusOfNeighbor(n1, 1);
akmhoquefdbddb12014-05-02 18:35:19 -050046 BOOST_CHECK_EQUAL(adjacentList1.getStatusOfNeighbor(n1), (uint32_t)1);
Ashlesh Gawandeeb582eb2014-05-01 14:25:20 -050047}
48
49BOOST_AUTO_TEST_SUITE_END()
50
51} //namespace tests
52} //namespace nlsr