Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions modules/task/include/task.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,16 +310,16 @@ class Task {
/// @tparam InType Input data type.
/// @tparam OutType Output data type.
template <typename InType, typename OutType>
using TaskPtr = std::shared_ptr<Task<InType, OutType>>;
using TaskPtr = std::unique_ptr<Task<InType, OutType>>;

/// @brief Constructs and returns a shared pointer to a task with the given input.
/// @brief Constructs and returns a pointer to a task with the given input.
/// @tparam TaskType Type of the task to create.
/// @tparam InType Type of the input.
/// @param in Input to pass to the task constructor.
/// @return Shared a pointer to the newly created task.
/// @return Unique pointer to the newly created task.
template <typename TaskType, typename InType>
std::shared_ptr<TaskType> TaskGetter(const InType &in) {
return std::make_shared<TaskType>(in);
std::unique_ptr<TaskType> TaskGetter(const InType &in) {
return std::make_unique<TaskType>(in);
}

} // namespace ppc::task
8 changes: 4 additions & 4 deletions modules/task/tests/task_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -399,23 +399,23 @@ TEST(TaskTest, GetDynamicTypeReturnsCorrectEnum) {
}

TEST(TaskTest, ValidationThrowsIfCalledTwice) {
auto task = std::make_shared<DummyTask>();
auto task = std::make_unique<DummyTask>();
task->Validation();
EXPECT_THROW(task->Validation(), std::runtime_error);
}

TEST(TaskTest, PreProcessingThrowsIfCalledBeforeValidation) {
auto task = std::make_shared<DummyTask>();
auto task = std::make_unique<DummyTask>();
EXPECT_THROW(task->PreProcessing(), std::runtime_error);
}

TEST(TaskTest, RunThrowsIfCalledBeforePreProcessing) {
auto task = std::make_shared<DummyTask>();
auto task = std::make_unique<DummyTask>();
EXPECT_THROW(task->Run(), std::runtime_error);
}

TEST(TaskTest, PostProcessingThrowsIfCalledBeforeRun) {
auto task = std::make_shared<DummyTask>();
auto task = std::make_unique<DummyTask>();
task->Validation();
task->PreProcessing();
EXPECT_THROW(task->PostProcessing(), std::runtime_error);
Expand Down
Loading