41TEST(WorldDiff, TrackChanges)
43 collision_detection::WorldPtr world = std::make_shared<collision_detection::World>();
52 shapes::ShapePtr ball = std::make_shared<shapes::Sphere>(1.0);
53 shapes::ShapePtr box = std::make_shared<shapes::Box>(1, 2, 3);
54 shapes::ShapePtr cyl = std::make_shared<shapes::Cylinder>(4, 5);
56 world->addToObject(
"obj1", ball, Eigen::Isometry3d::Identity());
62 EXPECT_NE(diff1.
end(), it);
66 EXPECT_EQ(diff1.
end(), it);
68 world->addToObject(
"obj2", box, Eigen::Isometry3d::Identity());
74 EXPECT_NE(diff1.
end(), it);
77 world->addToObject(
"obj2", cyl, Eigen::Isometry3d::Identity());
83 EXPECT_NE(diff1.
end(), it);
88 bool move_ok = world->moveShapeInObject(
"obj2", cyl, Eigen::Isometry3d(Eigen::Translation3d(0, 0, 1)));
95 EXPECT_NE(diff1.
end(), it);
101 EXPECT_NE(diff2.
end(), it);
103 EXPECT_EQ(
"obj2", it->first);
111 EXPECT_EQ(diff1.
end(), it);
113 world->addToObject(
"obj3", box, Eigen::Isometry3d::Identity());
118 world->addToObject(
"obj3", cyl, Eigen::Isometry3d::Identity());
120 world->addToObject(
"obj3", ball, Eigen::Isometry3d::Identity());
127 move_ok = world->moveShapeInObject(
"obj3", cyl, Eigen::Isometry3d(Eigen::Translation3d(0, 0, 2)));
128 EXPECT_TRUE(move_ok);
135 world->removeObject(
"obj2");
141 EXPECT_NE(diff1.
end(), it);
144 EXPECT_NE(diff2.
end(), it);
147 world->removeShapeFromObject(
"obj3", cyl);
150 EXPECT_NE(diff1.
end(), it);
153 EXPECT_NE(diff2.
end(), it);
158 world->removeShapeFromObject(
"obj3", box);
161 EXPECT_NE(diff1.
end(), it);
164 EXPECT_NE(diff2.
end(), it);
169 move_ok = world->moveShapeInObject(
"obj3", ball, Eigen::Isometry3d(Eigen::Translation3d(0, 0, 3)));
170 EXPECT_TRUE(move_ok);
173 EXPECT_NE(diff1.
end(), it);
176 EXPECT_NE(diff2.
end(), it);
181 world->removeShapeFromObject(
"obj3", ball);
184 EXPECT_NE(diff1.
end(), it);
187 EXPECT_NE(diff2.
end(), it);
193 collision_detection::WorldPtr world1 = std::make_shared<collision_detection::World>();
194 collision_detection::WorldPtr world2 = std::make_shared<collision_detection::World>();
200 shapes::ShapePtr ball = std::make_shared<shapes::Sphere>(1.0);
201 shapes::ShapePtr box = std::make_shared<shapes::Box>(1, 2, 3);
202 shapes::ShapePtr cyl = std::make_shared<shapes::Cylinder>(4, 5);
204 world1->addToObject(
"objA1", ball, Eigen::Isometry3d::Identity());
206 world1->addToObject(
"objA2", ball, Eigen::Isometry3d::Identity());
208 world1->addToObject(
"objA3", ball, Eigen::Isometry3d::Identity());
210 world2->addToObject(
"objB1", box, Eigen::Isometry3d::Identity());
212 world2->addToObject(
"objB2", box, Eigen::Isometry3d::Identity());
214 world2->addToObject(
"objB3", box, Eigen::Isometry3d::Identity());
233 EXPECT_NE(diff1.
end(), it);
237 EXPECT_NE(diff1.
end(), it);
241 EXPECT_NE(diff1.
end(), it);
245 EXPECT_NE(diff1.
end(), it);
249 EXPECT_NE(diff1.
end(), it);
253 EXPECT_NE(diff1.
end(), it);
263 EXPECT_NE(diff1b.
end(), it);
267 EXPECT_NE(diff1b.
end(), it);
271 EXPECT_NE(diff1b.
end(), it);
275 EXPECT_NE(diff1b.
end(), it);
279 EXPECT_NE(diff1b.
end(), it);
283 EXPECT_NE(diff1b.
end(), it);
286 world1->addToObject(
"objC", box, Eigen::Isometry3d::Identity());
292 world2->addToObject(
"objC", box, Eigen::Isometry3d::Identity());
305 EXPECT_NE(diff2.
end(), it);
310 world1->addToObject(
"objD", box, Eigen::Isometry3d::Identity());
316 world2->addToObject(
"objE", box, Eigen::Isometry3d::Identity());