Skip to content

Commit 955fd76

Browse files
committed
Add documentation for CPROVER_enum_is_in_range
Adds documentation of how to use the CPROVER_enum_is_in_range function to explain to a user how to use this function.
1 parent a4a0c1a commit 955fd76

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

doc/cprover-manual/api.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,38 @@ stored in the given arrays are equal. The function
125125
the array **dest**. The function **\_\_CPROVER\_array\_set** initializes
126126
the array **dest** with the given value.
127127
128+
129+
#### \_\_CPROVER\_enum\_is\_in\_range
130+
131+
```C
132+
__CPROVER_bool __CPROVER_enum_is_in_range();
133+
```
134+
135+
The function **\_\_CPROVER\_enum\_is\_in\_range** is used to check
136+
that an enumeration has one of the defined enumeration values. In
137+
the following example `__CPROVER_enum_is_in_range(ev1)` will return
138+
true and the assertion will pass
139+
```C
140+
enum my_enum { first, second };
141+
142+
int main()
143+
{
144+
enum my_enum ev1 = second;
145+
assert(__CPROVER_enum_is_in_range(ev1));
146+
}
147+
```
148+
However, in the example below the assertion will fail
149+
```C
150+
enum my_enum { first, second };
151+
152+
int main()
153+
{
154+
enum my_enum ev1 = second + 1;
155+
assert(__CPROVER_enum_is_in_range(ev1));
156+
}
157+
```
158+
159+
128160
#### Uninterpreted Functions
129161

130162
Uninterpreted functions are documented [here](./modeling-nondeterminism.md)).

0 commit comments

Comments
 (0)