fix chrono_test
All checks were successful
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (Debug) (push) Successful in 1m23s
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (Release) (push) Successful in 1m43s
linux-arm-gcc / linux-gcc-arm (Debug) (push) Successful in 1m36s
linux-arm-gcc / linux-gcc-arm (Release) (push) Successful in 1m32s
linux-arm-gcc / linux-gcc-armhf (Debug) (push) Successful in 1m54s
linux-arm-gcc / linux-gcc-armhf (Release) (push) Successful in 1m40s
linux-mips-gcc / linux-gcc-mipsel (Debug) (push) Successful in 1m23s
linux-mips-gcc / linux-gcc-mipsel (Release) (push) Successful in 2m12s
linux-mips64-gcc / linux-gcc-mips64el (Debug) (push) Successful in 1m20s
linux-mips64-gcc / linux-gcc-mips64el (Release) (push) Successful in 1m33s
linux-riscv64-gcc / linux-gcc-riscv64 (Debug) (push) Successful in 3m29s
linux-riscv64-gcc / linux-gcc-riscv64 (Release) (push) Successful in 1m40s
linux-x64-gcc / linux-gcc (Debug) (push) Successful in 1m56s
linux-x64-gcc / linux-gcc (Release) (push) Successful in 2m1s
linux-x86-gcc / linux-gcc (Debug) (push) Successful in 2m17s
linux-x86-gcc / linux-gcc (Release) (push) Successful in 2m15s
All checks were successful
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (Debug) (push) Successful in 1m23s
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (Release) (push) Successful in 1m43s
linux-arm-gcc / linux-gcc-arm (Debug) (push) Successful in 1m36s
linux-arm-gcc / linux-gcc-arm (Release) (push) Successful in 1m32s
linux-arm-gcc / linux-gcc-armhf (Debug) (push) Successful in 1m54s
linux-arm-gcc / linux-gcc-armhf (Release) (push) Successful in 1m40s
linux-mips-gcc / linux-gcc-mipsel (Debug) (push) Successful in 1m23s
linux-mips-gcc / linux-gcc-mipsel (Release) (push) Successful in 2m12s
linux-mips64-gcc / linux-gcc-mips64el (Debug) (push) Successful in 1m20s
linux-mips64-gcc / linux-gcc-mips64el (Release) (push) Successful in 1m33s
linux-riscv64-gcc / linux-gcc-riscv64 (Debug) (push) Successful in 3m29s
linux-riscv64-gcc / linux-gcc-riscv64 (Release) (push) Successful in 1m40s
linux-x64-gcc / linux-gcc (Debug) (push) Successful in 1m56s
linux-x64-gcc / linux-gcc (Release) (push) Successful in 2m1s
linux-x86-gcc / linux-gcc (Debug) (push) Successful in 2m17s
linux-x86-gcc / linux-gcc (Release) (push) Successful in 2m15s
This commit is contained in:
parent
6e7d46c259
commit
4fc64d5028
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user