Skip to content

Commit

Permalink
tests: namespace cleanup
Browse files Browse the repository at this point in the history
Change-Id: Ic34a8d5330759db6ff037479dc29dc148095a256
  • Loading branch information
Pesa committed Feb 12, 2024
1 parent c6cfed6 commit 30c41ec
Show file tree
Hide file tree
Showing 11 changed files with 72 additions and 90 deletions.
44 changes: 22 additions & 22 deletions COPYING.md
@@ -1,4 +1,4 @@
### GNU GENERAL PUBLIC LICENSE
# GNU GENERAL PUBLIC LICENSE

Version 3, 29 June 2007

Expand All @@ -8,7 +8,7 @@ Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.

### Preamble
## Preamble

The GNU General Public License is a free, copyleft license for
software and other kinds of works.
Expand Down Expand Up @@ -73,9 +73,9 @@ assures that patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.

### TERMS AND CONDITIONS
## TERMS AND CONDITIONS

#### 0. Definitions.
### 0. Definitions.

"This License" refers to version 3 of the GNU General Public License.

Expand Down Expand Up @@ -115,7 +115,7 @@ work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.

#### 1. Source Code.
### 1. Source Code.

The "source code" for a work means the preferred form of the work for
making modifications to it. "Object code" means any non-source form of
Expand Down Expand Up @@ -156,7 +156,7 @@ regenerate automatically from other parts of the Corresponding Source.
The Corresponding Source for a work in source code form is that same
work.

#### 2. Basic Permissions.
### 2. Basic Permissions.

All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
Expand All @@ -181,7 +181,7 @@ Conveying under any other circumstances is permitted solely under the
conditions stated below. Sublicensing is not allowed; section 10 makes
it unnecessary.

#### 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
### 3. Protecting Users' Legal Rights From Anti-Circumvention Law.

No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
Expand All @@ -197,7 +197,7 @@ operation or modification of the work as a means of enforcing, against
the work's users, your or third parties' legal rights to forbid
circumvention of technological measures.

#### 4. Conveying Verbatim Copies.
### 4. Conveying Verbatim Copies.

You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
Expand All @@ -210,7 +210,7 @@ recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.

#### 5. Conveying Modified Source Versions.
### 5. Conveying Modified Source Versions.

You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
Expand Down Expand Up @@ -245,7 +245,7 @@ beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.

#### 6. Conveying Non-Source Forms.
### 6. Conveying Non-Source Forms.

You may convey a covered work in object code form under the terms of
sections 4 and 5, provided that you also convey the machine-readable
Expand Down Expand Up @@ -341,7 +341,7 @@ documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.

#### 7. Additional Terms.
### 7. Additional Terms.

"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Expand Down Expand Up @@ -400,7 +400,7 @@ Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions; the
above requirements apply either way.

#### 8. Termination.
### 8. Termination.

You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
Expand Down Expand Up @@ -428,7 +428,7 @@ this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.

#### 9. Acceptance Not Required for Having Copies.
### 9. Acceptance Not Required for Having Copies.

You are not required to accept this License in order to receive or run
a copy of the Program. Ancillary propagation of a covered work
Expand All @@ -439,7 +439,7 @@ modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.

#### 10. Automatic Licensing of Downstream Recipients.
### 10. Automatic Licensing of Downstream Recipients.

Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
Expand All @@ -464,7 +464,7 @@ rights granted under this License, and you may not initiate litigation
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.

#### 11. Patents.
### 11. Patents.

A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
Expand Down Expand Up @@ -533,7 +533,7 @@ Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.

#### 12. No Surrender of Others' Freedom.
### 12. No Surrender of Others' Freedom.

If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
Expand All @@ -546,7 +546,7 @@ from those to whom you convey the Program, the only way you could
satisfy both those terms and this License would be to refrain entirely
from conveying the Program.

#### 13. Use with the GNU Affero General Public License.
### 13. Use with the GNU Affero General Public License.

Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
Expand All @@ -557,7 +557,7 @@ but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.

#### 14. Revised Versions of this License.
### 14. Revised Versions of this License.

