@@ -214,15 +214,6 @@ private IsSatisfiableTestCase(String expr, String... expectedFragments) {
214214 }
215215 }
216216
217- @ Test
218- public void isSatisfiable_typeConversionApproximation () throws Exception {
219- CelAbstractSyntaxTree astInt = CEL .compile ("type(int('1')) == int" ).getAst ();
220- assertThat (VERIFIER .isSatisfiable (astInt ).status ()).isEqualTo (VerificationStatus .VERIFIED );
221-
222- CelAbstractSyntaxTree astDouble = CEL .compile ("type(double('1.5')) == double" ).getAst ();
223- assertThat (VERIFIER .isSatisfiable (astDouble ).status ()).isEqualTo (VerificationStatus .VERIFIED );
224- }
225-
226217 @ Test
227218 public void isSatisfiable_success (@ TestParameter IsSatisfiableTestCase testCase )
228219 throws Exception {
@@ -373,6 +364,11 @@ private enum IsSatisfiableInconclusiveTestCase {
373364 APPROXIMATED_INT_TO_STRING ("string(123) == '123'" ),
374365 APPROXIMATED_RANGE ("int('123') > 100 && int('123') < 200" ),
375366 APPROXIMATED_BRANCHING ("int('123') == 123 ? x > 5 : false" ),
367+ APPROXIMATED_STRING_TO_INT_CONSTRAINED ("string_var == 'abc' && int(string_var) == 5" ),
368+ // int('x') errors at runtime, so type() of an approximate argument is approximate too.
369+ APPROXIMATED_TYPE_OF_CONVERSION ("type(int('1')) == int" ),
370+ APPROXIMATED_TYPE_OF_CONSTRAINED_CONVERSION (
371+ "string_var == 'abc' && type(int(string_var)) == int" ),
376372 // Containers are only type-constrained up to the unroll limit, so observing one through dyn may
377373 // expose an element beyond it that violates the static type.
378374 BEYOND_BMC_LIMIT_DYN_LIST_LITERAL_EQUALITY (
@@ -1679,22 +1675,6 @@ private enum IsAlwaysTrueViolationTestCase {
16791675 "Counterexample input:" ,
16801676 "x = -9223372036854775808" ,
16811677 "y = -1" ),
1682- UNINTERPRETED_CONVERSION_CAN_ERROR_INT_FROM_STRING (
1683- "int(string_var) == int(string_var)" ,
1684- "Condition is not always true\\ ." ,
1685- "Counterexample input:" ),
1686- UNINTERPRETED_CONVERSION_CAN_ERROR_TIMESTAMP_FROM_STRING (
1687- "timestamp(string_var) == timestamp(string_var)" ,
1688- "Condition is not always true\\ ." ,
1689- "Counterexample input:" ),
1690- UNINTERPRETED_CONVERSION_CAN_ERROR_DURATION_FROM_STRING (
1691- "duration(string_var) == duration(string_var)" ,
1692- "Condition is not always true\\ ." ,
1693- "Counterexample input:" ),
1694- UNINTERPRETED_CONVERSION_CAN_ERROR_BOOL_FROM_STRING (
1695- "bool(string_var) == bool(string_var)" ,
1696- "Condition is not always true\\ ." ,
1697- "Counterexample input:" ),
16981678 LIST_INDEX_OUT_OF_BOUNDS_AT_BMC_LIMIT (
16991679 "size(int_list) == 5 ? int_list[5] == 1 : true" ,
17001680 "Condition is not always true\\ ." ,
@@ -1760,6 +1740,8 @@ private enum IsInconclusiveTestCase {
17601740 TIMESTAMP_BOUNDS_VALID ("timestamp('2023-01-01T00:00:00Z') <= timestamp(253402300799)" ),
17611741 UNINTERPRETED_FUNCTION ("request.matches('^[a-z]+$')" ),
17621742 INT_STRING_UNINTERPRETED ("int('123') == 123" ),
1743+ INT_STRING_VAR_UNINTERPRETED ("int(string_var) == int(string_var)" ),
1744+ INT_CONSTRAINED_STRING_VAR_UNINTERPRETED ("string_var != '5' || int(string_var) == 5" ),
17631745 LIST_WITH_APPROXIMATE_ELEMENT ("[request.matches('a')]" ),
17641746 MAP_WITH_APPROXIMATE_KEY ("{request.matches('a'): 1}" ),
17651747 MAP_WITH_APPROXIMATE_VALUE ("{1: request.matches('a')}" ),
@@ -1830,6 +1812,9 @@ private enum EquivalenceInconclusiveTestCase {
18301812 "int_list == [1, 2, 3, 4, 5, 6] ? int_list.all(x, x > 0) : true" ,
18311813 "int_list == [1, 2, 3, 4, 5, 6] ? (int_list.all(x, x > 0) || size(int_list) == 6) : true" ),
18321814 APPROXIMATION_DIVERGENCE ("request.matches('a') == true" , "request.matches('a') == false" ),
1815+ TIMESTAMP_STRING_CONVERSION_NOT_BOUNDED_BY_WHOLE_SECONDS (
1816+ "timestamp(string_var) <= timestamp(253402300799)" ,
1817+ "timestamp(string_var) == timestamp(string_var)" ),
18331818 IDENTITY_ERASURE_INCONGRUENCE (
18341819 "size(int_list) == 6 && size(int_list_2) == 6 ? (int_list.map(x, x + 1) + [1]) : [1]" ,
18351820 "size(int_list) == 6 && size(int_list_2) == 6 ? (int_list_2.map(x, x + 1) + [1]) : [1]" ),
@@ -2458,9 +2443,6 @@ private enum EquivalenceViolationTestCase {
24582443 "google.protobuf.Duration{seconds: 100, nanos: 500}" ,
24592444 "google.protobuf.Duration{seconds: 100}" ),
24602445 TIMESTAMP_VARIABLE_NOT_BOUNDED_BY_WHOLE_SECONDS ("ts <= timestamp(253402300799)" , "true" ),
2461- TIMESTAMP_STRING_CONVERSION_NOT_BOUNDED_BY_WHOLE_SECONDS (
2462- "timestamp(string_var) <= timestamp(253402300799)" ,
2463- "timestamp(string_var) == timestamp(string_var)" ),
24642446 TIMESTAMP_STRUCT_TO_INT_NEGATIVE_SECONDS_NEGATIVE_NANOS_FAILS (
24652447 "int(google.protobuf.Timestamp{seconds: -1, nanos: -1}) == -1" , "false" ),
24662448 TIMESTAMP_STRUCT_TO_INT_NEGATIVE_SECONDS_NANOS_TOO_LARGE_FAILS (
0 commit comments