| 848 | } |
| 849 | |
| 850 | void 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 | |
| 870 | void TCoroTest::TestNestedExecutor() { |
| 871 | #ifndef _win_ |