Skip to content

Conversation

@Kellesi
Copy link
Collaborator

@Kellesi Kellesi commented Sep 9, 2025

add more tests

@belyshevdenis belyshevdenis changed the title Kf-3 add tests Kf-3 add tests for basic_string Sep 9, 2025
This was referenced Sep 9, 2025
THEN("the string should be shrunk")
{
REQUIRE_NT_SUCCESS(status);
REQUIRE(str == "hi");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ця перевірка повинна включати інше значення, відмінне від оригінального

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

думаю, що тут скоріше була ідея, що якщо кількість символів стрінга співпадає з переданим у ресіз, то стрінга не обрізається, а зменьшується капасіті, судячи з then.
Тест з обрізанням стрінги є вище, тому цей приберу


constexpr [[nodiscard]] NTSTATUS assign(basic_string&& other) noexcept
{
if (auto status = reallocateGrowth(other.size()); !NT_SUCCESS(status))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Яка причина цього виклику?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

прибрала

{
REQUIRE(str.data() != nullptr);
REQUIRE(ptr != nullptr);
REQUIRE(std::string_view(ptr, str.size()) == kExpected);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

оператора перетворення у string_view тут недостатньо щоб порівняти?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

спростила

@Kellesi Kellesi requested a review from Copilot September 15, 2025 13:36
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds comprehensive unit tests for the basic_string class template, covering all major functionality including construction, element access, iterators, size/capacity operations, comparison, modifiers, and string operations.

  • Implements comprehensive test coverage for basic_string class methods
  • Tests both char and wchar_t template instantiations
  • Covers edge cases like empty strings, out-of-bounds access, and memory allocation scenarios

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
test/CMakeLists.txt Adds BasicStringTest.cpp to the test build configuration
test/BasicStringTest.cpp Comprehensive test suite covering all basic_string functionality with 1706 lines of BDD-style tests
include/kf/stl/basic_string New header implementing exception-free basic_string wrapper around std::basic_string

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants