move generic types into subdir

This commit is contained in:
falsycat 2023-07-15 11:06:32 +09:00
parent 70c41b3c3b
commit 52abaeea1b
7 changed files with 22 additions and 24 deletions

View File

@ -9,16 +9,17 @@ target_sources(nf7_iface
PRIVATE
version.cc
PUBLIC
observer.hh
common/future.hh
common/observer.hh
version.hh
)
add_executable(nf7_iface_test)
target_sources(nf7_iface_test
PRIVATE
future_test.cc
observer_test.hh
observer_test.cc
common/future_test.cc
common/observer_test.hh
common/observer_test.cc
)
target_link_libraries(nf7_iface_test
PRIVATE

View File

@ -8,7 +8,7 @@
#include <variant>
#include <vector>
#include "iface/exception.hh"
#include "iface/common/exception.hh"
namespace nf7 {

View File

@ -1,12 +1,12 @@
// No copyright
#include "iface/future.hh"
#include "iface/common/future.hh"
#include <gtest/gtest.h>
#include <cstdint>
#include <optional>
#include "iface/exception.hh"
#include "iface/common/exception.hh"
TEST(Future, ImmediateValue) {

View File

@ -7,7 +7,7 @@
#include <utility>
namespace nf7::iface {
namespace nf7 {
// T is notified to Observer<T> by Observer<T>::Target.
// All observers should be based on this.
@ -96,4 +96,4 @@ Observer<T>::~Observer() noexcept {
target_.Unregister(*this);
}
} // namespace nf7::iface
} // namespace nf7

View File

@ -1,6 +1,6 @@
// No copyright
#include "iface/observer.hh"
#include "iface/observer_test.hh"
#include "iface/common/observer.hh"
#include "iface/common/observer_test.hh"
#include <gmock/gmock.h>
#include <gtest/gtest.h>
@ -8,12 +8,9 @@
#include <cstdint>
#include <optional>
using namespace nf7::iface;
using namespace nf7::iface::test;
TEST(Observer, NotifyWithMove) {
ObserverTargetMock<int32_t> target;
ObserverMock<int32_t> sut {target};
nf7::test::ObserverTargetMock<int32_t> target;
nf7::test::ObserverMock<int32_t> sut {target};
EXPECT_CALL(sut, NotifyWithMove(111)).Times(1);
@ -21,9 +18,9 @@ TEST(Observer, NotifyWithMove) {
}
TEST(Observer, NotifyWithRef) {
ObserverTargetMock<int32_t> target;
ObserverMock<int32_t> sut1 {target};
ObserverMock<int32_t> sut2 {target};
nf7::test::ObserverTargetMock<int32_t> target;
nf7::test::ObserverMock<int32_t> sut1 {target};
nf7::test::ObserverMock<int32_t> sut2 {target};
EXPECT_CALL(sut1, Notify(111)).Times(1);
EXPECT_CALL(sut2, Notify(111)).Times(1);
@ -32,9 +29,9 @@ TEST(Observer, NotifyWithRef) {
}
TEST(Observer, NotifyDestruction) {
std::optional<ObserverTargetMock<int32_t>> target;
std::optional<nf7::test::ObserverTargetMock<int32_t>> target;
target.emplace();
ObserverMock<int32_t> sut {*target};
nf7::test::ObserverMock<int32_t> sut {*target};
EXPECT_CALL(sut, NotifyDestruction(testing::_)).Times(1);

View File

@ -1,12 +1,12 @@
// No copyright
#pragma once
#include "iface/observer.hh"
#include "iface/common/observer.hh"
#include <gmock/gmock.h>
namespace nf7::iface::test {
namespace nf7::test {
template <typename T>
class ObserverMock : public Observer<T> {
@ -26,4 +26,4 @@ class ObserverTargetMock : public Observer<T>::Target {
using Observer<T>::Target::Notify;
};
} // namespace nf7::iface::test
} // namespace nf7::test