|
| 1 | +// Copyright 2025 Google LLC |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | +// |
| 7 | +// https://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +// |
| 9 | +// Unless required by applicable law or agreed to in writing, software |
| 10 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +// See the License for the specific language governing permissions and |
| 13 | +// limitations under the License. |
| 14 | + |
| 15 | +#include "common/minimal_descriptor_database.h" |
| 16 | + |
| 17 | +#include "google/protobuf/descriptor.pb.h" |
| 18 | +#include "internal/testing.h" |
| 19 | +#include "google/protobuf/descriptor.h" |
| 20 | + |
| 21 | +namespace cel { |
| 22 | +namespace { |
| 23 | + |
| 24 | +using ::testing::IsTrue; |
| 25 | + |
| 26 | +TEST(GetMinimalDescriptorDatabase, NullValue) { |
| 27 | + google::protobuf::FileDescriptorProto fd; |
| 28 | + EXPECT_THAT(GetMinimalDescriptorDatabase()->FindFileContainingSymbol( |
| 29 | + "google.protobuf.NullValue", &fd), |
| 30 | + IsTrue()); |
| 31 | +} |
| 32 | + |
| 33 | +TEST(GetMinimalDescriptorDatabase, BoolValue) { |
| 34 | + google::protobuf::FileDescriptorProto fd; |
| 35 | + EXPECT_THAT(GetMinimalDescriptorDatabase()->FindFileContainingSymbol( |
| 36 | + "google.protobuf.BoolValue", &fd), |
| 37 | + IsTrue()); |
| 38 | +} |
| 39 | + |
| 40 | +TEST(GetMinimalDescriptorDatabase, Int32Value) { |
| 41 | + google::protobuf::FileDescriptorProto fd; |
| 42 | + EXPECT_THAT(GetMinimalDescriptorDatabase()->FindFileContainingSymbol( |
| 43 | + "google.protobuf.Int32Value", &fd), |
| 44 | + IsTrue()); |
| 45 | +} |
| 46 | + |
| 47 | +TEST(GetMinimalDescriptorDatabase, Int64Value) { |
| 48 | + google::protobuf::FileDescriptorProto fd; |
| 49 | + EXPECT_THAT(GetMinimalDescriptorDatabase()->FindFileContainingSymbol( |
| 50 | + "google.protobuf.Int64Value", &fd), |
| 51 | + IsTrue()); |
| 52 | +} |
| 53 | + |
| 54 | +TEST(GetMinimalDescriptorDatabase, UInt32Value) { |
| 55 | + google::protobuf::FileDescriptorProto fd; |
| 56 | + EXPECT_THAT(GetMinimalDescriptorDatabase()->FindFileContainingSymbol( |
| 57 | + "google.protobuf.UInt32Value", &fd), |
| 58 | + IsTrue()); |
| 59 | +} |
| 60 | + |
| 61 | +TEST(GetMinimalDescriptorDatabase, UInt64Value) { |
| 62 | + google::protobuf::FileDescriptorProto fd; |
| 63 | + EXPECT_THAT(GetMinimalDescriptorDatabase()->FindFileContainingSymbol( |
| 64 | + "google.protobuf.UInt64Value", &fd), |
| 65 | + IsTrue()); |
| 66 | +} |
| 67 | + |
| 68 | +TEST(GetMinimalDescriptorDatabase, FloatValue) { |
| 69 | + google::protobuf::FileDescriptorProto fd; |
| 70 | + EXPECT_THAT(GetMinimalDescriptorDatabase()->FindFileContainingSymbol( |
| 71 | + "google.protobuf.FloatValue", &fd), |
| 72 | + IsTrue()); |
| 73 | +} |
| 74 | + |
| 75 | +TEST(GetMinimalDescriptorDatabase, DoubleValue) { |
| 76 | + google::protobuf::FileDescriptorProto fd; |
| 77 | + EXPECT_THAT(GetMinimalDescriptorDatabase()->FindFileContainingSymbol( |
| 78 | + "google.protobuf.DoubleValue", &fd), |
| 79 | + IsTrue()); |
| 80 | +} |
| 81 | + |
| 82 | +TEST(GetMinimalDescriptorDatabase, BytesValue) { |
| 83 | + google::protobuf::FileDescriptorProto fd; |
| 84 | + EXPECT_THAT(GetMinimalDescriptorDatabase()->FindFileContainingSymbol( |
| 85 | + "google.protobuf.BytesValue", &fd), |
| 86 | + IsTrue()); |
| 87 | +} |
| 88 | + |
| 89 | +TEST(GetMinimalDescriptorDatabase, StringValue) { |
| 90 | + google::protobuf::FileDescriptorProto fd; |
| 91 | + EXPECT_THAT(GetMinimalDescriptorDatabase()->FindFileContainingSymbol( |
| 92 | + "google.protobuf.StringValue", &fd), |
| 93 | + IsTrue()); |
| 94 | +} |
| 95 | + |
| 96 | +TEST(GetMinimalDescriptorDatabase, Any) { |
| 97 | + google::protobuf::FileDescriptorProto fd; |
| 98 | + EXPECT_THAT(GetMinimalDescriptorDatabase()->FindFileContainingSymbol( |
| 99 | + "google.protobuf.Any", &fd), |
| 100 | + IsTrue()); |
| 101 | +} |
| 102 | + |
| 103 | +TEST(GetMinimalDescriptorDatabase, Duration) { |
| 104 | + google::protobuf::FileDescriptorProto fd; |
| 105 | + EXPECT_THAT(GetMinimalDescriptorDatabase()->FindFileContainingSymbol( |
| 106 | + "google.protobuf.Duration", &fd), |
| 107 | + IsTrue()); |
| 108 | +} |
| 109 | + |
| 110 | +TEST(GetMinimalDescriptorDatabase, Timestamp) { |
| 111 | + google::protobuf::FileDescriptorProto fd; |
| 112 | + EXPECT_THAT(GetMinimalDescriptorDatabase()->FindFileContainingSymbol( |
| 113 | + "google.protobuf.Timestamp", &fd), |
| 114 | + IsTrue()); |
| 115 | +} |
| 116 | + |
| 117 | +TEST(GetMinimalDescriptorDatabase, Value) { |
| 118 | + google::protobuf::FileDescriptorProto fd; |
| 119 | + EXPECT_THAT(GetMinimalDescriptorDatabase()->FindFileContainingSymbol( |
| 120 | + "google.protobuf.Value", &fd), |
| 121 | + IsTrue()); |
| 122 | +} |
| 123 | + |
| 124 | +TEST(GetMinimalDescriptorDatabase, ListValue) { |
| 125 | + google::protobuf::FileDescriptorProto fd; |
| 126 | + EXPECT_THAT(GetMinimalDescriptorDatabase()->FindFileContainingSymbol( |
| 127 | + "google.protobuf.ListValue", &fd), |
| 128 | + IsTrue()); |
| 129 | +} |
| 130 | + |
| 131 | +TEST(GetMinimalDescriptorDatabase, Struct) { |
| 132 | + google::protobuf::FileDescriptorProto fd; |
| 133 | + EXPECT_THAT(GetMinimalDescriptorDatabase()->FindFileContainingSymbol( |
| 134 | + "google.protobuf.Struct", &fd), |
| 135 | + IsTrue()); |
| 136 | +} |
| 137 | + |
| 138 | +} // namespace |
| 139 | +} // namespace cel |
0 commit comments