From 84e6e73abbeecc1ed11bcea7d1697ad251f3225e Mon Sep 17 00:00:00 2001 From: levlam Date: Tue, 23 Apr 2019 17:06:53 +0300 Subject: [PATCH] Add vote percentage tests. GitOrigin-RevId: 421aa975080be0f1397357cba8abe088791474ff --- tdactor/td/actor/impl/ConcurrentScheduler.h | 2 +- test/poll.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tdactor/td/actor/impl/ConcurrentScheduler.h b/tdactor/td/actor/impl/ConcurrentScheduler.h index cee2167b4..02f8c22a4 100644 --- a/tdactor/td/actor/impl/ConcurrentScheduler.h +++ b/tdactor/td/actor/impl/ConcurrentScheduler.h @@ -95,7 +95,7 @@ class ConcurrentScheduler : private Scheduler::Callback { unique_ptr iocp_; td::thread iocp_thread_; #endif - int extra_scheduler_; + int32 extra_scheduler_; void on_finish() override { is_finished_.store(true, std::memory_order_relaxed); diff --git a/test/poll.cpp b/test/poll.cpp index 518dd4c7d..668e8ed94 100644 --- a/test/poll.cpp +++ b/test/poll.cpp @@ -45,6 +45,8 @@ TEST(Poll, get_vote_percentage) { check_vote_percentage({1, 1, 1, 1, 1, 1, 2}, 8, {12, 12, 12, 12, 12, 12, 25}); check_vote_percentage({1, 1, 1, 2, 2, 2, 3}, 12, {8, 8, 8, 17, 17, 17, 25}); check_vote_percentage({0, 1, 1, 1, 2, 2, 2, 3}, 12, {0, 8, 8, 8, 17, 17, 17, 25}); + check_vote_percentage({1, 1, 1, 0}, 3, {33, 33, 33, 0}); + check_vote_percentage({0, 1, 1, 1}, 3, {0, 33, 33, 33}); check_vote_percentage({9949, 9950, 9999}, 10000, {99, 100, 100}); check_vote_percentage({1234, 2345, 3456, 2841}, 9876, {12 /* 12.49 */, 24 /* 23.74 */, 35 /* 34.99 */, 29 /* 28.76 */});