diff options
Diffstat (limited to 'vbench/src/tests/timer')
-rw-r--r-- | vbench/src/tests/timer/.gitignore | 1 | ||||
-rw-r--r-- | vbench/src/tests/timer/CMakeLists.txt | 9 | ||||
-rw-r--r-- | vbench/src/tests/timer/FILES | 1 | ||||
-rw-r--r-- | vbench/src/tests/timer/timer_test.cpp | 16 |
4 files changed, 27 insertions, 0 deletions
diff --git a/vbench/src/tests/timer/.gitignore b/vbench/src/tests/timer/.gitignore new file mode 100644 index 00000000000..cd37c01446c --- /dev/null +++ b/vbench/src/tests/timer/.gitignore @@ -0,0 +1 @@ +vbench_timer_test_app diff --git a/vbench/src/tests/timer/CMakeLists.txt b/vbench/src/tests/timer/CMakeLists.txt new file mode 100644 index 00000000000..fc50c222ba0 --- /dev/null +++ b/vbench/src/tests/timer/CMakeLists.txt @@ -0,0 +1,9 @@ +# Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +vespa_add_executable(vbench_timer_test_app + SOURCES + timer_test.cpp + DEPENDS + vbench_test + vbench +) +vespa_add_test(NAME vbench_timer_test_app COMMAND vbench_timer_test_app) diff --git a/vbench/src/tests/timer/FILES b/vbench/src/tests/timer/FILES new file mode 100644 index 00000000000..a90924ff2d1 --- /dev/null +++ b/vbench/src/tests/timer/FILES @@ -0,0 +1 @@ +timer_test.cpp diff --git a/vbench/src/tests/timer/timer_test.cpp b/vbench/src/tests/timer/timer_test.cpp new file mode 100644 index 00000000000..150a8d847d6 --- /dev/null +++ b/vbench/src/tests/timer/timer_test.cpp @@ -0,0 +1,16 @@ +// Copyright 2016 Yahoo Inc. 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> + +using namespace vbench; + +IGNORE_TEST("timer") { + Timer timer; + EXPECT_APPROX(0.0, timer.sample(), 0.1); + vespalib::Thread::sleep(1000); + EXPECT_APPROX(1.0, timer.sample(), 0.1); + timer.reset(); + EXPECT_APPROX(0.0, timer.sample(), 0.1); +} + +TEST_MAIN() { TEST_RUN_ALL(); } |