-
Notifications
You must be signed in to change notification settings - Fork 269
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This introduces C syntax for a type __CPROVER_map(domain, codomain) where domain is a list of types and codomain is a type. The type is internal, for modeling purposes within our own library only, and hence not added to user-facing documentation. It replaces arrays with size __CPROVER_infinity, which are now deprecated.
- Loading branch information
Showing
18 changed files
with
152 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
int main() | ||
{ | ||
__CPROVER_map(int, int) my_map; | ||
|
||
my_map = __CPROVER_lambda | ||
{ | ||
int i; | ||
i == 1 ? 10 : 20 | ||
}; | ||
|
||
// should pass | ||
__CPROVER_assert(my_map(1) == 10, "(1)"); | ||
__CPROVER_assert(my_map(2) == 20, "(2)"); | ||
|
||
// should fail | ||
__CPROVER_assert(my_map(0) == 10, "(0)"); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
CORE | ||
basic1.c | ||
|
||
^\[.*\] line \d+ \(1\): FAILURE$ | ||
^\[.*\] line \d+ \(2\): FAILURE$ | ||
^\[.*\] line \d+ \(0\): FAILURE$ | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
^VERIFICATION FAILED$ | ||
-- | ||
^warning: ignoring |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
__CPROVER_map(int, int) nondet_map(); | ||
|
||
int main() | ||
{ | ||
__CPROVER_map(int, int) my_map = nondet_map(); | ||
|
||
__CPROVER_assume(my_map(1) == 10); | ||
__CPROVER_assume(my_map(2) == 20); | ||
|
||
// should pass | ||
__CPROVER_assert(my_map(1) == 10, "(1)"); | ||
__CPROVER_assert(my_map(2) == 20, "(2)"); | ||
|
||
// should fail | ||
__CPROVER_assert(my_map(0) == 10, "(0)"); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
CORE | ||
basic2.c | ||
|
||
^\[.*\] line \d+ \(1\): SUCCESS$ | ||
^\[.*\] line \d+ \(2\): SUCCESS$ | ||
^\[.*\] line \d+ \(0\): FAILURE$ | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
^VERIFICATION FAILED$ | ||
-- | ||
^warning: ignoring |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,7 @@ Author: Daniel Kroening, [email protected] | |
|
||
class ansi_c_declarationt; | ||
class c_bit_field_typet; | ||
class mathematical_function_typet; | ||
class shift_exprt; | ||
|
||
class c_typecheck_baset: | ||
|
@@ -261,6 +262,7 @@ class c_typecheck_baset: | |
virtual void typecheck_code_type(code_typet &type); | ||
virtual void typecheck_typedef_type(typet &type); | ||
virtual void typecheck_c_bit_field_type(c_bit_field_typet &type); | ||
virtual void typecheck_map_type(mathematical_function_typet &); | ||
virtual void typecheck_typeof_type(typet &type); | ||
virtual void typecheck_array_type(array_typet &type); | ||
virtual void typecheck_vector_type(typet &type); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters