check trajectory remapping in test (#1208)

master
gaschler 2018-06-20 13:55:09 +02:00 committed by Wally B. Feed
parent 5e96bfaeea
commit 41b642d92b
1 changed files with 4 additions and 6 deletions

View File

@ -348,15 +348,13 @@ TEST_F(MapBuilderTest, SaveLoadState) {
// Reset 'map_builder_'.
BuildMapBuilder();
io::ProtoStreamReader reader(filename);
map_builder_->LoadState(&reader, false /* load_frozen_state */);
// TODO(gaschler): Design better way to find out which new trajectory_ids
// were created by LoadState.
auto trajectory_remapping =
map_builder_->LoadState(&reader, false /* load_frozen_state */);
map_builder_->pose_graph()->RunFinalOptimization();
auto nodes = map_builder_->pose_graph()->GetTrajectoryNodes();
ASSERT_GT(nodes.size(), 0);
int new_trajectory_id = nodes.begin()->id.trajectory_id;
EXPECT_EQ(num_constraints,
map_builder_->pose_graph()->constraints().size());
ASSERT_EQ(trajectory_remapping.size(), 1);
int new_trajectory_id = trajectory_remapping.begin()->second;
EXPECT_EQ(
num_nodes,
map_builder_->pose_graph()->GetTrajectoryNodes().SizeOfTrajectoryOrZero(