Google OR-Tools v9.14
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
testing.h
Go to the documentation of this file.
1// Copyright 2010-2025 Google LLC
2// Licensed under the Apache License, Version 2.0 (the "License");
3// you may not use this file except in compliance with the License.
4// You may obtain a copy of the License at
5//
6// http://www.apache.org/licenses/LICENSE-2.0
7//
8// Unless required by applicable law or agreed to in writing, software
9// distributed under the License is distributed on an "AS IS" BASIS,
10// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11// See the License for the specific language governing permissions and
12// limitations under the License.
13
14// Test descriptors. This avoids depending on attributes from `attributes.h`
15// in the tests to decouple the codegen tests from `attributes.h`.
16#ifndef OR_TOOLS_MATH_OPT_ELEMENTAL_CODEGEN_TESTING_H_
17#define OR_TOOLS_MATH_OPT_ELEMENTAL_CODEGEN_TESTING_H_
18
20
22
24 return {.name = "TestAttr2",
26 .num_key_elements = 2,
27 .symmetry = "SomeSymmetry",
28 .attribute_names = {"a_name", "b_name"}};
29}
30
31inline AttrOpFunctionInfo GetTestFunctionInfo(bool with_key_parameter) {
32 return {.return_type = Type::Named("ReturnType"),
33 .has_key_parameter = with_key_parameter,
34 .extra_parameters = {
35 {{.type = Type::Named("ExtraParam"), .name = "extra_param"}}}};
36}
37
38} // namespace operations_research::math_opt::codegen
39
40#endif // OR_TOOLS_MATH_OPT_ELEMENTAL_CODEGEN_TESTING_H_
static std::shared_ptr< Type > Named(std::string name)
A named type, e.g. "double".
Definition gen.cc:68
Language-agnostic utilities for Elemental codegen.
Definition codegen.cc:29
AttrOpFunctionInfo GetTestFunctionInfo(bool with_key_parameter)
Definition testing.h:31
CodegenAttrTypeDescriptor GetTestDescriptor()
Definition testing.h:23
Information about how to codegen a given AttrOp in a given language.
Definition gen.h:81
A struct to represent an attribute type descriptor during codegen.
Definition gen.h:42