Lint changes from Jim Roseborough. Change-Id: Ia92ed4dcd6750f33a178ff39465814805a99bdfa
diff --git a/internal/ceres/evaluator_test.cc b/internal/ceres/evaluator_test.cc index a0b28ee..a156b89 100644 --- a/internal/ceres/evaluator_test.cc +++ b/internal/ceres/evaluator_test.cc
@@ -61,7 +61,8 @@ typedef SizedCostFunction<kNumResiduals, Ns...> Base; public: - ParameterIgnoringCostFunction(bool succeeds = true) : succeeds_(succeeds) {} + explicit ParameterIgnoringCostFunction(bool succeeds = true) + : succeeds_(succeeds) {} virtual bool Evaluate(double const* const* parameters, double* residuals, @@ -83,7 +84,7 @@ // // where the multiplication by kFactor makes it easier to distinguish // between Jacobians of different residuals for the same parameter. - if (jacobians[k] != NULL) { + if (jacobians[k] != nullptr) { MatrixRef jacobian(jacobians[k], Base::num_residuals(), Base::parameter_block_sizes()[k]); @@ -173,12 +174,12 @@ ASSERT_TRUE(evaluator->Evaluate( &state[0], &cost, - expected_residuals != NULL ? &residuals[0] : NULL, - expected_gradient != NULL ? &gradient[0] : NULL, - expected_jacobian != NULL ? jacobian.get() : NULL)); + expected_residuals != nullptr ? &residuals[0] : nullptr, + expected_gradient != nullptr ? &gradient[0] : nullptr, + expected_jacobian != nullptr ? jacobian.get() : nullptr)); Matrix actual_jacobian; - if (expected_jacobian != NULL) { + if (expected_jacobian != nullptr) { jacobian->ToDenseMatrix(&actual_jacobian); } @@ -201,9 +202,9 @@ expected.num_rows, expected.num_cols, expected.cost, - (i & 1) ? expected.residuals : NULL, - (i & 2) ? expected.gradient : NULL, - (i & 4) ? expected.jacobian : NULL); + (i & 1) ? expected.residuals : nullptr, + (i & 2) ? expected.gradient : nullptr, + (i & 4) ? expected.jacobian : nullptr); } } @@ -222,7 +223,7 @@ TEST_P(EvaluatorTest, SingleResidualProblem) { problem.AddResidualBlock(new ParameterIgnoringCostFunction<1, 3, 2, 3, 4>, - NULL, + nullptr, x, y, z); ExpectedEvaluation expected = { @@ -260,7 +261,7 @@ // for a long time, since by chance most users added parameters to the problem // in the same order that they occurred as parameters to a cost function. problem.AddResidualBlock(new ParameterIgnoringCostFunction<1, 3, 4, 3, 2>, - NULL, + nullptr, z, y, x); ExpectedEvaluation expected = { @@ -303,7 +304,7 @@ problem.AddParameterBlock(d, 3); problem.AddResidualBlock(new ParameterIgnoringCostFunction<1, 3, 2, 3, 4>, - NULL, + nullptr, x, y, z); ExpectedEvaluation expected = { @@ -340,17 +341,17 @@ // f(x, y) in R^2 problem.AddResidualBlock(new ParameterIgnoringCostFunction<1, 2, 2, 3>, - NULL, + nullptr, x, y); // g(x, z) in R^3 problem.AddResidualBlock(new ParameterIgnoringCostFunction<2, 3, 2, 4>, - NULL, + nullptr, x, z); // h(y, z) in R^4 problem.AddResidualBlock(new ParameterIgnoringCostFunction<3, 4, 3, 4>, - NULL, + nullptr, y, z); ExpectedEvaluation expected = { @@ -403,17 +404,17 @@ // f(x, y) in R^2 problem.AddResidualBlock(new ParameterIgnoringCostFunction<1, 2, 2, 3>, - NULL, + nullptr, x, y); // g(x, z) in R^3 problem.AddResidualBlock(new ParameterIgnoringCostFunction<2, 3, 2, 4>, - NULL, + nullptr, x, z); // h(y, z) in R^4 problem.AddResidualBlock(new ParameterIgnoringCostFunction<3, 4, 3, 4>, - NULL, + nullptr, y, z); ExpectedEvaluation expected = { @@ -463,17 +464,17 @@ // f(x, y) in R^2 problem.AddResidualBlock(new ParameterIgnoringCostFunction<1, 2, 2, 3>, - NULL, - x, y); + nullptr, + x, y); // g(x, z) in R^3 problem.AddResidualBlock(new ParameterIgnoringCostFunction<2, 3, 2, 4>, - NULL, - x, z); + nullptr, + x, z); // h(y, z) in R^4 problem.AddResidualBlock(new ParameterIgnoringCostFunction<3, 4, 3, 4>, - NULL, + nullptr, y, z); // For this test, "z" is constant. @@ -531,15 +532,20 @@ TEST_P(EvaluatorTest, EvaluatorAbortsForResidualsThatFailToEvaluate) { // Switch the return value to failure. problem.AddResidualBlock( - new ParameterIgnoringCostFunction<20, 3, 2, 3, 4>(false), NULL, x, y, z); + new ParameterIgnoringCostFunction<20, 3, 2, 3, 4>(false), + nullptr, + x, + y, + z); // The values are ignored. double state[9]; - std::unique_ptr<Evaluator> evaluator(CreateEvaluator(problem.mutable_program())); + std::unique_ptr<Evaluator> evaluator( + CreateEvaluator(problem.mutable_program())); std::unique_ptr<SparseMatrix> jacobian(evaluator->CreateJacobian()); double cost; - EXPECT_FALSE(evaluator->Evaluate(state, &cost, NULL, NULL, NULL)); + EXPECT_FALSE(evaluator->Evaluate(state, &cost, nullptr, nullptr, nullptr)); } // In the pairs, the first argument is the linear solver type, and the second @@ -551,25 +557,24 @@ INSTANTIATE_TEST_CASE_P( LinearSolvers, EvaluatorTest, - ::testing::Values( - EvaluatorTestOptions(DENSE_QR, 0), - EvaluatorTestOptions(DENSE_SCHUR, 0), - EvaluatorTestOptions(DENSE_SCHUR, 1), - EvaluatorTestOptions(DENSE_SCHUR, 2), - EvaluatorTestOptions(DENSE_SCHUR, 3), - EvaluatorTestOptions(DENSE_SCHUR, 4), - EvaluatorTestOptions(SPARSE_SCHUR, 0), - EvaluatorTestOptions(SPARSE_SCHUR, 1), - EvaluatorTestOptions(SPARSE_SCHUR, 2), - EvaluatorTestOptions(SPARSE_SCHUR, 3), - EvaluatorTestOptions(SPARSE_SCHUR, 4), - EvaluatorTestOptions(ITERATIVE_SCHUR, 0), - EvaluatorTestOptions(ITERATIVE_SCHUR, 1), - EvaluatorTestOptions(ITERATIVE_SCHUR, 2), - EvaluatorTestOptions(ITERATIVE_SCHUR, 3), - EvaluatorTestOptions(ITERATIVE_SCHUR, 4), - EvaluatorTestOptions(SPARSE_NORMAL_CHOLESKY, 0, false), - EvaluatorTestOptions(SPARSE_NORMAL_CHOLESKY, 0, true))); + ::testing::Values(EvaluatorTestOptions(DENSE_QR, 0), + EvaluatorTestOptions(DENSE_SCHUR, 0), + EvaluatorTestOptions(DENSE_SCHUR, 1), + EvaluatorTestOptions(DENSE_SCHUR, 2), + EvaluatorTestOptions(DENSE_SCHUR, 3), + EvaluatorTestOptions(DENSE_SCHUR, 4), + EvaluatorTestOptions(SPARSE_SCHUR, 0), + EvaluatorTestOptions(SPARSE_SCHUR, 1), + EvaluatorTestOptions(SPARSE_SCHUR, 2), + EvaluatorTestOptions(SPARSE_SCHUR, 3), + EvaluatorTestOptions(SPARSE_SCHUR, 4), + EvaluatorTestOptions(ITERATIVE_SCHUR, 0), + EvaluatorTestOptions(ITERATIVE_SCHUR, 1), + EvaluatorTestOptions(ITERATIVE_SCHUR, 2), + EvaluatorTestOptions(ITERATIVE_SCHUR, 3), + EvaluatorTestOptions(ITERATIVE_SCHUR, 4), + EvaluatorTestOptions(SPARSE_NORMAL_CHOLESKY, 0, false), + EvaluatorTestOptions(SPARSE_NORMAL_CHOLESKY, 0, true))); // Simple cost function used to check if the evaluator is sensitive to // state changes. @@ -583,9 +588,9 @@ residuals[0] = x1 * x1; residuals[1] = x2 * x2; - if (jacobians != NULL) { + if (jacobians != nullptr) { double* jacobian = jacobians[0]; - if (jacobian != NULL) { + if (jacobian != nullptr) { jacobian[0] = 2.0 * x1; jacobian[1] = 0.0; jacobian[2] = 0.0; @@ -603,7 +608,7 @@ x[0] = 1.0; x[1] = 1.0; - problem.AddResidualBlock(new ParameterSensitiveCostFunction(), NULL, x); + problem.AddResidualBlock(new ParameterSensitiveCostFunction(), nullptr, x); Program* program = problem.mutable_program(); program->SetParameterOffsetsAndIndex(); @@ -612,7 +617,8 @@ options.num_eliminate_blocks = 0; options.context = problem.context(); string error; - std::unique_ptr<Evaluator> evaluator(Evaluator::Create(options, program, &error)); + std::unique_ptr<Evaluator> evaluator( + Evaluator::Create(options, program, &error)); std::unique_ptr<SparseMatrix> jacobian(evaluator->CreateJacobian()); ASSERT_EQ(2, jacobian->num_rows()); @@ -630,15 +636,15 @@ // Cost only; no residuals and no jacobian. { double cost = -1; - ASSERT_TRUE(evaluator->Evaluate(state, &cost, NULL, NULL, NULL)); + ASSERT_TRUE(evaluator->Evaluate(state, &cost, nullptr, nullptr, nullptr)); EXPECT_EQ(48.5, cost); } // Cost and residuals, no jacobian. { double cost = -1; - double residuals[2] = { -2, -2 }; - ASSERT_TRUE(evaluator->Evaluate(state, &cost, residuals, NULL, NULL)); + double residuals[2] = {-2, -2}; + ASSERT_TRUE(evaluator->Evaluate(state, &cost, residuals, nullptr, nullptr)); EXPECT_EQ(48.5, cost); EXPECT_EQ(4, residuals[0]); EXPECT_EQ(9, residuals[1]); @@ -647,13 +653,10 @@ // Cost, residuals, and jacobian. { double cost = -1; - double residuals[2] = { -2, -2}; + double residuals[2] = {-2, -2}; SetSparseMatrixConstant(jacobian.get(), -1); - ASSERT_TRUE(evaluator->Evaluate(state, - &cost, - residuals, - NULL, - jacobian.get())); + ASSERT_TRUE( + evaluator->Evaluate(state, &cost, residuals, nullptr, jacobian.get())); EXPECT_EQ(48.5, cost); EXPECT_EQ(4, residuals[0]); EXPECT_EQ(9, residuals[1]); @@ -661,13 +664,12 @@ jacobian->ToDenseMatrix(&actual_jacobian); Matrix expected_jacobian(2, 2); - expected_jacobian - << 2 * state[0], 0, - 0, 2 * state[1]; + expected_jacobian << 2 * state[0], 0, 0, 2 * state[1]; EXPECT_TRUE((actual_jacobian.array() == expected_jacobian.array()).all()) - << "Actual:\n" << actual_jacobian - << "\nExpected:\n" << expected_jacobian; + << "Actual:\n" + << actual_jacobian << "\nExpected:\n" + << expected_jacobian; } }
diff --git a/internal/ceres/program_test.cc b/internal/ceres/program_test.cc index 01bf233..6cb316e 100644 --- a/internal/ceres/program_test.cc +++ b/internal/ceres/program_test.cc
@@ -55,7 +55,7 @@ double* residuals, double** jacobians) const { residuals[0] = parameters[0][0]; - if (jacobians != NULL && jacobians[0] != NULL) { + if (jacobians != nullptr && jacobians[0] != nullptr) { jacobians[0][0] = 1.0; } return true; @@ -91,15 +91,14 @@ problem.AddParameterBlock(&x, 1); problem.AddParameterBlock(&y, 1); problem.AddParameterBlock(&z, 1); - problem.AddResidualBlock(new UnaryCostFunction(), NULL, &x); - problem.AddResidualBlock(new BinaryCostFunction(), NULL, &x, &y); - problem.AddResidualBlock(new TernaryCostFunction(), NULL, &x, &y, &z); + problem.AddResidualBlock(new UnaryCostFunction(), nullptr, &x); + problem.AddResidualBlock(new BinaryCostFunction(), nullptr, &x, &y); + problem.AddResidualBlock(new TernaryCostFunction(), nullptr, &x, &y, &z); vector<double*> removed_parameter_blocks; double fixed_cost = 0.0; string message; - std::unique_ptr<Program> reduced_program( - problem.program().CreateReducedProgram( + std::unique_ptr<Program> reduced_program(problem.program().CreateReducedProgram( &removed_parameter_blocks, &fixed_cost, &message)); EXPECT_EQ(reduced_program->NumParameterBlocks(), 3); @@ -113,7 +112,7 @@ double x = 1.0; problem.AddParameterBlock(&x, 1); - problem.AddResidualBlock(new UnaryCostFunction(), NULL, &x); + problem.AddResidualBlock(new UnaryCostFunction(), nullptr, &x); problem.SetParameterBlockConstant(&x); vector<double*> removed_parameter_blocks; @@ -163,8 +162,8 @@ problem.AddParameterBlock(&y, 1); problem.AddParameterBlock(&z, 1); - problem.AddResidualBlock(new UnaryCostFunction(), NULL, &x); - problem.AddResidualBlock(new BinaryCostFunction(), NULL, &x, &y); + problem.AddResidualBlock(new UnaryCostFunction(), nullptr, &x); + problem.AddResidualBlock(new BinaryCostFunction(), nullptr, &x, &y); problem.SetParameterBlockConstant(&x); vector<double*> removed_parameter_blocks; @@ -186,9 +185,9 @@ problem.AddParameterBlock(&x, 1); problem.AddParameterBlock(&y, 1); problem.AddParameterBlock(&z, 1); - problem.AddResidualBlock(new UnaryCostFunction(), NULL, &x); - problem.AddResidualBlock(new TernaryCostFunction(), NULL, &x, &y, &z); - problem.AddResidualBlock(new BinaryCostFunction(), NULL, &x, &y); + problem.AddResidualBlock(new UnaryCostFunction(), nullptr, &x); + problem.AddResidualBlock(new TernaryCostFunction(), nullptr, &x, &y, &z); + problem.AddResidualBlock(new BinaryCostFunction(), nullptr, &x, &y); problem.SetParameterBlockConstant(&x); vector<double*> removed_parameter_blocks; @@ -210,9 +209,9 @@ problem.AddParameterBlock(&x, 1); problem.AddParameterBlock(&y, 1); problem.AddParameterBlock(&z, 1); - problem.AddResidualBlock(new UnaryIdentityCostFunction(), NULL, &x); - problem.AddResidualBlock(new TernaryCostFunction(), NULL, &x, &y, &z); - problem.AddResidualBlock(new BinaryCostFunction(), NULL, &x, &y); + problem.AddResidualBlock(new UnaryIdentityCostFunction(), nullptr, &x); + problem.AddResidualBlock(new TernaryCostFunction(), nullptr, &x, &y, &z); + problem.AddResidualBlock(new BinaryCostFunction(), nullptr, &x, &y); problem.SetParameterBlockConstant(&x); ResidualBlock *expected_removed_block = @@ -222,8 +221,8 @@ double expected_fixed_cost; expected_removed_block->Evaluate(true, &expected_fixed_cost, - NULL, - NULL, + nullptr, + nullptr, scratch.get()); @@ -249,14 +248,14 @@ problem.AddParameterBlock(y, 3); problem.AddParameterBlock(&z, 1); - problem.AddResidualBlock(new MockCostFunctionBase<2, 2>(), NULL, x); - problem.AddResidualBlock(new MockCostFunctionBase<3, 1, 2>(), NULL, &z, x); - problem.AddResidualBlock(new MockCostFunctionBase<4, 1, 3>(), NULL, &z, y); - problem.AddResidualBlock(new MockCostFunctionBase<5, 1, 3>(), NULL, &z, y); - problem.AddResidualBlock(new MockCostFunctionBase<1, 2, 1>(), NULL, x, &z); - problem.AddResidualBlock(new MockCostFunctionBase<2, 1, 3>(), NULL, &z, y); - problem.AddResidualBlock(new MockCostFunctionBase<2, 2, 1>(), NULL, x, &z); - problem.AddResidualBlock(new MockCostFunctionBase<1, 3>(), NULL, y); + problem.AddResidualBlock(new MockCostFunctionBase<2, 2>(), nullptr, x); + problem.AddResidualBlock(new MockCostFunctionBase<3, 1, 2>(), nullptr, &z, x); + problem.AddResidualBlock(new MockCostFunctionBase<4, 1, 3>(), nullptr, &z, y); + problem.AddResidualBlock(new MockCostFunctionBase<5, 1, 3>(), nullptr, &z, y); + problem.AddResidualBlock(new MockCostFunctionBase<1, 2, 1>(), nullptr, x, &z); + problem.AddResidualBlock(new MockCostFunctionBase<2, 1, 3>(), nullptr, &z, y); + problem.AddResidualBlock(new MockCostFunctionBase<2, 2, 1>(), nullptr, x, &z); + problem.AddResidualBlock(new MockCostFunctionBase<1, 3>(), nullptr, y); TripletSparseMatrix expected_block_sparse_jacobian(3, 8, 14); { @@ -352,7 +351,7 @@ } problem.AddResidualBlock(new NumParameterBlocksCostFunction<1, 20>(), - NULL, + nullptr, parameter_blocks); TripletSparseMatrix expected_block_sparse_jacobian(20, 1, 20); @@ -388,7 +387,7 @@ double x[2]; x[0] = 1.0; x[1] = std::numeric_limits<double>::quiet_NaN(); - problem.AddResidualBlock(new MockCostFunctionBase<1, 2>(), NULL, x); + problem.AddResidualBlock(new MockCostFunctionBase<1, 2>(), nullptr, x); string error; EXPECT_FALSE(problem.program().ParameterBlocksAreFinite(&error)); EXPECT_NE(error.find("has at least one invalid value"), @@ -398,7 +397,7 @@ TEST(Program, InfeasibleParameterBlock) { ProblemImpl problem; double x[] = {0.0, 0.0}; - problem.AddResidualBlock(new MockCostFunctionBase<1, 2>(), NULL, x); + problem.AddResidualBlock(new MockCostFunctionBase<1, 2>(), nullptr, x); problem.SetParameterLowerBound(x, 0, 2.0); problem.SetParameterUpperBound(x, 0, 1.0); string error; @@ -409,7 +408,7 @@ TEST(Program, InfeasibleConstantParameterBlock) { ProblemImpl problem; double x[] = {0.0, 0.0}; - problem.AddResidualBlock(new MockCostFunctionBase<1, 2>(), NULL, x); + problem.AddResidualBlock(new MockCostFunctionBase<1, 2>(), nullptr, x); problem.SetParameterLowerBound(x, 0, 1.0); problem.SetParameterUpperBound(x, 0, 2.0); problem.SetParameterBlockConstant(x);
diff --git a/internal/ceres/tiny_solver_autodiff_function_test.cc b/internal/ceres/tiny_solver_autodiff_function_test.cc index 0b542a2..90033fc 100644 --- a/internal/ceres/tiny_solver_autodiff_function_test.cc +++ b/internal/ceres/tiny_solver_autodiff_function_test.cc
@@ -70,7 +70,7 @@ // Check the case with cost-only evaluation. residuals.setConstant(555); // Arbitrary. - EXPECT_TRUE(f(&x(0), &residuals(0), NULL)); + EXPECT_TRUE(f(&x(0), &residuals(0), nullptr)); EXPECT_NEAR(3.0, residuals(0), kTolerance); EXPECT_NEAR(2.0, residuals(1), kTolerance); @@ -110,7 +110,7 @@ template<typename T> bool operator()(const T* parameters, T* residuals) const { // Jacobian is not evaluated by cost function, but by autodiff. - T* jacobian = NULL; + T* jacobian = nullptr; return EvaluateResidualsAndJacobians(parameters, residuals, jacobian); } }; @@ -119,7 +119,7 @@ void TestHelper(const Function& f, const Vector& x0) { Vector x = x0; Eigen::Vector2d residuals; - f(x.data(), residuals.data(), NULL); + f(x.data(), residuals.data(), nullptr); EXPECT_GT(residuals.squaredNorm() / 2.0, 1e-10); TinySolver<Function> solver; @@ -140,7 +140,7 @@ AutoDiffCostFunctor f_autodiff(f); Eigen::Vector2d residuals; - f_autodiff(x0.data(), residuals.data(), NULL); + f_autodiff(x0.data(), residuals.data(), nullptr); EXPECT_GT(residuals.squaredNorm() / 2.0, 1e-10); TinySolver<AutoDiffCostFunctor> solver;
diff --git a/internal/ceres/trust_region_preprocessor_test.cc b/internal/ceres/trust_region_preprocessor_test.cc index 47cc4fb..40338c1 100644 --- a/internal/ceres/trust_region_preprocessor_test.cc +++ b/internal/ceres/trust_region_preprocessor_test.cc
@@ -96,7 +96,7 @@ TEST(TrustRegionPreprocessor, RemoveParameterBlocksFailed) { ProblemImpl problem; double x = 3.0; - problem.AddResidualBlock(new FailingCostFunction, NULL, &x); + problem.AddResidualBlock(new FailingCostFunction, nullptr, &x); problem.SetParameterBlockConstant(&x); Solver::Options options; TrustRegionPreprocessor preprocessor; @@ -124,13 +124,13 @@ residuals[i] = kNumResiduals * kNumResiduals + i; } - if (jacobians == NULL) { + if (jacobians == nullptr) { return true; } std::array<int, sizeof...(Ns)> N{Ns...}; for (size_t i = 0; i < N.size(); ++i) { - if (jacobians[i] != NULL) { + if (jacobians[i] != nullptr) { MatrixRef j(jacobians[i], kNumResiduals, N[i]); j.setOnes(); j *= kNumResiduals * N[i]; @@ -147,8 +147,8 @@ x_ = 1.0; y_ = 1.0; z_ = 1.0; - problem_.AddResidualBlock(new DummyCostFunction<1, 1, 1>, NULL, &x_, &y_); - problem_.AddResidualBlock(new DummyCostFunction<1, 1, 1>, NULL, &y_, &z_); + problem_.AddResidualBlock(new DummyCostFunction<1, 1, 1>, nullptr, &x_, &y_); + problem_.AddResidualBlock(new DummyCostFunction<1, 1, 1>, nullptr, &y_, &z_); } void PreprocessForGivenLinearSolverAndVerify( @@ -161,8 +161,8 @@ EXPECT_EQ(pp.options.linear_solver_type, linear_solver_type); EXPECT_EQ(pp.linear_solver_options.type, linear_solver_type); EXPECT_EQ(pp.evaluator_options.linear_solver_type, linear_solver_type); - EXPECT_TRUE(pp.linear_solver.get() != NULL); - EXPECT_TRUE(pp.evaluator.get() != NULL); + EXPECT_TRUE(pp.linear_solver.get() != nullptr); + EXPECT_TRUE(pp.evaluator.get() != nullptr); } protected: @@ -214,8 +214,8 @@ EXPECT_EQ(pp.linear_solver_options.type, options.linear_solver_type); EXPECT_EQ(pp.evaluator_options.linear_solver_type, options.linear_solver_type); - EXPECT_TRUE(pp.linear_solver.get() != NULL); - EXPECT_TRUE(pp.evaluator.get() != NULL); + EXPECT_TRUE(pp.linear_solver.get() != nullptr); + EXPECT_TRUE(pp.evaluator.get() != nullptr); EXPECT_TRUE(pp.minimizer_options.is_constrained); } @@ -246,8 +246,8 @@ EXPECT_EQ(pp.options.linear_solver_type, DENSE_SCHUR); EXPECT_EQ(pp.linear_solver_options.type, DENSE_SCHUR); EXPECT_EQ(pp.evaluator_options.linear_solver_type, DENSE_SCHUR); - EXPECT_TRUE(pp.linear_solver.get() != NULL); - EXPECT_TRUE(pp.evaluator.get() != NULL); + EXPECT_TRUE(pp.linear_solver.get() != nullptr); + EXPECT_TRUE(pp.evaluator.get() != nullptr); } TEST_F(LinearSolverAndEvaluatorCreationTest, @@ -268,8 +268,8 @@ EXPECT_EQ(pp.options.linear_solver_type, DENSE_QR); EXPECT_EQ(pp.linear_solver_options.type, DENSE_QR); EXPECT_EQ(pp.evaluator_options.linear_solver_type, DENSE_QR); - EXPECT_TRUE(pp.linear_solver.get() != NULL); - EXPECT_TRUE(pp.evaluator.get() != NULL); + EXPECT_TRUE(pp.linear_solver.get() != nullptr); + EXPECT_TRUE(pp.evaluator.get() != nullptr); } TEST_F(LinearSolverAndEvaluatorCreationTest, @@ -289,14 +289,14 @@ EXPECT_EQ(pp.options.linear_solver_type, DENSE_SCHUR); EXPECT_EQ(pp.linear_solver_options.type, DENSE_SCHUR); EXPECT_EQ(pp.evaluator_options.linear_solver_type, DENSE_SCHUR); - EXPECT_TRUE(pp.linear_solver.get() != NULL); - EXPECT_TRUE(pp.evaluator.get() != NULL); + EXPECT_TRUE(pp.linear_solver.get() != nullptr); + EXPECT_TRUE(pp.evaluator.get() != nullptr); } TEST(TrustRegionPreprocessorTest, InnerIterationsWithOneParameterBlock) { ProblemImpl problem; double x = 1.0; - problem.AddResidualBlock(new DummyCostFunction<1, 1>, NULL, &x); + problem.AddResidualBlock(new DummyCostFunction<1, 1>, nullptr, &x); Solver::Options options; options.use_inner_iterations = true; @@ -304,9 +304,9 @@ TrustRegionPreprocessor preprocessor; PreprocessedProblem pp; EXPECT_TRUE(preprocessor.Preprocess(options, &problem, &pp)); - EXPECT_TRUE(pp.linear_solver.get() != NULL); - EXPECT_TRUE(pp.evaluator.get() != NULL); - EXPECT_TRUE(pp.inner_iteration_minimizer.get() == NULL); + EXPECT_TRUE(pp.linear_solver.get() != nullptr); + EXPECT_TRUE(pp.evaluator.get() != nullptr); + EXPECT_TRUE(pp.inner_iteration_minimizer.get() == nullptr); } TEST_F(LinearSolverAndEvaluatorCreationTest, @@ -317,9 +317,9 @@ TrustRegionPreprocessor preprocessor; PreprocessedProblem pp; EXPECT_TRUE(preprocessor.Preprocess(options, &problem_, &pp)); - EXPECT_TRUE(pp.linear_solver.get() != NULL); - EXPECT_TRUE(pp.evaluator.get() != NULL); - EXPECT_TRUE(pp.inner_iteration_minimizer.get() != NULL); + EXPECT_TRUE(pp.linear_solver.get() != nullptr); + EXPECT_TRUE(pp.evaluator.get() != nullptr); + EXPECT_TRUE(pp.inner_iteration_minimizer.get() != nullptr); } TEST_F(LinearSolverAndEvaluatorCreationTest, @@ -347,9 +347,9 @@ TrustRegionPreprocessor preprocessor; PreprocessedProblem pp; EXPECT_TRUE(preprocessor.Preprocess(options, &problem_, &pp)); - EXPECT_TRUE(pp.linear_solver.get() != NULL); - EXPECT_TRUE(pp.evaluator.get() != NULL); - EXPECT_TRUE(pp.inner_iteration_minimizer.get() != NULL); + EXPECT_TRUE(pp.linear_solver.get() != nullptr); + EXPECT_TRUE(pp.evaluator.get() != nullptr); + EXPECT_TRUE(pp.inner_iteration_minimizer.get() != nullptr); } } // namespace internal