/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
 * Copyright (c) 2014, Regents of the University of California.
 *
 * This file is part of NDNS (Named Data Networking Domain Name Service).
 * See AUTHORS.md for complete list of NDNS authors and contributors.
 *
 * NDNS is free software: you can redistribute it and/or modify it under the terms
 * of the GNU General Public License as published by the Free Software Foundation,
 * either version 3 of the License, or (at your option) any later version.
 *
 * NDNS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 * PURPOSE.  See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * NDNS, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
 */

#include "ndns-label.hpp"
#include "../boost-test.hpp"

namespace ndn {
namespace ndns {
namespace tests {

BOOST_AUTO_TEST_SUITE(NdnsLabel)

BOOST_AUTO_TEST_CASE(MatchInterest)
{
  using namespace label;
  Name hint("/att");
  Name zone("/net/ndnsim");

  Interest interest1("/att/%F0./net/ndnsim/NDNS/www/dsk-111/NS");
  Interest interest2("/att/%F0./net/ndnsim/NDNS/www/dsk-111/NS/%FD%00");

  MatchResult re;
  BOOST_CHECK_EQUAL(matchName(interest1, hint, zone, re), true);
  BOOST_CHECK_EQUAL(re.rrLabel, Name("/www/dsk-111"));
  BOOST_CHECK_EQUAL(re.rrType, name::Component("NS"));
  BOOST_CHECK_EQUAL(re.version, name::Component());

  BOOST_CHECK_EQUAL(matchName(interest2, hint, zone, re), true);
  BOOST_CHECK_EQUAL(re.rrLabel, Name("/www/dsk-111/NS"));
  BOOST_CHECK_EQUAL(re.rrType, name::Component::fromEscapedString("%FD%00"));
  BOOST_CHECK_EQUAL(re.version, name::Component());
}

BOOST_AUTO_TEST_CASE(MatchData)
{
  using namespace label;
  Name hint("/att");
  Name zone("/net/ndnsim");

  Data data1("/att/%F0./net/ndnsim/NDNS/www/dsk-111/NS/%FD%00");
  Data data2("/att/%F0./net/ndnsim/NDNS/www/dsk-111/NS");

  MatchResult re;
  BOOST_CHECK_EQUAL(matchName(data1, hint, zone, re), true);
  BOOST_CHECK_EQUAL(re.rrLabel, Name("/www/dsk-111"));
  BOOST_CHECK_EQUAL(re.rrType, name::Component("NS"));
  BOOST_REQUIRE_NO_THROW(re.version.toVersion());
  BOOST_CHECK_EQUAL(re.version.toVersion(), 0);

  BOOST_CHECK_EQUAL(matchName(data2, hint, zone, re), true);
  BOOST_CHECK_EQUAL(re.rrLabel, Name("/www"));
  BOOST_CHECK_EQUAL(re.rrType, name::Component("dsk-111"));
  BOOST_REQUIRE_THROW(re.version.toVersion(), ndn::tlv::Error);
}

BOOST_AUTO_TEST_SUITE_END()

} // namespace tests
} // namespace ndns
} // namespace ndn
