MCPcopy Create free account
hub / github.com/apache/thrift / apiTest

Method apiTest

lib/cpp/test/concurrency/ThreadManagerTests.h:379–392  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

377
378
379 bool apiTest() {
380
381 // prove currentTime has milliseconds granularity since many other things depend on it
382 int64_t a = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now().time_since_epoch()).count();
383 sleep_(100);
384 int64_t b = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now().time_since_epoch()).count();
385 if (b - a < 50 || b - a > 150) {
386 std::cerr << "\t\t\texpected 100ms gap, found " << (b-a) << "ms gap instead." << '\n';
387 return false;
388 }
389
390 return apiTestWithThreadFactory(shared_ptr<ThreadFactory>(new ThreadFactory()));
391
392 }
393
394 bool apiTestWithThreadFactory(shared_ptr<ThreadFactory> threadFactory)
395 {

Callers 1

mainFunction · 0.80

Calls 3

nowFunction · 0.85
sleep_Function · 0.85
countMethod · 0.45

Tested by

no test coverage detected