Fix tiny_solver_test

Verify that the final cost is small enough instead of the norm
of the residual vector.

Change-Id: I9591d97d3e8f1c71067d99270967f1e593889843
This commit is contained in:
Sameer Agarwal
2017-10-22 22:04:24 -07:00
parent 030b41dd0e
commit f6df80e8a0
+2 -4
View File
@@ -146,13 +146,11 @@ void TestHelper(const Function& f, const Vector& x0) {
Vector x = x0;
Vec2 residuals;
f(x.data(), residuals.data(), NULL);
EXPECT_GT(residuals.norm(), 1e-10);
EXPECT_GT(residuals.squaredNorm() / 2.0, 1e-10);
TinySolver<Function> solver;
solver.Solve(f, &x);
f(x.data(), residuals.data(), NULL);
EXPECT_NEAR(0.0, residuals.norm(), 1e-10);
EXPECT_NEAR(0.0, solver.summary.final_cost, 1e-10);
}
// A test case for when the cost function is statically sized.