Clean up test_util and program_test after gMock matcher migration

1. Guard SolveUsingDenseCholesky against UNSYMMETRIC storage types
   with CHECK_NE.
2. Remove redundant << error streaming on EXPECT_THAT(error, HasSubstr(...))
   in program_test.cc.

Change-Id: I6b44217151525f3258eebe9d6072eb8d3f3fd46c
diff --git a/internal/ceres/program_test.cc b/internal/ceres/program_test.cc
index 394242e..c00b9c8 100644
--- a/internal/ceres/program_test.cc
+++ b/internal/ceres/program_test.cc
@@ -396,7 +396,7 @@
   problem.AddResidualBlock(new MockCostFunctionBase<1, 2>(), nullptr, x);
   std::string error;
   EXPECT_FALSE(problem.program().ParameterBlocksAreFinite(&error));
-  EXPECT_THAT(error, HasSubstr("has at least one invalid value")) << error;
+  EXPECT_THAT(error, HasSubstr("has at least one invalid value"));
 }
 
 TEST(Program, InfeasibleParameterBlock) {
@@ -407,7 +407,7 @@
   problem.SetParameterUpperBound(x, 0, 1.0);
   std::string error;
   EXPECT_FALSE(problem.program().IsFeasible(&error));
-  EXPECT_THAT(error, HasSubstr("infeasible bound")) << error;
+  EXPECT_THAT(error, HasSubstr("infeasible bound"));
 }
 
 TEST(Program, InfeasibleConstantParameterBlock) {
@@ -419,7 +419,7 @@
   problem.SetParameterBlockConstant(x);
   std::string error;
   EXPECT_FALSE(problem.program().IsFeasible(&error));
-  EXPECT_THAT(error, HasSubstr("infeasible value")) << error;
+  EXPECT_THAT(error, HasSubstr("infeasible value"));
 }
 
 }  // namespace internal
diff --git a/internal/ceres/test_util.cc b/internal/ceres/test_util.cc
index a2743b8..9a754e4 100644
--- a/internal/ceres/test_util.cc
+++ b/internal/ceres/test_util.cc
@@ -44,6 +44,7 @@
 #include <utility>
 
 #include "Eigen/Cholesky"
+#include "absl/log/check.h"
 #include "absl/strings/str_format.h"
 #include "ceres/file.h"
 #include "ceres/is_close.h"
@@ -261,6 +262,8 @@
 bool SolveUsingDenseCholesky(const CompressedRowSparseMatrix& lhs,
                              const Vector& rhs,
                              Vector* solution) {
+  CHECK_NE(lhs.storage_type(),
+           CompressedRowSparseMatrix::StorageType::UNSYMMETRIC);
   Matrix dense_triangular_lhs;
   lhs.ToDenseMatrix(&dense_triangular_lhs);
   const Matrix dense_lhs =