math_opt: add cpp/model_test

This commit is contained in:
Mizux Seiha
2025-08-28 16:01:14 +02:00
committed by Corentin Le Molgat
parent a144ae4033
commit c89483a0db
3 changed files with 2618 additions and 2 deletions

View File

@@ -133,6 +133,35 @@ cc_library(
],
)
cc_test(
name = "model_test",
srcs = ["model_test.cc"],
deps = [
":key_types",
":linear_constraint",
":math_opt",
":model",
":update_tracker",
":variable_and_expressions",
"//ortools/base:gmock",
"//ortools/base:gmock_main",
"//ortools/base:parse_text_proto",
"//ortools/math_opt:sparse_containers_cc_proto",
"//ortools/math_opt/constraints/indicator:indicator_constraint",
"//ortools/math_opt/constraints/quadratic:quadratic_constraint",
"//ortools/math_opt/constraints/second_order_cone:second_order_cone_constraint",
"//ortools/math_opt/constraints/sos:sos1_constraint",
"//ortools/math_opt/constraints/sos:sos2_constraint",
"//ortools/math_opt/storage:model_storage",
"//ortools/math_opt/storage:model_storage_types",
"//ortools/math_opt/testing:stream",
"//ortools/util:fp_roundtrip_conv_testing",
"@abseil-cpp//absl/algorithm:container",
"@abseil-cpp//absl/status",
"@abseil-cpp//absl/strings",
],
)
cc_library(
name = "variable_and_expressions",
srcs = ["variable_and_expressions.cc"],

View File

@@ -149,12 +149,12 @@ std::vector<typename Map::mapped_type> Values(const Map& map,
namespace internal {
// The CHECK message to use when a KeyType::storage() is nullptr.
inline constexpr absl::string_view kKeyHasNullModelStorage =
inline const std::string kKeyHasNullModelStorage =
"The input key has null .storage().";
// The CHECK message to use when two KeyType with different storage() are used
// in the same collection.
inline constexpr absl::string_view kObjectsFromOtherModelStorage =
inline const std::string kObjectsFromOtherModelStorage =
"The input objects belongs to another model.";
// The Status message to use when an input KeyType is from an unexpected

File diff suppressed because it is too large Load Diff