process_uptime_ut.cpp 502 B

1234567891011121314151617
  1. #include <library/cpp/testing/unittest/registar.h>
  2. #include "base.h"
  3. #include "process_uptime.h"
  4. #include "uptime.h"
  5. Y_UNIT_TEST_SUITE(TestProcessUptimeSuite) {
  6. Y_UNIT_TEST(TestProcessUptime) {
  7. auto t0 = Uptime();
  8. auto t1 = ProcessUptime();
  9. UNIT_ASSERT(t1 < TDuration::Minutes(30));
  10. UNIT_ASSERT(t0 > t1);
  11. Sleep(TDuration::MilliSeconds(50)); // typical uptime resolution is 10-16 ms
  12. auto t2 = ProcessUptime();
  13. UNIT_ASSERT(t2 >= t1);
  14. }
  15. }