Recheck the residual after a new call.
When Jacobian is needed, a different function is called internally. Thus we have to recheck the residual.
Change-Id: I83044b3668479fc21b6612662271e872addf6f48
diff --git a/internal/ceres/autodiff_cost_function_test.cc b/internal/ceres/autodiff_cost_function_test.cc
index 1192808..4795579 100644
--- a/internal/ceres/autodiff_cost_function_test.cc
+++ b/internal/ceres/autodiff_cost_function_test.cc
@@ -76,7 +76,9 @@
cost_function->Evaluate(parameters, &residuals, NULL);
EXPECT_EQ(10.0, residuals);
+
cost_function->Evaluate(parameters, &residuals, jacobians);
+ EXPECT_EQ(10.0, residuals);
EXPECT_EQ(3, jacobians[0][0]);
EXPECT_EQ(4, jacobians[0][1]);