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

Method TestOverrideTime

library/cpp/coroutine/engine/coroutine_ut.cpp:995–1016  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

993}
994
995void TCoroTest::TestOverrideTime() {
996 class TTime: public NCoro::ITime {
997 public:
998 TInstant Now() override {
999 return Current;
1000 }
1001
1002 TInstant Current = TInstant::Zero();
1003 };
1004
1005 TTime time;
1006 TContExecutor executor{1024*1024, IPollerFace::Default(), nullptr, nullptr, NCoro::NStack::EGuard::Canary, Nothing(), &time};
1007
1008 executor.CreateOwned([&](TCont* cont) {
1009 UNIT_ASSERT_EQUAL(cont->Executor()->Now(), TInstant::Zero());
1010 time.Current = TInstant::Seconds(1);
1011 cont->SleepD(TInstant::Seconds(1));
1012 UNIT_ASSERT_EQUAL(cont->Executor()->Now(), TInstant::Seconds(1));
1013 }, "coro");
1014
1015 executor.Execute();
1016}
1017
1018void TCoroTest::TestCancelWithException() {
1019 TContExecutor exec(32000);

Callers

nothing calls this directly

Calls 9

DefaultFunction · 0.85
NothingFunction · 0.85
ZeroFunction · 0.85
CreateOwnedMethod · 0.80
SleepDMethod · 0.80
SecondsFunction · 0.50
NowMethod · 0.45
ExecutorMethod · 0.45
ExecuteMethod · 0.45

Tested by

no test coverage detected