From 62474422534157c4e3d66548d217bd23e0f96a1a Mon Sep 17 00:00:00 2001 From: user Date: Sun, 19 Jul 2026 16:41:22 +0400 Subject: [PATCH] test: reorganize core test directory structure --- Makefile | 4 ++-- tests/{app => }/core/result_test.cpp | 24 +++++++++++++----------- 2 files changed, 15 insertions(+), 13 deletions(-) rename tests/{app => }/core/result_test.cpp (74%) diff --git a/Makefile b/Makefile index 7e419f1..394399b 100644 --- a/Makefile +++ b/Makefile @@ -17,8 +17,8 @@ RESULT_TEST_BIN := $(BUILD_DIR)/result_test LOGGER_TEST_BIN := $(BUILD_DIR)/logger_test SCOPED_FILE_TEST_BIN := $(BUILD_DIR)/scoped_file_test -RESULT_TEST_SRC := tests/app/core/result_test.cpp -LOGGER_TEST_SRC := tests/app/core/logger_test.cpp +RESULT_TEST_SRC := tests/core/result_test.cpp +LOGGER_TEST_SRC := tests/core/logger_test.cpp SCOPED_FILE_TEST_SRC := tests/helpers/scoped_file_test.cpp LOGGER_SRC := logger/src/logger.cpp diff --git a/tests/app/core/result_test.cpp b/tests/core/result_test.cpp similarity index 74% rename from tests/app/core/result_test.cpp rename to tests/core/result_test.cpp index dad0e13..4758879 100644 --- a/tests/app/core/result_test.cpp +++ b/tests/core/result_test.cpp @@ -6,36 +6,38 @@ namespace { +using namespace core; + void testSuccessCreation() { - auto result = core::Result::Success(42); + auto result = Result::Success(42); assert(result.isSuccess()); assert(result.getValue() == 42); } void testFailureCreation() { - auto result = core::Result::Failure("Invalid value"); + auto result = Result::Failure("Invalid value"); assert(result.isFailure()); assert(result.getError() == "Invalid value"); } void testStatusSuccess() { - auto status = core::Status::Success(true); + auto status = Status::Success(true); assert(status.isSuccess()); assert(status.getValue()); } void testStatusFailure() { - auto status = core::Status::Failure("File not found"); + auto status = Status::Failure("File not found"); assert(status.isFailure()); assert(status.getError() == "File not found"); } void testMoveConstruction() { - auto source = core::Result::Success("hello"); + auto source = Result::Success("hello"); auto moved = std::move(source); @@ -44,8 +46,8 @@ void testMoveConstruction() { } void testMoveAssignment() { - auto first = core::Result::Success(10); - auto second = core::Result::Failure("error"); + auto first = Result::Success(10); + auto second = Result::Failure("error"); second = std::move(first); @@ -59,7 +61,7 @@ void testDifferentTypes() { std::string name; }; - auto result = core::Result::Success(User{1, "Alex"}); + auto result = Result::Success(User{1, "Alex"}); assert(result.isSuccess()); assert(result.getValue().id == 1); @@ -67,7 +69,7 @@ void testDifferentTypes() { } void testValueModification() { - auto result = core::Result::Success(10); + auto result = Result::Success(10); result.getValue() = 20; @@ -75,7 +77,7 @@ void testValueModification() { } void testErrorModification() { - auto result = core::Result::Failure("old error"); + auto result = Result::Failure("old error"); result.getError() = "new error"; @@ -85,7 +87,7 @@ void testErrorModification() { void testBasicResultWithCustomError() { enum class ErrorCode { NotFound, PermissionDenied }; - using CustomResult = core::BasicResult; + using CustomResult = BasicResult; auto result = CustomResult::Failure(ErrorCode::PermissionDenied);