diff options
author | George Hazan <george.hazan@gmail.com> | 2023-06-04 19:24:05 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2023-06-04 19:24:05 +0300 |
commit | efc336e60cf1331bf5f3213d296981b87b8b2a6c (patch) | |
tree | ea59ea1a324f45f6e8a06cc0887b376bfba90ca9 /protocols/Telegram/tdlib/td/test/tqueue.cpp | |
parent | 6e83622d2af1cec3c759f4cff6efe4df2fe3328c (diff) |
fixes #3537 (Telegram: 32-разрядная версия падает в 64-разрядной Windows) + update to the fresh TDLIB
Diffstat (limited to 'protocols/Telegram/tdlib/td/test/tqueue.cpp')
-rw-r--r-- | protocols/Telegram/tdlib/td/test/tqueue.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/protocols/Telegram/tdlib/td/test/tqueue.cpp b/protocols/Telegram/tdlib/td/test/tqueue.cpp index b1bf94a09e..9c3da0034c 100644 --- a/protocols/Telegram/tdlib/td/test/tqueue.cpp +++ b/protocols/Telegram/tdlib/td/test/tqueue.cpp @@ -1,5 +1,5 @@ // -// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2022 +// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023 // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -68,6 +68,15 @@ class TestTQueue { binlog_->set_callback(std::move(tqueue_binlog)); } + TestTQueue(const TestTQueue &) = delete; + TestTQueue &operator=(const TestTQueue &) = delete; + TestTQueue(TestTQueue &&) = delete; + TestTQueue &operator=(TestTQueue &&) = delete; + + ~TestTQueue() { + td::Binlog::destroy(binlog_path()).ensure(); + } + void restart(td::Random::Xorshift128plus &rnd, td::int32 now) { if (rnd.fast(0, 10) == 0) { baseline_->run_gc(now); @@ -234,17 +243,18 @@ TEST(TQueue, clear) { td::int32 now = 0; td::vector<td::TQueue::EventId> ids; td::Random::Xorshift128plus rnd(123); - for (size_t i = 0; i < 1000000; i++) { + for (size_t i = 0; i < 100000; i++) { tqueue->push(1, td::string(td::Random::fast(100, 500), 'a'), now + 600000, 0, {}).ensure(); } auto tail_id = tqueue->get_tail(1); auto clear_start_time = td::Time::now(); size_t keep_count = td::Random::fast(0, 2); - tqueue->clear(1, keep_count); + auto deleted_events = tqueue->clear(1, keep_count); auto finish_time = td::Time::now(); LOG(INFO) << "Added TQueue events in " << clear_start_time - start_time << " seconds and cleared them in " << finish_time - clear_start_time << " seconds"; CHECK(tqueue->get_size(1) == keep_count); CHECK(tqueue->get_head(1).advance(keep_count).ok() == tail_id); CHECK(tqueue->get_tail(1) == tail_id); + CHECK(deleted_events.size() == 100000 - keep_count); } |