| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
#include <aws/common/string.h> |
| 7 |
#include <proof_helpers/make_common_data_structures.h> |
| 8 |
#include <proof_helpers/utils.h> |
| 9 |
|
| 10 |
void aws_string_compare_harness() { |
| 11 |
struct aws_string *str_a = nondet_bool() ? nondet_allocate_string_bounded_length(MAX_STRING_LEN) : NULL; |
| 12 |
struct aws_string *str_b = |
| 13 |
nondet_bool() ? (nondet_bool() ? str_a : NULL) : nondet_allocate_string_bounded_length(MAX_STRING_LEN); |
| 14 |
__CPROVER_assume(IMPLIES(str_a != NULL, aws_string_is_valid(str_a))); |
| 15 |
__CPROVER_assume(IMPLIES(str_b != NULL, aws_string_is_valid(str_b))); |
| 16 |
bool nondet_parameter = nondet_bool(); |
| 17 |
if (aws_string_compare(str_a, nondet_parameter ? str_b : str_a) == AWS_OP_SUCCESS) { |
| 18 |
if (nondet_parameter && str_a && str_b) { |
| 19 |
assert_bytes_match(str_a->bytes, str_b->bytes, str_a->len); |
| 20 |
} |
| 21 |
} |
| 22 |
if (str_a) { |
| 23 |
assert(aws_string_is_valid(str_a)); |
| 24 |
} |
| 25 |
if (str_b) { |
| 26 |
assert(aws_string_is_valid(str_b)); |
| 27 |
} |
| 28 |
} |