mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-18 00:46:36 +00:00

This reverts commit aec6a04b8e99b42eca431fc0b56947937d3a14c2. (google/benchmark still at hash 1576991177ba97a4b2ff6c45950f1fa6e9aa678c as it was in #83488. Also reapplied same extra local diffs) Verified locally.
38 lines
872 B
C++
38 lines
872 B
C++
#include "../include/benchmark/benchmark.h"
|
|
#include "gtest/gtest.h"
|
|
|
|
namespace benchmark {
|
|
namespace internal {
|
|
|
|
namespace {
|
|
|
|
class DummyBenchmark : public Benchmark {
|
|
public:
|
|
DummyBenchmark() : Benchmark("dummy") {}
|
|
void Run(State&) override {}
|
|
};
|
|
|
|
TEST(DefaultTimeUnitTest, TimeUnitIsNotSet) {
|
|
DummyBenchmark benchmark;
|
|
EXPECT_EQ(benchmark.GetTimeUnit(), kNanosecond);
|
|
}
|
|
|
|
TEST(DefaultTimeUnitTest, DefaultIsSet) {
|
|
DummyBenchmark benchmark;
|
|
EXPECT_EQ(benchmark.GetTimeUnit(), kNanosecond);
|
|
SetDefaultTimeUnit(kMillisecond);
|
|
EXPECT_EQ(benchmark.GetTimeUnit(), kMillisecond);
|
|
}
|
|
|
|
TEST(DefaultTimeUnitTest, DefaultAndExplicitUnitIsSet) {
|
|
DummyBenchmark benchmark;
|
|
benchmark.Unit(kMillisecond);
|
|
SetDefaultTimeUnit(kMicrosecond);
|
|
|
|
EXPECT_EQ(benchmark.GetTimeUnit(), kMillisecond);
|
|
}
|
|
|
|
} // namespace
|
|
} // namespace internal
|
|
} // namespace benchmark
|