mirror of
https://github.com/google/benchmark.git
synced 2025-03-14 03:10:22 +08:00
Guard ASSERT_THROWS checks with BENCHMARK_HAS_NO_EXCEPTIONS (#874)
* Guard ASSERT_THROWS checks with BENCHMARK_HAS_NO_EXCEPTIONS This allows the test be run with exceptions turned off * Add myself to CONTRIBUTORS I don't need to be added to AUTHORS, as I am a Google employee
This commit is contained in:
parent
bf4f2ea0bd
commit
d2fc7fe659
@ -41,6 +41,7 @@ Eugene Zhuk <eugene.zhuk@gmail.com>
|
||||
Evgeny Safronov <division494@gmail.com>
|
||||
Federico Ficarelli <federico.ficarelli@gmail.com>
|
||||
Felix Homann <linuxaudio@showlabor.de>
|
||||
Geoffrey Martin-Noble <gcmn@google.com> <gmngeoffrey@gmail.com>
|
||||
Hannes Hauswedell <h2@fsfe.org>
|
||||
Ismael Jimenez Martinez <ismael.jimenez.martinez@gmail.com>
|
||||
Jern-Kuan Leong <jernkuan@gmail.com>
|
||||
|
@ -3,6 +3,7 @@
|
||||
//===---------------------------------------------------------------------===//
|
||||
|
||||
#include "../src/string_util.h"
|
||||
#include "../src/internal_macros.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
namespace {
|
||||
@ -60,9 +61,11 @@ TEST(StringUtilTest, stoul) {
|
||||
EXPECT_EQ(0xBEEFul, benchmark::stoul("BEEF", &pos, 16));
|
||||
EXPECT_EQ(4ul, pos);
|
||||
}
|
||||
#ifndef BENCHMARK_HAS_NO_EXCEPTIONS
|
||||
{
|
||||
ASSERT_THROW(benchmark::stoul("this is a test"), std::invalid_argument);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST(StringUtilTest, stoi) {
|
||||
@ -106,9 +109,11 @@ TEST(StringUtilTest, stoi) {
|
||||
EXPECT_EQ(0xBEEF, benchmark::stoi("BEEF", &pos, 16));
|
||||
EXPECT_EQ(4ul, pos);
|
||||
}
|
||||
#ifndef BENCHMARK_HAS_NO_EXCEPTIONS
|
||||
{
|
||||
ASSERT_THROW(benchmark::stoi("this is a test"), std::invalid_argument);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST(StringUtilTest, stod) {
|
||||
@ -138,9 +143,11 @@ TEST(StringUtilTest, stod) {
|
||||
EXPECT_EQ(-1.25e+9, benchmark::stod("-1.25e+9", &pos));
|
||||
EXPECT_EQ(8ul, pos);
|
||||
}
|
||||
#ifndef BENCHMARK_HAS_NO_EXCEPTIONS
|
||||
{
|
||||
ASSERT_THROW(benchmark::stod("this is a test"), std::invalid_argument);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
} // end namespace
|
||||
|
Loading…
Reference in New Issue
Block a user