This commit is contained in:
Corentin Le Molgat
2024-02-22 10:55:34 +01:00
parent 2925d1508c
commit 94f35edbba
9 changed files with 22 additions and 25 deletions

View File

@@ -100,10 +100,10 @@ cc_test(
name = "radix_sort_test",
srcs = ["radix_sort_test.cc"],
copts = select({
"on_linux": [],
"on_macos": [],
"on_windows": ["/Zc:preprocessor"],
"//conditions:default": [],
"on_linux": [],
"on_macos": [],
"on_windows": ["/Zc:preprocessor"],
"//conditions:default": [],
}),
deps = [
":radix_sort",

View File

@@ -234,6 +234,15 @@ cc_library(
],
)
cc_library(
name = "message_matchers",
hdrs = ["message_matchers.h"],
deps = [
"@com_google_googletest//:gtest",
"@com_google_protobuf//:protobuf",
],
)
cc_library(
name = "gmock",
hdrs = ["gmock.h"],
@@ -458,15 +467,6 @@ cc_library(
],
)
cc_library(
name = "message_matchers",
hdrs = ["message_matchers.h"],
deps = [
"@com_google_googletest//:gtest",
"@com_google_protobuf//:protobuf",
],
)
cc_library(
name = "status_macros",
hdrs = ["status_macros.h"],

View File

@@ -15,6 +15,7 @@
#define OR_TOOLS_BASE_GMOCK_H_
#include "gmock/gmock.h"
#include "ortools/base/message_matchers.h"
#include "ortools/base/status_matchers.h"
#endif // OR_TOOLS_BASE_GMOCK_H_

View File

@@ -30,7 +30,7 @@ SolveResultProto ResultForIntegerInfeasible(const bool is_maximize,
result.mutable_termination()->set_reason(TERMINATION_REASON_INFEASIBLE);
result.mutable_termination()->set_detail(
absl::StrCat("Problem had one or more integer variables with no integers "
"in domain, e.g. integer variable with id: ",
"in domain, e.g. integer variable with id: ",
bad_variable_id, " had bounds: [", RoundTripDoubleFormat(lb),
", ", RoundTripDoubleFormat(ub), "]."));
result.mutable_solve_stats()->mutable_problem_status()->set_primal_status(

View File

@@ -425,8 +425,6 @@ cc_library(
":variable_and_expressions",
"//ortools/base:gmock",
"//ortools/base:logging",
"//ortools/base:message_matchers",
"//ortools/base:status_matchers",
"@com_google_absl//absl/container:flat_hash_map",
"@com_google_absl//absl/log",
"@com_google_absl//absl/log:check",

View File

@@ -30,7 +30,6 @@
#include "gtest/gtest.h"
#include "ortools/base/gmock.h"
#include "ortools/base/logging.h"
#include "ortools/base/message_matchers.h"
#include "ortools/math_opt/cpp/math_opt.h"
#include "ortools/math_opt/cpp/update_result.h"
#include "ortools/math_opt/cpp/variable_and_expressions.h"

View File

@@ -101,7 +101,6 @@
#include "absl/status/statusor.h"
#include "gtest/gtest.h"
#include "ortools/base/gmock.h"
#include "ortools/base/status_matchers.h"
#include "ortools/math_opt/cpp/linear_constraint.h"
#include "ortools/math_opt/cpp/math_opt.h"
#include "ortools/math_opt/cpp/update_result.h"

View File

@@ -161,8 +161,8 @@ ModelSolveParametersProto ModelSolveParameters::Proto() const {
->mutable_ids();
RepeatedField<int>& constraint_status_values =
*ret.mutable_initial_basis()
->mutable_constraint_status()
->mutable_values();
->mutable_constraint_status()
->mutable_values();
constraint_status_ids.Reserve(
static_cast<int>(initial_basis->constraint_status.size()));
constraint_status_values.Reserve(
@@ -177,8 +177,8 @@ ModelSolveParametersProto ModelSolveParameters::Proto() const {
*ret.mutable_initial_basis()->mutable_variable_status()->mutable_ids();
RepeatedField<int>& variable_status_values =
*ret.mutable_initial_basis()
->mutable_variable_status()
->mutable_values();
->mutable_variable_status()
->mutable_values();
variable_status_ids.Reserve(
static_cast<int>(initial_basis->variable_status.size()));
variable_status_values.Reserve(

View File

@@ -292,11 +292,11 @@ std::string VariableValuesAsString(std::vector<Variable> variables,
return absl::StrCat(
"{",
absl::StrJoin(variables, ", ",
[&](std::string* const out, const Variable variable) {
absl::StrAppendFormat(
[&](std::string* const out, const Variable variable) {
absl::StrAppendFormat(
out, "{%s, %v}", absl::FormatStreamed(variable),
RoundTripDoubleFormat(variable_values.at(variable)));
}),
}),
"}");
}