1 | #include "../src/benchmark_runner.h" |
2 | #include "gtest/gtest.h" |
3 | |
4 | namespace { |
5 | |
6 | TEST(ParseMinTimeTest, InvalidInput) { |
7 | #if GTEST_HAS_DEATH_TEST |
8 | // Tests only runnable in debug mode (when BM_CHECK is enabled). |
9 | #ifndef NDEBUG |
10 | #ifndef TEST_BENCHMARK_LIBRARY_HAS_NO_ASSERTIONS |
11 | ASSERT_DEATH_IF_SUPPORTED( |
12 | { benchmark::internal::ParseBenchMinTime("abc" ); }, |
13 | "Malformed seconds value passed to --benchmark_min_time: `abc`" ); |
14 | |
15 | ASSERT_DEATH_IF_SUPPORTED( |
16 | { benchmark::internal::ParseBenchMinTime("123ms" ); }, |
17 | "Malformed seconds value passed to --benchmark_min_time: `123ms`" ); |
18 | |
19 | ASSERT_DEATH_IF_SUPPORTED( |
20 | { benchmark::internal::ParseBenchMinTime("1z" ); }, |
21 | "Malformed seconds value passed to --benchmark_min_time: `1z`" ); |
22 | |
23 | ASSERT_DEATH_IF_SUPPORTED( |
24 | { benchmark::internal::ParseBenchMinTime("1hs" ); }, |
25 | "Malformed seconds value passed to --benchmark_min_time: `1hs`" ); |
26 | #endif |
27 | #endif |
28 | #endif |
29 | } |
30 | } // namespace |
31 | |