From bff55335d5e96ba1df2d81709b3f6d2520a6f178 Mon Sep 17 00:00:00 2001 From: erestor Date: Fri, 17 May 2024 11:35:34 +0300 Subject: [PATCH 1/3] add test for NotCopyable type. Because submission https://admin.contest.yandex.ru/submissions/114107819 passes --- tasks/tests/deque_test.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tasks/tests/deque_test.cpp b/tasks/tests/deque_test.cpp index 04860e2..c6909f8 100644 --- a/tasks/tests/deque_test.cpp +++ b/tasks/tests/deque_test.cpp @@ -212,7 +212,16 @@ struct NotDefaultConstructible { int x = 0; }; +struct NotCopyable { + NotCopyable() = default; + NotCopyable(const NotCopyable&) = delete; +}; + void test6() { + { + Deque deq(10); + } + Deque d; NotDefaultConstructible ndc = VerySpecialType(-1); From ce32c503de7fec44233515a83bc067b3ccfa5457 Mon Sep 17 00:00:00 2001 From: erestor Date: Fri, 17 May 2024 12:50:14 +0300 Subject: [PATCH 2/3] add test for operator[](Key&&) --- tasks/tests/unordered_map_test.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tasks/tests/unordered_map_test.cpp b/tasks/tests/unordered_map_test.cpp index 83cf8f6..3b20e6a 100644 --- a/tasks/tests/unordered_map_test.cpp +++ b/tasks/tests/unordered_map_test.cpp @@ -197,6 +197,11 @@ namespace std { void TestNoRedundantCopies() { // std::cerr << "Test no redundant copies started" << std::endl; + { + UnorderedMap m; + m[VerySpecialType(0)] = 0; + } + UnorderedMap m; // std::cerr << "m created" << std::endl; m.reserve(10); From b1477c72ffbed9d1b23a0994c9ef9d3a71a16895 Mon Sep 17 00:00:00 2001 From: erestor Date: Sat, 18 May 2024 14:49:56 +0300 Subject: [PATCH 3/3] add const key check --- tasks/tests/unordered_map_test.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tasks/tests/unordered_map_test.cpp b/tasks/tests/unordered_map_test.cpp index 3b20e6a..2fc49fe 100644 --- a/tasks/tests/unordered_map_test.cpp +++ b/tasks/tests/unordered_map_test.cpp @@ -1,6 +1,7 @@ #include "unordered_map.h" //#include +#include // std::ignore #include #include #include @@ -14,8 +15,16 @@ using UnorderedMap = std::unordered_map; */ +void TestConstKey() { + UnorderedMap m; + m[1] = 1; + assert(std::is_const_vfirst)>); +} + void SimpleTest() { // std::cerr << "starting simple test" << std::endl; + TestConstKey(); + UnorderedMap m; m["aaaaa"] = 5;