]> git.proxmox.com Git - ceph.git/blob - ceph/src/seastar/fmt/test/test-assert.h
update download target update for octopus release
[ceph.git] / ceph / src / seastar / fmt / test / test-assert.h
1 // Formatting library for C++ - test version of FMT_ASSERT
2 //
3 // Copyright (c) 2012 - present, Victor Zverovich
4 // All rights reserved.
5 //
6 // For the license information refer to format.h.
7
8 #ifndef FMT_TEST_ASSERT_H_
9 #define FMT_TEST_ASSERT_H_
10
11 #include <stdexcept>
12 #include "gtest.h"
13
14 class assertion_failure : public std::logic_error {
15 public:
16 explicit assertion_failure(const char *message) : std::logic_error(message) {}
17 };
18
19 #define FMT_ASSERT(condition, message) \
20 if (!(condition)) throw assertion_failure(message);
21
22 // Expects an assertion failure.
23 #define EXPECT_ASSERT(stmt, message) \
24 FMT_TEST_THROW_(stmt, assertion_failure, message, GTEST_NONFATAL_FAILURE_)
25
26 #endif // FMT_TEST_ASSERT_H_