feat/support_fiber #2

Merged
tqcq merged 57 commits from feat/support_fiber into master 2024-06-21 10:33:52 +08:00
Showing only changes of commit 4fc64d5028 - Show all commits

View File

@ -5,8 +5,9 @@
namespace tile {
static constexpr auto one_ms = std::chrono::milliseconds(1);
static constexpr auto kTestN = 1000;
long AvageTime(std::function<long()> f, std::size_t n = 100) {
long AvageTime(std::function<long()> f, std::size_t n = kTestN) {
long double total = 0;
for (std::size_t i = 0; i != n; ++i) {
total += 1.0f / n * f();
@ -34,7 +35,7 @@ TEST(CoarseSystemClock, Compare) {
return (ReadCoarseSystemClock() - std::chrono::system_clock::now()) /
one_ms;
});
ASSERT_NEAR(diff, 0, 50);
ASSERT_NEAR(diff, 0, kTestN);
}
TEST(CoarseSteadyClock, Compare) {
@ -42,6 +43,6 @@ TEST(CoarseSteadyClock, Compare) {
return (ReadCoarseSteadyClock() - std::chrono::steady_clock::now()) /
one_ms;
});
ASSERT_NEAR(diff, 0, 50);
ASSERT_NEAR(diff, 0, kTestN);
}
} // namespace tile