# proto-file: ../../../proto/cel/expr/conformance/test/simple.proto # proto-message: cel.expr.conformance.test.SimpleTestFile name: "proto3" description: "Protocol buffer version 3 tests. See notes for the available set of protos for tests." section { name: "literal_singular" description: "Literals with singular fields set." test { name: "int64_nocontainer" expr: "cel.expr.conformance.proto3.TestAllTypes{single_int64: 17}" value { object_value { [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_int64: 17 } } } } test { name: "int32" container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_int32: -34}" value { object_value { [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_int32: -34 } } } } test { name: "int64" container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_int64: 17}" value { object_value { [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_int64: 17 } } } } test { name: "uint32" container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_uint32: 1u}" value { object_value: { [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_uint32: 1 } } } } test { name: "uint64" container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_uint64: 9999u}" value { object_value { [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_uint64: 9999 } } } } test { name: "sint32" container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_sint32: -3}" value { object_value { [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_sint32: -3 } } } } test { name: "sint64" container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_sint64: 255}" value { object_value { [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_sint64: 255 } } } } test { name: "fixed32" container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_fixed32: 43u}" value { object_value { [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_fixed32: 43 } } } } test { name: "fixed64" container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_fixed64: 1880u}" value { object_value { [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_fixed64: 1880 } } } } test { name: "sfixed32" container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_sfixed32: -404}" value { object_value { [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_sfixed32: -404 } } } } test { name: "sfixed64" container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_sfixed64: -1}" value { object_value { [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_sfixed64: -1 } } } } test { name: "float" container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_float: 3.1416}" value { object_value { [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_float: 3.1416 } } } } test { name: "double" container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_double: 6.022e23}" value { object_value { [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_double: 6.022e23 } } } } test { name: "bool" container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_bool: true}" value { object_value { [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_bool: true } } } } test { name: "string" container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_string: 'foo'}" value { object_value { [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_string: "foo" } } } } test { name: "bytes" container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_bytes: b'\\377'}" value { object_value { [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_bytes: "\377" } } } } } section { name: "literal_wellknown" description: "Literals with well-known fields set." test { name: "any" container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_any: TestAllTypes{single_int32: 1}}" value { object_value { [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_any { [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_int32: 1 } } } } } } test { name: "duration" container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_duration: duration('123s')}" value { object_value { [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_duration { seconds: 123 } } } } } test { name: "timestamp" container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_timestamp: timestamp('2009-02-13T23:31:30Z')}" value { object_value { [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_timestamp { seconds: 1234567890 } } } } } test { name: "struct" container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_struct: {'one': 1, 'two': 2}}" value { object_value { [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_struct { fields { key: "one" value { number_value: 1.0 } } fields { key: "two" value { number_value: 2.0 } } } } } } } test { name: "value" container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_value: 'foo'}" value { object_value { [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_value { string_value: "foo" } } } } } test { name: "int64_wrapper" container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_int64_wrapper: -321}" value { object_value { [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_int64_wrapper { value: -321 } } } } } test { name: "int32_wrapper" container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_int32_wrapper: -456}" value { object_value { [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_int32_wrapper { value: -456 } } } } } test { name: "double_wrapper" container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_double_wrapper: 2.71828}" value { object_value { [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_double_wrapper { value: 2.71828 } } } } } test { name: "float_wrapper" container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_float_wrapper: 2.99792e8}" value { object_value { [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_float_wrapper { value: 2.99792e8 } } } } } test { name: "uint64_wrapper" container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_uint64_wrapper: 8675309u}" value { object_value { [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_uint64_wrapper { value: 8675309 } } } } } test { name: "uint32_wrapper" container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_uint32_wrapper: 987u}" value { object_value { [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_uint32_wrapper { value: 987 } } } } } test { name: "string_wrapper" container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_string_wrapper: 'hubba'}" value { object_value { [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_string_wrapper { value: "hubba" } } } } } test { name: "bool_wrapper" container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_bool_wrapper: true}" value { object_value { [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_bool_wrapper { value: true } } } } } test { name: "bytes_wrapper" container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_bytes_wrapper: b'\\301\\103'}" value { object_value { [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_bytes_wrapper { value: "\301\103" } } } } } } section { name: "singular_bind" description: "Binding the singular fields." test { name: "int32" expr: "x.single_int32" type_env: { name: "x" ident: { type: { message_type: "cel.expr.conformance.proto3.TestAllTypes" } } } bindings: { key: "x" value: { value: { object_value: { [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_int32: 17 } } } } } value: { int64_value: 17 } } test { name: "int64" expr: "x.single_int64" type_env: { name: "x" ident { type { message_type: "cel.expr.conformance.proto3.TestAllTypes" } } } bindings: { key: "x" value: { value: { object_value: { [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_int64: -99 } } } } } value: { int64_value: -99 } } } section { name: "empty_field" description: "Tests on empty fields." test { name: "scalar" container: "cel.expr.conformance.proto3" expr: "TestAllTypes{}.single_fixed32" value: { uint64_value: 0 } } test { name: "nested_message" container: "cel.expr.conformance.proto3" expr: "TestAllTypes{}.single_nested_message" value: { object_value: { [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes.NestedMessage] {} } } } test { name: "nested_message_subfield" container: "cel.expr.conformance.proto3" expr: "TestAllTypes{}.single_nested_message.bb" value: { int64_value: 0 } } test { name: "wkt" container: "cel.expr.conformance.proto3" expr: "TestAllTypes{}.single_int64_wrapper" value: { null_value: NULL_VALUE } } test { name: "repeated_scalar" container: "cel.expr.conformance.proto3" expr: "TestAllTypes{}.repeated_int64" value: { list_value: {} } } test { name: "repeated_enum" container: "cel.expr.conformance.proto3" expr: "TestAllTypes{}.repeated_nested_enum" value: { list_value: {} } } test { name: "repeated_nested" container: "cel.expr.conformance.proto3" expr: "TestAllTypes{}.repeated_nested_message" value: { list_value: {} } } test { name: "map" container: "cel.expr.conformance.proto3" expr: "TestAllTypes{}.map_string_string" value: { map_value: {} } } } section { name: "has" description: "Tests for the has() macro on proto3 messages." test { name: "undefined" container: "cel.expr.conformance.proto3" expr: "has(TestAllTypes{}.no_such_field)" disable_check: true eval_error: { errors: { message: "no_such_field" } } } test { name: "repeated_none_implicit" container: "cel.expr.conformance.proto3" expr: "has(TestAllTypes{}.repeated_int32)" value { bool_value: false } } test { name: "repeated_none_explicit" container: "cel.expr.conformance.proto3" expr: "has(TestAllTypes{repeated_int32: []}.repeated_int32)" value { bool_value: false } } test { name: "repeated_one" container: "cel.expr.conformance.proto3" expr: "has(TestAllTypes{repeated_int32: [1]}.repeated_int32)" value { bool_value: true } } test { name: "repeated_many" container: "cel.expr.conformance.proto3" expr: "has(TestAllTypes{repeated_int32: [1, 2, 3]}.repeated_int32)" value { bool_value: true } } test { name: "map_none_implicit" container: "cel.expr.conformance.proto3" expr: "has(TestAllTypes{}.map_string_string)" value { bool_value: false } } test { name: "map_none_explicit" container: "cel.expr.conformance.proto3" expr: "has(TestAllTypes{map_string_string: {}}.map_string_string)" value { bool_value: false } } test { name: "map_one_default" container: "cel.expr.conformance.proto3" expr: "has(TestAllTypes{map_string_string: {'MT': ''}}.map_string_string)" value { bool_value: true } } test { name: "map_one" container: "cel.expr.conformance.proto3" expr: "has(TestAllTypes{map_string_string: {'one': 'uno'}}.map_string_string)" value { bool_value: true } } test { name: "map_many" container: "cel.expr.conformance.proto3" expr: "has(TestAllTypes{map_string_string: {'one': 'uno', 'two': 'dos'}}.map_string_string)" value { bool_value: true } } test { name: "single_unset" container: "cel.expr.conformance.proto3" expr: "has(TestAllTypes{}.single_int32)" value { bool_value: false } } test { name: "single_set" container: "cel.expr.conformance.proto3" expr: "has(TestAllTypes{single_int32: 16}.single_int32)" value { bool_value: true } } test { name: "single_set_to_default" container: "cel.expr.conformance.proto3" expr: "has(TestAllTypes{single_int32: 0}.single_int32)" value { bool_value: false } } test { name: "single_message_unset" container: "cel.expr.conformance.proto3" expr: "has(TestAllTypes{}.standalone_message)" value { bool_value: false } } test { name: "single_message_set" container: "cel.expr.conformance.proto3" expr: "has(TestAllTypes{standalone_message: TestAllTypes.NestedMessage{bb: 123}}.standalone_message)" value { bool_value: true } } test { name: "single_message_set_to_default" container: "cel.expr.conformance.proto3" expr: "has(TestAllTypes{standalone_message: TestAllTypes.NestedMessage{}}.standalone_message)" value { bool_value: true } } test { name: "single_enum_unset" container: "cel.expr.conformance.proto3" expr: "has(TestAllTypes{}.standalone_enum)" value { bool_value: false } } test { name: "single_enum_set" container: "cel.expr.conformance.proto3" expr: "has(TestAllTypes{standalone_enum: TestAllTypes.NestedEnum.BAR}.standalone_enum)" value { bool_value: true } } test { name: "single_enum_set_zero" container: "cel.expr.conformance.proto3" expr: "has(TestAllTypes{standalone_enum: TestAllTypes.NestedEnum.FOO}.standalone_enum)" value { bool_value: false } } test { name: "oneof_unset" container: "cel.expr.conformance.proto3" expr: "has(TestAllTypes{}.single_nested_message)" value { bool_value: false } } test { name: "oneof_other_set" container: "cel.expr.conformance.proto3" expr: "has(TestAllTypes{single_nested_enum: TestAllTypes.NestedEnum.BAZ}.single_nested_message)" value { bool_value: false } } test { name: "oneof_set" container: "cel.expr.conformance.proto3" expr: "has(TestAllTypes{single_nested_message: TestAllTypes.NestedMessage{}}.single_nested_message)" value { bool_value: true } } test { name: "oneof_set_default" container: "cel.expr.conformance.proto3" expr: "has(TestAllTypes{single_nested_enum: TestAllTypes.NestedEnum.FOO}.single_nested_enum)" value { bool_value: true } } } section { name: "set_null" test { name: "single_message" container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_nested_message: null} == TestAllTypes{}" value: { bool_value: true } } test { name: "single_any" container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_any: null}.single_any" value { null_value: NULL_VALUE } } test { name: "single_value" container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_value: null}.single_value" value { null_value: NULL_VALUE } } test { name: "single_duration" container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_duration: null} == TestAllTypes{}" value: { bool_value: true } } test { name: "single_timestamp" container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_timestamp: null} == TestAllTypes{}" value: { bool_value: true } } test { name: "single_scalar" container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_bool: null} == TestAllTypes{}" disable_check: true eval_error: { errors: { message: "unsupported field type" } } } test { name: "repeated" container: "cel.expr.conformance.proto3" expr: "TestAllTypes{repeated_int32: null} == TestAllTypes{}" disable_check: true eval_error: { errors: { message: "unsupported field type" } } } test { name: "map" container: "cel.expr.conformance.proto3" expr: "TestAllTypes{map_string_string: null} == TestAllTypes{}" disable_check: true eval_error: { errors: { message: "unsupported field type" } } } test { name: "list_value" container: "cel.expr.conformance.proto3" expr: "TestAllTypes{list_value: null} == TestAllTypes{}" disable_check: true eval_error: { errors: { message: "unsupported field type" } } } test { name: "single_struct" container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_struct: null} == TestAllTypes{}" disable_check: true eval_error: { errors: { message: "unsupported field type" } } } } section { name: "quoted_fields" test { name: "set_field" container: "cel.expr.conformance.proto3" expr: "TestAllTypes{`in`: true} == TestAllTypes{}" value: { bool_value: false } } test { name: "get_field" container: "cel.expr.conformance.proto3" expr: "TestAllTypes{`in`: true}.`in`" value: { bool_value: true } } }