MCPcopy Create free account
hub / github.com/cel-expr/cel-cpp / TEST_P

Function TEST_P

env/env_test.cc:214–240  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

212 : public testing::TestWithParam<StandardLibraryConfigTestCase> {};
213
214TEST_P(StandardLibraryConfigTest, StandardLibraryConfig) {
215 const StandardLibraryConfigTestCase& param = GetParam();
216 Env env;
217 env.SetDescriptorPool(internal::GetSharedTestingDescriptorPool());
218
219 Config config;
220 ASSERT_THAT(config.SetStandardLibraryConfig(param.standard_library_config),
221 IsOk());
222 env.SetConfig(config);
223
224 ASSERT_OK_AND_ASSIGN(std::unique_ptr<Compiler> compiler, env.NewCompiler());
225
226 for (const std::string& expr : param.expected_valid_expressions) {
227 ASSERT_OK_AND_ASSIGN(auto result1, compiler->Compile(expr));
228 EXPECT_THAT(result1.GetIssues(), IsEmpty())
229 << "With config: " << param.standard_library_config
230 << ", expected no issues for expr: " << expr
231 << " but got: " << result1.FormatError();
232 }
233 for (const std::string& expr : param.expected_invalid_expressions) {
234 ASSERT_OK_AND_ASSIGN(auto result1, compiler->Compile(expr));
235 EXPECT_THAT(result1.GetIssues(), Not(IsEmpty()))
236 << "With config: " << param.standard_library_config
237 << ", expected compilation error for expr: " << expr << " but got: \'"
238 << result1.FormatError() << "\'";
239 }
240}
241
242INSTANTIATE_TEST_SUITE_P(
243 StandardLibraryConfigTest, StandardLibraryConfigTest,

Callers

nothing calls this directly

Calls 7

NewCompilerMethod · 0.80
GetIssuesMethod · 0.80
FormatErrorMethod · 0.80
ASSERT_OK_AND_ASSIGNFunction · 0.70
SetDescriptorPoolMethod · 0.45
SetConfigMethod · 0.45

Tested by

no test coverage detected