aboutsummaryrefslogtreecommitdiffstats
path: root/vbench/src/tests/timer/timer_test.cpp
blob: eda0564d2d83002ba743f642731b68065dc1c172 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/vespalib/testkit/testapp.h>
#include <vbench/test/all.h>
#include <vespa/vespalib/util/time.h>

using namespace vbench;

IGNORE_TEST("timer") {
    Timer timer;
    EXPECT_APPROX(0.0, timer.sample(), 0.1);
    std::this_thread::sleep_for(1000ms);
    EXPECT_APPROX(1.0, timer.sample(), 0.1);
    timer.reset();
    EXPECT_APPROX(0.0, timer.sample(), 0.1);
}

TEST_MAIN() { TEST_RUN_ALL(); }