MCPcopy Create free account
hub / github.com/catboost/catboost / TestEventQueue

Method TestEventQueue

library/cpp/coroutine/engine/coroutine_ut.cpp:850–868  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

848}
849
850void TCoroTest::TestEventQueue() {
851 NCoro::TEventWaitQueue queue;
852 UNIT_ASSERT(queue.Empty());
853 UNIT_ASSERT_VALUES_EQUAL(queue.WakeTimedout(TInstant()), TInstant());
854 TContExecutor exec(32000);
855 exec.Execute([](TCont* cont, void* arg) {
856 NCoro::TEventWaitQueue* q = (NCoro::TEventWaitQueue*)arg;
857 TTimerEvent ev(cont, TInstant::Max());
858 TTimerEvent ev2(cont, TInstant::Seconds(12345));
859 q->Register(&ev);
860 UNIT_ASSERT_VALUES_EQUAL(q->WakeTimedout(TInstant::Seconds(12344)), TInstant::Max());
861 UNIT_ASSERT_VALUES_EQUAL(q->WakeTimedout(TInstant::Seconds(12344)), TInstant::Max());
862 q->Register(&ev2);
863 UNIT_ASSERT_VALUES_EQUAL(q->WakeTimedout(TInstant::Seconds(12344)), TInstant::Seconds(12345));
864 UNIT_ASSERT_VALUES_EQUAL(q->WakeTimedout(TInstant::Seconds(12344)), TInstant::Seconds(12345));
865 UNIT_ASSERT_VALUES_EQUAL(q->WakeTimedout(TInstant::Seconds(12345)), TInstant::Seconds(12345));
866 UNIT_ASSERT_VALUES_EQUAL(q->WakeTimedout(TInstant::Seconds(12345)), TInstant::Max());
867 }, &queue);
868}
869
870void TCoroTest::TestNestedExecutor() {
871#ifndef _win_

Callers

nothing calls this directly

Calls 7

TInstantClass · 0.85
WakeTimedoutMethod · 0.80
MaxFunction · 0.50
SecondsFunction · 0.50
EmptyMethod · 0.45
ExecuteMethod · 0.45
RegisterMethod · 0.45

Tested by

no test coverage detected