The Free Software Foundation may publish revised and/or new versions
of the GNU General Public License from time to time. Such new versions
Expand All @@ -583,7 +583,7 @@ permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.

#### 15. Disclaimer of Warranty.
### 15. Disclaimer of Warranty.

THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
Expand All @@ -595,7 +595,7 @@ PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE
DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
CORRECTION.

#### 16. Limitation of Liability.
### 16. Limitation of Liability.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR
Expand All @@ -607,7 +607,7 @@ LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM
TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER
PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

#### 17. Interpretation of Sections 15 and 16.
### 17. Interpretation of Sections 15 and 16.

If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
Expand All @@ -618,7 +618,7 @@ copy of the Program in return for a fee.

END OF TERMS AND CONDITIONS

### How to Apply These Terms to Your New Programs
## How to Apply These Terms to Your New Programs

If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
Expand Down
10 changes: 4 additions & 6 deletions tests/unit-tests/bzip2-helper.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2012-2021 University of California, Los Angeles
* Copyright (c) 2012-2024 University of California, Los Angeles
*
* This file is part of ChronoSync, synchronization library for distributed realtime
* applications for NDN.
Expand All @@ -21,10 +21,9 @@

#include "tests/boost-test.hpp"

namespace chronosync {
namespace test {
namespace chronosync::tests {

BOOST_AUTO_TEST_SUITE(TestBzip2Helper)
BOOST_AUTO_TEST_SUITE(Bzip2HelperTests)

BOOST_AUTO_TEST_CASE(Basic)
{
Expand All @@ -46,5 +45,4 @@ BOOST_AUTO_TEST_CASE(Basic)

BOOST_AUTO_TEST_SUITE_END()

} // namespace test
} // namespace chronosync
} // namespace chronosync::tests
26 changes: 13 additions & 13 deletions tests/unit-tests/dummy-forwarder.cpp
@@ -1,6 +1,6 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2012-2023 University of California, Los Angeles
* Copyright (c) 2012-2024 University of California, Los Angeles
*
* This file is part of ChronoSync, synchronization library for distributed realtime
* applications for NDN.
Expand All @@ -22,23 +22,24 @@
#include <boost/asio/io_context.hpp>
#include <boost/asio/post.hpp>

namespace ndn {
namespace chronosync {
namespace chronosync::tests {

DummyForwarder::DummyForwarder(boost::asio::io_context& io, KeyChain& keyChain)
using ndn::DummyClientFace;

DummyForwarder::DummyForwarder(boost::asio::io_context& io, ndn::KeyChain& keyChain)
: m_io(io)
, m_keyChain(keyChain)
{
}

Face&
ndn::Face&
DummyForwarder::addFace()
{
auto face = std::make_shared<DummyClientFace>(m_io, m_keyChain, DummyClientFace::Options{true, true});
DummyClientFace* self = &*face; // to prevent memory leak

face->onSendInterest.connect([this, self] (const Interest& interest) {
Interest i(interest);
face->onSendInterest.connect([this, self] (const auto& interest) {
ndn::Interest i(interest);
for (auto& otherFace : m_faces) {
if (self == &*otherFace) {
continue;
Expand All @@ -47,8 +48,8 @@ DummyForwarder::addFace()
}
});

face->onSendData.connect([this, self] (const Data& data) {
Data d(data);
face->onSendData.connect([this, self] (const auto& data) {
ndn::Data d(data);
for (auto& otherFace : m_faces) {
if (self == &*otherFace) {
continue;
Expand All @@ -57,8 +58,8 @@ DummyForwarder::addFace()
}
});

face->onSendNack.connect([this, self] (const lp::Nack& nack) {
lp::Nack n(nack);
face->onSendNack.connect([this, self] (const auto& nack) {
ndn::lp::Nack n(nack);
for (auto& otherFace : m_faces) {
if (self == &*otherFace) {
continue;
Expand All @@ -77,5 +78,4 @@ DummyForwarder::removeFaces()
m_faces.clear();
}

} // namespace chronosync
} // namespace ndn
} // namespace chronosync::tests
20 changes: 9 additions & 11 deletions tests/unit-tests/dummy-forwarder.hpp
@@ -1,6 +1,6 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2012-2023 University of California, Los Angeles
* Copyright (c) 2012-2024 University of California, Los Angeles
*
* This file is part of ChronoSync, synchronization library for distributed realtime
* applications for NDN.
Expand All @@ -26,24 +26,23 @@
#ifndef NDN_CHRONOSYNC_UNIT_TESTS_DUMMY_FORWARDER_HPP
#define NDN_CHRONOSYNC_UNIT_TESTS_DUMMY_FORWARDER_HPP

namespace ndn {
namespace chronosync {
namespace chronosync::tests {

/**
* @brief Very basic implementation of the dummy forwarder
* @brief Very basic implementation of a dummy forwarder.
*
* Interests expressed by any added face, will be forwarded to all other faces.
* Similarly, any pushed data, will be pushed to all other faces.
*/
class DummyForwarder
{
public:
DummyForwarder(boost::asio::io_context& io, KeyChain& keyChain);
DummyForwarder(boost::asio::io_context& io, ndn::KeyChain& keyChain);

Face&
ndn::Face&
addFace();

Face&
ndn::Face&
getFace(size_t nFace)
{
return *m_faces.at(nFace);
Expand All @@ -54,11 +53,10 @@ class DummyForwarder

private:
boost::asio::io_context& m_io;
KeyChain& m_keyChain;
std::vector<std::shared_ptr<DummyClientFace>> m_faces;
ndn::KeyChain& m_keyChain;
std::vector<std::shared_ptr<ndn::DummyClientFace>> m_faces;
};

} // namespace chronosync
} // namespace ndn
} // namespace chronosync::tests

#endif // NDN_CHRONOSYNC_UNIT_TESTS_DUMMY_FORWARDER_HPP
8 changes: 3 additions & 5 deletions tests/unit-tests/test-diff-state.cpp
@@ -1,6 +1,6 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2012-2019 University of California, Los Angeles
* Copyright (c) 2012-2024 University of California, Los Angeles
*
* This file is part of ChronoSync, synchronization library for distributed realtime
* applications for NDN.
Expand All @@ -22,8 +22,7 @@

#include "tests/boost-test.hpp"

namespace chronosync {
namespace test {
namespace chronosync::tests {

BOOST_AUTO_TEST_SUITE(DiffStateTests)

Expand Down Expand Up @@ -137,5 +136,4 @@ BOOST_AUTO_TEST_CASE(Container)

BOOST_AUTO_TEST_SUITE_END()

} // namespace test
} // namespace chronosync
} // namespace chronosync::tests
10 changes: 4 additions & 6 deletions tests/unit-tests/test-interest-table.cpp
@@ -1,6 +1,6 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2012-2022 University of California, Los Angeles
* Copyright (c) 2012-2024 University of California, Los Angeles
*
* This file is part of ChronoSync, synchronization library for distributed realtime
* applications for NDN.
Expand All @@ -24,8 +24,7 @@

#include <unistd.h>

namespace chronosync {
namespace test {
namespace chronosync::tests {

class InterestTableFixture : public ndn::tests::UnitTestTimeFixture
{
Expand Down Expand Up @@ -71,7 +70,7 @@ class InterestTableFixture : public ndn::tests::UnitTestTimeFixture
ndn::ConstBufferPtr digest3;
};

BOOST_FIXTURE_TEST_SUITE(InterestTableTest, InterestTableFixture)
BOOST_FIXTURE_TEST_SUITE(InterestTableTests, InterestTableFixture)

BOOST_AUTO_TEST_CASE(Container)
{
Expand Down Expand Up @@ -143,5 +142,4 @@ BOOST_AUTO_TEST_CASE(Expire)

BOOST_AUTO_TEST_SUITE_END()

} // namespace test
} // namespace chronosync
} // namespace chronosync::tests

0 comments on commit 30c41ec

Please sign in to comment.