add unit test for 'assignWeights'

release/4.3a0
Ankur Roy Chowdhury 2023-01-23 16:30:39 -08:00
parent 981d8e9391
commit cc7ed2d152
1 changed files with 13 additions and 0 deletions

View File

@ -129,6 +129,19 @@ TEST( SubgraphSolver, constructor3 )
DOUBLES_EQUAL(0.0, error(Ab, optimized), 1e-5);
}
/* ************************************************************************* */
TEST(SubgraphBuilder, utilsAssignWeights)
{
const auto [g, _] = example::planarGraph(N); // A*x-b
const auto weights = utils::assignWeights(g, gtsam::SubgraphBuilderParameters::SkeletonWeight::EQUAL);
EXPECT(weights.size() == g.size());
for (const auto &i : weights)
{
EXPECT_DOUBLES_EQUAL(weights[i], 1.0, 1e-12);
}
}
/* ************************************************************************* */
TEST(SubgraphBuilder, utilsKruskal)
{