16#ifndef OR_TOOLS_MATH_OPT_SOLVER_TESTS_GENERIC_TESTS_H_
17#define OR_TOOLS_MATH_OPT_SOLVER_TESTS_GENERIC_TESTS_H_
23#include "absl/status/statusor.h"
24#include "gtest/gtest.h"
50 friend std::ostream&
operator<<(std::ostream& out,
65class GenericTest :
public ::testing::TestWithParam<GenericTestParameters> {
69 {.parameters = GetParam().solve_parameters});
76 const std::optional<CallbackEvent> supported_event = std::nullopt)
79 event(supported_event) {}
88 std::optional<CallbackEvent>
event;
90 friend std::ostream&
operator<<(std::ostream& out,
104class TimeLimitTest :
public ::testing::TestWithParam<TimeLimitTestParameters> {
static absl::StatusOr< SolveResult > SimpleSolve(const Model &model)
SolverType TestedSolver() const
SolverType
The solvers supported by MathOpt.
absl::StatusOr< SolveResult > Solve(const Model &model, const SolverType solver_type, const SolveArguments &solve_args, const SolverInitArguments &init_args)
In SWIG mode, we don't want anything besides these top-level includes.
bool support_interrupter
True if the solver support SolveInterrupter.
SolverType solver_type
The tested solver.
SolveParameters solve_parameters
Additional parameters to control the solve.
std::string expected_log
A message included in the solver logs when an optimal solution is found.
bool integer_variables
True if the tests should be performed with integer variables.
friend std::ostream & operator<<(std::ostream &out, const GenericTestParameters ¶ms)
GenericTestParameters(SolverType solver_type, bool support_interrupter, bool integer_variables, std::string expected_log, SolveParameters solve_parameters={})
friend std::ostream & operator<<(std::ostream &out, const TimeLimitTestParameters ¶ms)
bool integer_variables
The test problem will be a 0-1 IP if true, otherwise will be an LP.
TimeLimitTestParameters(const SolverType solver_type, const bool integer_variables, const std::optional< CallbackEvent > supported_event=std::nullopt)
std::optional< CallbackEvent > event
A supported callback event, or nullopt if no event is supported.
SolverType solver_type
The tested solver.