CBMC
Toggle main menu visibility
Main Page
Related Pages
Namespaces
Namespace List
Namespace Members
All
a
c
d
e
f
g
j
l
m
r
t
w
Functions
a
c
d
f
g
r
t
w
Typedefs
Enumerations
Classes
Class List
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
Enumerations
a
b
c
d
e
f
g
i
k
l
m
o
p
r
s
t
u
v
w
Enumerator
a
b
c
d
e
f
h
i
k
l
m
n
o
p
q
r
s
t
u
v
Related Symbols
b
c
d
e
g
i
j
m
n
o
s
t
u
v
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
y
z
Variables
_
a
b
c
d
e
f
g
i
l
m
n
o
p
r
s
t
u
w
y
Typedefs
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
Enumerations
_
a
b
c
d
f
g
i
l
m
p
r
s
t
u
v
w
Enumerator
_
a
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
Macros
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
x
y
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
Loading...
Searching...
No Matches
expr_query.h
Go to the documentation of this file.
1
/*******************************************************************\
2
3
Module: Unit test utilities
4
5
Author: Romain Brenguier, romain.brenguier@diffblue.com
6
7
\*******************************************************************/
8
12
13
#ifndef CPROVER_TESTING_UTILS_EXPR_QUERY_H
14
#define CPROVER_TESTING_UTILS_EXPR_QUERY_H
15
16
#include <
testing-utils/use_catch.h
>
17
18
#include <
util/expr_cast.h
>
19
22
template
<
typename
T = exprt>
23
class
expr_queryt
24
{
25
static_assert
(
26
std::is_base_of<exprt, T>::value,
27
"T should inherit from exprt"
);
28
29
public
:
30
explicit
expr_queryt
(T e) :
value
(
std
::move(e))
31
{
32
}
30
explicit
expr_queryt
(T e) :
value
(
std
::move(e)) {
…
}
33
34
template
<
typename
targett>
35
expr_queryt<targett>
as
()
const
36
{
37
auto
result =
expr_try_dynamic_cast<targett>
(
static_cast<
exprt
>
(
value
));
38
REQUIRE
(result);
39
return
expr_queryt<targett>
(*result);
40
}
35
expr_queryt<targett>
as
()
const
{
…
}
41
42
expr_queryt<exprt>
operator[]
(
const
std::size_t i)
const
43
{
44
REQUIRE
(
value
.operands().size() > i);
45
return
expr_queryt<exprt>
(
value
.operands()[i]);
46
}
42
expr_queryt<exprt>
operator[]
(
const
std::size_t i)
const
{
…
}
47
48
T
get
()
const
49
{
50
return
value
;
51
}
48
T
get
()
const
{
…
}
52
53
private
:
54
T
value
;
55
};
23
class
expr_queryt
{
…
};
56
57
inline
expr_queryt<exprt>
make_query
(
exprt
e)
58
{
59
return
expr_queryt<exprt>
(std::move(e));
60
}
57
inline
expr_queryt<exprt>
make_query
(
exprt
e) {
…
}
61
62
#endif
// CPROVER_TESTING_UTILS_EXPR_QUERY_H
ait
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Definition
ai.h:562
expr_queryt
Wrapper for std::optional<exprt> with useful method for queries to be used in unit tests.
Definition
expr_query.h:24
expr_queryt::value
T value
Definition
expr_query.h:54
expr_queryt::get
T get() const
Definition
expr_query.h:48
expr_queryt::expr_queryt
expr_queryt(T e)
Definition
expr_query.h:30
expr_queryt::as
expr_queryt< targett > as() const
Definition
expr_query.h:35
expr_queryt::operator[]
expr_queryt< exprt > operator[](const std::size_t i) const
Definition
expr_query.h:42
exprt
Base class for all expressions.
Definition
expr.h:56
expr_cast.h
Templated functions to cast to specific exprt-derived classes.
make_query
expr_queryt< exprt > make_query(exprt e)
Definition
expr_query.h:57
std
STL namespace.
use_catch.h
unit
testing-utils
expr_query.h
Generated by
1.9.8