Files
NLSR/tests/test-lsdb.cpp
T
Ashlesh Gawande eb582eb919 tests: Adding unit tests.
The purpose of this commit is to start pushing unit test I am writing. I will add more unit tests in each patch

Refs: #1496

Change-Id: Ic132adddfa06a95780712eba63966d3bab4743af
2014-05-01 14:47:06 -05:00

51 lines
949 B
C++

/**
* Copyright (C) 2014 Regents of the University of Memphis.
* See COPYING for copyright and distribution information.
*/
#include "lsdb.hpp"
#include "nlsr.hpp"
#include "lsa.hpp"
#include "name-prefix-list.hpp"
#include <boost/test/unit_test.hpp>
namespace nlsr {
namespace test {
BOOST_AUTO_TEST_SUITE(TestLsdb)
BOOST_AUTO_TEST_CASE(LsdbRemoveAndExists)
{
Nlsr nlsr1;
NamePrefixList npl1;
string s1 = "name1";
string s2 = "name2";
string router1 = "router1/1";
npl1.insert(s1);
npl1.insert(s2);
//For NameLsa lsType is 1.
//12 is seqNo, randomly generated.
//1800 is the default life time.
NameLsa nlsa1("router1", 1, 12, 1800, npl1);
Lsdb lsdb1;
lsdb1.installNameLsa(nlsr1, nlsa1);
BOOST_CHECK(lsdb1.doesLsaExist("router1/1", 1));
lsdb1.removeNameLsa(nlsr1, router1);
BOOST_CHECK_EQUAL(lsdb1.doesLsaExist("router1/1", 1), false);
}
BOOST_AUTO_TEST_SUITE_END()
} //namespace test
} //namespace nlsr