blob: 3d2bc0cd970a4e2d4d7a2d6c92e3320ae3ec2852 [file] [log] [blame]
shockjianga5ae48c2014-07-27 23:21:41 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
3 * Copyright (c) 2014, Regents of the University of California.
4 *
5 * This file is part of NDNS (Named Data Networking Domain Name Service).
6 * See AUTHORS.md for complete list of NDNS authors and contributors.
7 *
8 * NDNS is free software: you can redistribute it and/or modify it under the terms
9 * of the GNU General Public License as published by the Free Software Foundation,
10 * either version 3 of the License, or (at your option) any later version.
11 *
12 * NDNS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
13 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along with
17 * NDNS, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include "../boost-test.hpp"
21
22#include "db/zone-mgr.hpp"
23#include "zone.hpp"
24
25//#include <ndn-cxx/name.hpp>
26namespace ndn {
27namespace ndns {
28namespace tests {
29
30using namespace std;
31
32BOOST_AUTO_TEST_SUITE(zoneMgr)
33
34BOOST_AUTO_TEST_CASE(db)
35{
36 string label = "zoneMgr::db";
37 printbegin(label);
38 Zone zone;
39 zone.setAuthorizedName(Name("/net"));
40 zone.setId(11);
41
42 ZoneMgr mgr(zone); //the construction will lookup zone.id, /net's id is 2
43 BOOST_CHECK_EQUAL(mgr.getZone().getId(), 2);
44 BOOST_CHECK_EQUAL(zone.getId(), 2);
45
46
47 zone.setId(11);
48 BOOST_CHECK_EQUAL(mgr.getZone().getId(), 11);
49
50 zone.setId(12);
51 BOOST_CHECK_EQUAL(mgr.getZone().getId(), 12);
52
53 mgr.lookupId();
54 cout<<"zone.name="<<mgr.getZone().getAuthorizedName()<<endl;
55 cout<<"zone.id="<<mgr.getZone().getId()<<endl;
56 cout<<"zone.id="<<mgr.getZone().getId()<<endl;
57 cout<<"&zone="<<&zone<<endl;
58 cout<<"&mgr.getZone()"<<&(mgr.getZone())<<endl;
59 BOOST_CHECK_EQUAL(mgr.getZone().getId(), 2);
60 BOOST_CHECK_EQUAL(zone.getId(), 2);
61
62 printend(label);
63}
64BOOST_AUTO_TEST_SUITE_END()
65
66} // namespace tests
67} // namespace ndns
68} // namespace ndn