CBMC
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
invariant.cpp
Go to the documentation of this file.
1
2
3#include "invariant.h"
4
5#include <util/invariant.h>
6
7#include <utility>
8
10{
11 return invariant_failure_containingt{std::move(expected)};
12}
13
15 std::string expected)
16 : expected{std::move(expected)}
17{
18}
19
21 const invariant_failedt &exception) const
22{
23 const std::string what = exception.what();
24 return what.find(expected) != std::string::npos;
25}
26
28{
29 return std::string{"invariant_failedt with `.what' containing - \""} +
30 expected + "\"";
31}
32
33std::ostream &
34operator<<(std::ostream &out, const invariant_failedt &invariant_failed)
35{
36 out << "invariant_failedt where `.what()' is \"" << invariant_failed.what()
37 << "\"";
38 return out;
39}
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Definition ai.h:562
A logic error, augmented with a distinguished field to hold a backtrace.
Definition c_errors.h:28
virtual std::string what() const noexcept
bool match(const invariant_failedt &exception) const override
Definition invariant.cpp:20
invariant_failure_containingt(std::string expected)
Definition invariant.cpp:14
std::string describe() const override
Definition invariant.cpp:27
STL namespace.
std::ostream & operator<<(std::ostream &out, const invariant_failedt &invariant_failed)
Printing of invariant_failedt for test failure messages.
Definition invariant.cpp:34
invariant_failure_containingt invariant_failure_containing(std::string expected)
Author: Diffblue Ltd.
Definition invariant.cpp:9