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 "lsdb.hpp" |
| 7 | #include "nlsr.hpp" |
| 8 | #include "lsa.hpp" |
| 9 | #include "name-prefix-list.hpp" |
| 10 | #include <boost/test/unit_test.hpp> |
| 11 | |
| 12 | namespace nlsr { |
| 13 | |
| 14 | namespace test { |
| 15 | |
| 16 | BOOST_AUTO_TEST_SUITE(TestLsdb) |
| 17 | |
| 18 | BOOST_AUTO_TEST_CASE(LsdbRemoveAndExists) |
| 19 | { |
| 20 | Nlsr nlsr1; |
| 21 | |
| 22 | NamePrefixList npl1; |
| 23 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 24 | std::string s1 = "name1"; |
| 25 | std::string s2 = "name2"; |
| 26 | std::string router1 = "router1/1"; |
Ashlesh Gawande | eb582eb | 2014-05-01 14:25:20 -0500 | [diff] [blame] | 27 | |
| 28 | npl1.insert(s1); |
| 29 | npl1.insert(s2); |
| 30 | |
| 31 | //For NameLsa lsType is 1. |
| 32 | //12 is seqNo, randomly generated. |
| 33 | //1800 is the default life time. |
| 34 | NameLsa nlsa1("router1", 1, 12, 1800, npl1); |
| 35 | |
| 36 | Lsdb lsdb1; |
| 37 | |
| 38 | lsdb1.installNameLsa(nlsr1, nlsa1); |
| 39 | |
| 40 | BOOST_CHECK(lsdb1.doesLsaExist("router1/1", 1)); |
| 41 | |
| 42 | lsdb1.removeNameLsa(nlsr1, router1); |
| 43 | |
| 44 | BOOST_CHECK_EQUAL(lsdb1.doesLsaExist("router1/1", 1), false); |
| 45 | } |
| 46 | |
| 47 | BOOST_AUTO_TEST_SUITE_END() |
| 48 | |
| 49 | } //namespace test |
| 50 | } //namespace nlsr |