diff --git a/gtsam/base/tests/testDSFMap.cpp b/gtsam/base/tests/testDSFMap.cpp index 816498ce8..2e4b4f146 100644 --- a/gtsam/base/tests/testDSFMap.cpp +++ b/gtsam/base/tests/testDSFMap.cpp @@ -16,17 +16,14 @@ * @brief unit tests for DSFMap */ +#include #include -#include -#include -using namespace boost::assign; - -#include - #include +#include +#include +#include -using namespace std; using namespace gtsam; /* ************************************************************************* */ @@ -65,9 +62,8 @@ TEST(DSFMap, merge3) { TEST(DSFMap, mergePairwiseMatches) { // Create some "matches" - typedef pair Match; - list matches; - matches += Match(1,2), Match(2,3), Match(4,5), Match(4,6); + typedef std::pair Match; + const std::list matches{{1, 2}, {2, 3}, {4, 5}, {4, 6}}; // Merge matches DSFMap dsf; @@ -86,18 +82,17 @@ TEST(DSFMap, mergePairwiseMatches) { TEST(DSFMap, mergePairwiseMatches2) { // Create some measurements with image index and feature index - typedef pair Measurement; + typedef std::pair Measurement; Measurement m11(1,1),m12(1,2),m14(1,4); // in image 1 Measurement m22(2,2),m23(2,3),m25(2,5),m26(2,6); // in image 2 // Add them all - list measurements; - measurements += m11,m12,m14, m22,m23,m25,m26; + const std::list measurements{m11, m12, m14, m22, m23, m25, m26}; // Create some "matches" - typedef pair Match; - list matches; - matches += Match(m11,m22), Match(m12,m23), Match(m14,m25), Match(m14,m26); + typedef std::pair Match; + const std::list matches{ + {m11, m22}, {m12, m23}, {m14, m25}, {m14, m26}}; // Merge matches DSFMap dsf; @@ -114,26 +109,16 @@ TEST(DSFMap, mergePairwiseMatches2) { /* ************************************************************************* */ TEST(DSFMap, sets){ // Create some "matches" - typedef pair Match; - list matches; - matches += Match(1,2), Match(2,3), Match(4,5), Match(4,6); + typedef const std::pair Match; + const std::list matches{{1, 2}, {2, 3}, {4, 5}, {4, 6}}; // Merge matches DSFMap dsf; for(const Match& m: matches) dsf.merge(m.first,m.second); - map > sets = dsf.sets(); - set s1, s2; - s1 += 1,2,3; - s2 += 4,5,6; - - /*for(key_pair st: sets){ - cout << "Set " << st.first << " :{"; - for(const size_t s: st.second) - cout << s << ", "; - cout << "}" << endl; - }*/ + std::map > sets = dsf.sets(); + const std::set s1{1, 2, 3}, s2{4, 5, 6}; EXPECT(s1 == sets[1]); EXPECT(s2 == sets[4]); diff --git a/gtsam/base/tests/testDSFVector.cpp b/gtsam/base/tests/testDSFVector.cpp index 88cea8c01..b50ddde33 100644 --- a/gtsam/base/tests/testDSFVector.cpp +++ b/gtsam/base/tests/testDSFVector.cpp @@ -21,14 +21,15 @@ #include #include -#include -#include -#include -using namespace boost::assign; #include +#include +#include +#include -using namespace std; +using std::pair; +using std::map; +using std::vector; using namespace gtsam; /* ************************************************************************* */ @@ -64,8 +65,8 @@ TEST(DSFBase, mergePairwiseMatches) { // Create some "matches" typedef pair Match; - vector matches; - matches += Match(1,2), Match(2,3), Match(4,5), Match(4,6); + const vector matches{Match(1, 2), Match(2, 3), Match(4, 5), + Match(4, 6)}; // Merge matches DSFBase dsf(7); // We allow for keys 0..6 @@ -85,7 +86,7 @@ TEST(DSFBase, mergePairwiseMatches) { /* ************************************************************************* */ TEST(DSFVector, merge2) { boost::shared_ptr v = boost::make_shared(5); - std::vector keys; keys += 1, 3; + const std::vector keys {1, 3}; DSFVector dsf(v, keys); dsf.merge(1,3); EXPECT(dsf.find(1) == dsf.find(3)); @@ -95,10 +96,10 @@ TEST(DSFVector, merge2) { TEST(DSFVector, sets) { DSFVector dsf(2); dsf.merge(0,1); - map > sets = dsf.sets(); + map > sets = dsf.sets(); LONGS_EQUAL(1, sets.size()); - set expected; expected += 0, 1; + const std::set expected{0, 1}; EXPECT(expected == sets[dsf.find(0)]); } @@ -109,7 +110,7 @@ TEST(DSFVector, arrays) { map > arrays = dsf.arrays(); LONGS_EQUAL(1, arrays.size()); - vector expected; expected += 0, 1; + const vector expected{0, 1}; EXPECT(expected == arrays[dsf.find(0)]); } @@ -118,10 +119,10 @@ TEST(DSFVector, sets2) { DSFVector dsf(3); dsf.merge(0,1); dsf.merge(1,2); - map > sets = dsf.sets(); + map > sets = dsf.sets(); LONGS_EQUAL(1, sets.size()); - set expected; expected += 0, 1, 2; + const std::set expected{0, 1, 2}; EXPECT(expected == sets[dsf.find(0)]); } @@ -133,7 +134,7 @@ TEST(DSFVector, arrays2) { map > arrays = dsf.arrays(); LONGS_EQUAL(1, arrays.size()); - vector expected; expected += 0, 1, 2; + const vector expected{0, 1, 2}; EXPECT(expected == arrays[dsf.find(0)]); } @@ -141,10 +142,10 @@ TEST(DSFVector, arrays2) { TEST(DSFVector, sets3) { DSFVector dsf(3); dsf.merge(0,1); - map > sets = dsf.sets(); + map > sets = dsf.sets(); LONGS_EQUAL(2, sets.size()); - set expected; expected += 0, 1; + const std::set expected{0, 1}; EXPECT(expected == sets[dsf.find(0)]); } @@ -155,7 +156,7 @@ TEST(DSFVector, arrays3) { map > arrays = dsf.arrays(); LONGS_EQUAL(2, arrays.size()); - vector expected; expected += 0, 1; + const vector expected{0, 1}; EXPECT(expected == arrays[dsf.find(0)]); } @@ -163,10 +164,10 @@ TEST(DSFVector, arrays3) { TEST(DSFVector, set) { DSFVector dsf(3); dsf.merge(0,1); - set set = dsf.set(0); + std::set set = dsf.set(0); LONGS_EQUAL(2, set.size()); - std::set expected; expected += 0, 1; + const std::set expected{0, 1}; EXPECT(expected == set); } @@ -175,10 +176,10 @@ TEST(DSFVector, set2) { DSFVector dsf(3); dsf.merge(0,1); dsf.merge(1,2); - set set = dsf.set(0); + std::set set = dsf.set(0); LONGS_EQUAL(3, set.size()); - std::set expected; expected += 0, 1, 2; + const std::set expected{0, 1, 2}; EXPECT(expected == set); } @@ -195,13 +196,12 @@ TEST(DSFVector, isSingleton) { TEST(DSFVector, mergePairwiseMatches) { // Create some measurements - vector keys; - keys += 1,2,3,4,5,6; + const vector keys{1, 2, 3, 4, 5, 6}; // Create some "matches" typedef pair Match; - vector matches; - matches += Match(1,2), Match(2,3), Match(4,5), Match(4,6); + const vector matches{Match(1, 2), Match(2, 3), Match(4, 5), + Match(4, 6)}; // Merge matches DSFVector dsf(keys); @@ -209,13 +209,13 @@ TEST(DSFVector, mergePairwiseMatches) { dsf.merge(m.first,m.second); // Check that we have two connected components, 1,2,3 and 4,5,6 - map > sets = dsf.sets(); + map > sets = dsf.sets(); LONGS_EQUAL(2, sets.size()); - set expected1; expected1 += 1,2,3; - set actual1 = sets[dsf.find(2)]; + const std::set expected1{1, 2, 3}; + std::set actual1 = sets[dsf.find(2)]; EXPECT(expected1 == actual1); - set expected2; expected2 += 4,5,6; - set actual2 = sets[dsf.find(5)]; + const std::set expected2{4, 5, 6}; + std::set actual2 = sets[dsf.find(5)]; EXPECT(expected2 == actual2); } diff --git a/gtsam/base/tests/testFastContainers.cpp b/gtsam/base/tests/testFastContainers.cpp index 12dee036e..acb6347db 100644 --- a/gtsam/base/tests/testFastContainers.cpp +++ b/gtsam/base/tests/testFastContainers.cpp @@ -11,12 +11,8 @@ #include #include -#include -#include - #include -using namespace boost::assign; using namespace gtsam; /* ************************************************************************* */ @@ -25,7 +21,7 @@ TEST( testFastContainers, KeySet ) { KeyVector init_vector {2, 3, 4, 5}; KeySet actSet(init_vector); - KeySet expSet; expSet += 2, 3, 4, 5; + KeySet expSet{2, 3, 4, 5}; EXPECT(actSet == expSet); } diff --git a/gtsam/base/tests/testSymmetricBlockMatrix.cpp b/gtsam/base/tests/testSymmetricBlockMatrix.cpp index c24e12c25..24dbe0a96 100644 --- a/gtsam/base/tests/testSymmetricBlockMatrix.cpp +++ b/gtsam/base/tests/testSymmetricBlockMatrix.cpp @@ -17,14 +17,12 @@ #include #include -#include using namespace std; using namespace gtsam; -using boost::assign::list_of; static SymmetricBlockMatrix testBlockMatrix( - list_of(3)(2)(1), + std::vector{3, 2, 1}, (Matrix(6, 6) << 1, 2, 3, 4, 5, 6, 2, 8, 9, 10, 11, 12, @@ -101,7 +99,8 @@ TEST(SymmetricBlockMatrix, Ranges) /* ************************************************************************* */ TEST(SymmetricBlockMatrix, expressions) { - SymmetricBlockMatrix expected1(list_of(2)(3)(1), (Matrix(6, 6) << + const std::vector dimensions{2, 3, 1}; + SymmetricBlockMatrix expected1(dimensions, (Matrix(6, 6) << 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 6, 8, 0, @@ -109,7 +108,7 @@ TEST(SymmetricBlockMatrix, expressions) 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0).finished()); - SymmetricBlockMatrix expected2(list_of(2)(3)(1), (Matrix(6, 6) << + SymmetricBlockMatrix expected2(dimensions, (Matrix(6, 6) << 0, 0, 10, 15, 20, 0, 0, 0, 12, 18, 24, 0, 0, 0, 0, 0, 0, 0, @@ -120,32 +119,32 @@ TEST(SymmetricBlockMatrix, expressions) Matrix a = (Matrix(1, 3) << 2, 3, 4).finished(); Matrix b = (Matrix(1, 2) << 5, 6).finished(); - SymmetricBlockMatrix bm1(list_of(2)(3)(1)); + SymmetricBlockMatrix bm1(dimensions); bm1.setZero(); bm1.diagonalBlock(1).rankUpdate(a.transpose()); EXPECT(assert_equal(Matrix(expected1.selfadjointView()), bm1.selfadjointView())); - SymmetricBlockMatrix bm2(list_of(2)(3)(1)); + SymmetricBlockMatrix bm2(dimensions); bm2.setZero(); bm2.updateOffDiagonalBlock(0, 1, b.transpose() * a); EXPECT(assert_equal(Matrix(expected2.selfadjointView()), bm2.selfadjointView())); - SymmetricBlockMatrix bm3(list_of(2)(3)(1)); + SymmetricBlockMatrix bm3(dimensions); bm3.setZero(); bm3.updateOffDiagonalBlock(1, 0, a.transpose() * b); EXPECT(assert_equal(Matrix(expected2.selfadjointView()), bm3.selfadjointView())); - SymmetricBlockMatrix bm4(list_of(2)(3)(1)); + SymmetricBlockMatrix bm4(dimensions); bm4.setZero(); bm4.updateDiagonalBlock(1, expected1.diagonalBlock(1)); EXPECT(assert_equal(Matrix(expected1.selfadjointView()), bm4.selfadjointView())); - SymmetricBlockMatrix bm5(list_of(2)(3)(1)); + SymmetricBlockMatrix bm5(dimensions); bm5.setZero(); bm5.updateOffDiagonalBlock(0, 1, expected2.aboveDiagonalBlock(0, 1)); EXPECT(assert_equal(Matrix(expected2.selfadjointView()), bm5.selfadjointView())); - SymmetricBlockMatrix bm6(list_of(2)(3)(1)); + SymmetricBlockMatrix bm6(dimensions); bm6.setZero(); bm6.updateOffDiagonalBlock(1, 0, expected2.aboveDiagonalBlock(0, 1).transpose()); EXPECT(assert_equal(Matrix(expected2.selfadjointView()), bm6.selfadjointView())); @@ -162,7 +161,8 @@ TEST(SymmetricBlockMatrix, inverseInPlace) { inputMatrix += c * c.transpose(); const Matrix expectedInverse = inputMatrix.inverse(); - SymmetricBlockMatrix symmMatrix(list_of(2)(1), inputMatrix); + const std::vector dimensions{2, 1}; + SymmetricBlockMatrix symmMatrix(dimensions, inputMatrix); // invert in place symmMatrix.invertInPlace(); EXPECT(assert_equal(expectedInverse, symmMatrix.selfadjointView())); diff --git a/gtsam/base/tests/testTreeTraversal.cpp b/gtsam/base/tests/testTreeTraversal.cpp index 88e476cb9..147f4f030 100644 --- a/gtsam/base/tests/testTreeTraversal.cpp +++ b/gtsam/base/tests/testTreeTraversal.cpp @@ -23,16 +23,13 @@ #include #include #include -#include -using boost::assign::operator+=; -using namespace std; using namespace gtsam; struct TestNode { typedef boost::shared_ptr shared_ptr; int data; - vector children; + std::vector children; TestNode() : data(-1) {} TestNode(int data) : data(data) {} }; @@ -110,10 +107,8 @@ TEST(treeTraversal, DepthFirst) TestForest testForest = makeTestForest(); // Expected visit order - std::list preOrderExpected; - preOrderExpected += 0, 2, 3, 4, 1; - std::list postOrderExpected; - postOrderExpected += 2, 4, 3, 0, 1; + const std::list preOrderExpected{0, 2, 3, 4, 1}; + const std::list postOrderExpected{2, 4, 3, 0, 1}; // Actual visit order PreOrderVisitor preVisitor; @@ -135,8 +130,7 @@ TEST(treeTraversal, CloneForest) testForest2.roots_ = treeTraversal::CloneForest(testForest1); // Check that the original and clone both are expected - std::list preOrder1Expected; - preOrder1Expected += 0, 2, 3, 4, 1; + const std::list preOrder1Expected{0, 2, 3, 4, 1}; std::list preOrder1Actual = getPreorder(testForest1); std::list preOrder2Actual = getPreorder(testForest2); EXPECT(assert_container_equality(preOrder1Expected, preOrder1Actual)); @@ -144,8 +138,7 @@ TEST(treeTraversal, CloneForest) // Modify clone - should not modify original testForest2.roots_[0]->children[1]->data = 10; - std::list preOrderModifiedExpected; - preOrderModifiedExpected += 0, 2, 10, 4, 1; + const std::list preOrderModifiedExpected{0, 2, 10, 4, 1}; // Check that original is the same and only the clone is modified std::list preOrder1ModActual = getPreorder(testForest1); diff --git a/gtsam/base/tests/testVerticalBlockMatrix.cpp b/gtsam/base/tests/testVerticalBlockMatrix.cpp index 8bb4474a4..e6630427a 100644 --- a/gtsam/base/tests/testVerticalBlockMatrix.cpp +++ b/gtsam/base/tests/testVerticalBlockMatrix.cpp @@ -18,14 +18,14 @@ #include #include -#include -using namespace std; +#include +#include + using namespace gtsam; -using boost::assign::list_of; -list L = list_of(3)(2)(1); -vector dimensions(L.begin(),L.end()); +const std::list L{3, 2, 1}; +const std::vector dimensions(L.begin(), L.end()); //***************************************************************************** TEST(VerticalBlockMatrix, Constructor1) { diff --git a/gtsam/discrete/tests/testAlgebraicDecisionTree.cpp b/gtsam/discrete/tests/testAlgebraicDecisionTree.cpp index ac5eccd14..e3f9d9dd2 100644 --- a/gtsam/discrete/tests/testAlgebraicDecisionTree.cpp +++ b/gtsam/discrete/tests/testAlgebraicDecisionTree.cpp @@ -399,13 +399,9 @@ TEST(ADT, factor_graph) { /* ************************************************************************* */ // test equality TEST(ADT, equality_noparser) { - DiscreteKey A(0, 2), B(1, 2); - Signature::Table tableA, tableB; - Signature::Row rA, rB; - rA += 80, 20; - rB += 60, 40; - tableA += rA; - tableB += rB; + const DiscreteKey A(0, 2), B(1, 2); + const Signature::Row rA{80, 20}, rB{60, 40}; + const Signature::Table tableA{rA}, tableB{rB}; // Check straight equality ADT pA1 = create(A % tableA); @@ -520,9 +516,9 @@ TEST(ADT, elimination) { // normalize ADT actual = f1 / actualSum; - vector cpt; - cpt += 1.0 / 3, 2.0 / 3, 3.0 / 7, 4.0 / 7, 5.0 / 11, 6.0 / 11, // - 1.0 / 9, 8.0 / 9, 3.0 / 6, 3.0 / 6, 5.0 / 10, 5.0 / 10; + const vector cpt{ + 1.0 / 3, 2.0 / 3, 3.0 / 7, 4.0 / 7, 5.0 / 11, 6.0 / 11, // + 1.0 / 9, 8.0 / 9, 3.0 / 6, 3.0 / 6, 5.0 / 10, 5.0 / 10}; ADT expected(A & B & C, cpt); CHECK(assert_equal(expected, actual)); } @@ -535,9 +531,9 @@ TEST(ADT, elimination) { // normalize ADT actual = f1 / actualSum; - vector cpt; - cpt += 1.0 / 21, 2.0 / 21, 3.0 / 21, 4.0 / 21, 5.0 / 21, 6.0 / 21, // - 1.0 / 25, 8.0 / 25, 3.0 / 25, 3.0 / 25, 5.0 / 25, 5.0 / 25; + const vector cpt{ + 1.0 / 21, 2.0 / 21, 3.0 / 21, 4.0 / 21, 5.0 / 21, 6.0 / 21, // + 1.0 / 25, 8.0 / 25, 3.0 / 25, 3.0 / 25, 5.0 / 25, 5.0 / 25}; ADT expected(A & B & C, cpt); CHECK(assert_equal(expected, actual)); } diff --git a/gtsam/discrete/tests/testDecisionTree.cpp b/gtsam/discrete/tests/testDecisionTree.cpp index 46e6c3813..2f385263c 100644 --- a/gtsam/discrete/tests/testDecisionTree.cpp +++ b/gtsam/discrete/tests/testDecisionTree.cpp @@ -26,7 +26,9 @@ #include #include -using namespace std; +using std::vector; +using std::string; +using std::map; using namespace gtsam; template @@ -280,8 +282,7 @@ TEST(DecisionTree, Compose) { DT f1(B, DT(A, 0, 1), DT(A, 2, 3)); // Create from string - vector keys; - keys += DT::LabelC(A, 2), DT::LabelC(B, 2); + vector keys{DT::LabelC(A, 2), DT::LabelC(B, 2)}; DT f2(keys, "0 2 1 3"); EXPECT(assert_equal(f2, f1, 1e-9)); @@ -291,7 +292,7 @@ TEST(DecisionTree, Compose) { DOT(f4); // a bigger tree - keys += DT::LabelC(C, 2); + keys.push_back(DT::LabelC(C, 2)); DT f5(keys, "0 4 2 6 1 5 3 7"); EXPECT(assert_equal(f5, f4, 1e-9)); DOT(f5); @@ -322,7 +323,7 @@ TEST(DecisionTree, Containers) { /* ************************************************************************** */ // Test nrAssignments. TEST(DecisionTree, NrAssignments) { - pair A("A", 2), B("B", 2), C("C", 2); + const std::pair A("A", 2), B("B", 2), C("C", 2); DT tree({A, B, C}, "1 1 1 1 1 1 1 1"); EXPECT(tree.root_->isLeaf()); auto leaf = boost::dynamic_pointer_cast(tree.root_); @@ -472,8 +473,8 @@ TEST(DecisionTree, unzip) { // Test thresholding. TEST(DecisionTree, threshold) { // Create three level tree - vector keys; - keys += DT::LabelC("C", 2), DT::LabelC("B", 2), DT::LabelC("A", 2); + const vector keys{DT::LabelC("C", 2), DT::LabelC("B", 2), + DT::LabelC("A", 2)}; DT tree(keys, "0 1 2 3 4 5 6 7"); // Check number of leaves equal to zero @@ -495,8 +496,8 @@ TEST(DecisionTree, threshold) { // Test apply with assignment. TEST(DecisionTree, ApplyWithAssignment) { // Create three level tree - vector keys; - keys += DT::LabelC("C", 2), DT::LabelC("B", 2), DT::LabelC("A", 2); + const vector keys{DT::LabelC("C", 2), DT::LabelC("B", 2), + DT::LabelC("A", 2)}; DT tree(keys, "1 2 3 4 5 6 7 8"); DecisionTree probTree( diff --git a/gtsam/discrete/tests/testDiscreteConditional.cpp b/gtsam/discrete/tests/testDiscreteConditional.cpp index 3df4bf9e6..f4a2e30ea 100644 --- a/gtsam/discrete/tests/testDiscreteConditional.cpp +++ b/gtsam/discrete/tests/testDiscreteConditional.cpp @@ -53,12 +53,8 @@ TEST(DiscreteConditional, constructors) { TEST(DiscreteConditional, constructors_alt_interface) { DiscreteKey X(0, 2), Y(2, 3), Z(1, 2); // watch ordering ! - Signature::Table table; - Signature::Row r1, r2, r3; - r1 += 1.0, 1.0; - r2 += 2.0, 3.0; - r3 += 1.0, 4.0; - table += r1, r2, r3; + const Signature::Row r1{1, 1}, r2{2, 3}, r3{1, 4}; + const Signature::Table table{r1, r2, r3}; DiscreteConditional actual1(X, {Y}, table); DecisionTreeFactor f1(X & Y, "0.5 0.4 0.2 0.5 0.6 0.8"); diff --git a/gtsam/discrete/tests/testDiscreteMarginals.cpp b/gtsam/discrete/tests/testDiscreteMarginals.cpp index 3213e514f..ffca8a481 100644 --- a/gtsam/discrete/tests/testDiscreteMarginals.cpp +++ b/gtsam/discrete/tests/testDiscreteMarginals.cpp @@ -183,8 +183,7 @@ TEST_UNSAFE(DiscreteMarginals, truss2) { F[j] /= sum; // Marginals - vector table; - table += F[j], T[j]; + const vector table{F[j], T[j]}; DecisionTreeFactor expectedM(key[j], table); DiscreteFactor::shared_ptr actualM = marginals(j); EXPECT(assert_equal( diff --git a/gtsam/geometry/tests/testOrientedPlane3.cpp b/gtsam/geometry/tests/testOrientedPlane3.cpp index 533041a2c..c7498cd58 100644 --- a/gtsam/geometry/tests/testOrientedPlane3.cpp +++ b/gtsam/geometry/tests/testOrientedPlane3.cpp @@ -20,12 +20,9 @@ #include #include #include -#include -using namespace boost::assign; using namespace std::placeholders; using namespace gtsam; -using namespace std; using boost::none; GTSAM_CONCEPT_TESTABLE_INST(OrientedPlane3) diff --git a/gtsam/geometry/tests/testPose2.cpp b/gtsam/geometry/tests/testPose2.cpp index 88c00a2e9..44dc55a81 100644 --- a/gtsam/geometry/tests/testPose2.cpp +++ b/gtsam/geometry/tests/testPose2.cpp @@ -23,12 +23,10 @@ #include #include -#include // for operator += #include #include #include -using namespace boost::assign; using namespace gtsam; using namespace std; @@ -749,11 +747,10 @@ namespace align_3 { TEST(Pose2, align_3) { using namespace align_3; - Point2Pairs ab_pairs; Point2Pair ab1(make_pair(a1, b1)); Point2Pair ab2(make_pair(a2, b2)); Point2Pair ab3(make_pair(a3, b3)); - ab_pairs += ab1, ab2, ab3; + const Point2Pairs ab_pairs{ab1, ab2, ab3}; boost::optional aTb = Pose2::Align(ab_pairs); EXPECT(assert_equal(expected, *aTb)); @@ -778,9 +775,7 @@ namespace { TEST(Pose2, align_4) { using namespace align_3; - Point2Vector as, bs; - as += a1, a2, a3; - bs += b3, b1, b2; // note in 3,1,2 order ! + Point2Vector as{a1, a2, a3}, bs{b3, b1, b2}; // note in 3,1,2 order ! Triangle t1; t1.i_=0; t1.j_=1; t1.k_=2; Triangle t2; t2.i_=1; t2.j_=2; t2.k_=0; diff --git a/gtsam/geometry/tests/testPose3.cpp b/gtsam/geometry/tests/testPose3.cpp index 78a4af799..dd7da172e 100644 --- a/gtsam/geometry/tests/testPose3.cpp +++ b/gtsam/geometry/tests/testPose3.cpp @@ -20,15 +20,13 @@ #include #include -#include // for operator += -using namespace boost::assign; -using namespace std::placeholders; #include #include using namespace std; using namespace gtsam; +using namespace std::placeholders; GTSAM_CONCEPT_TESTABLE_INST(Pose3) GTSAM_CONCEPT_LIE_INST(Pose3) @@ -809,11 +807,10 @@ TEST( Pose3, adjointMap) { TEST(Pose3, Align1) { Pose3 expected(Rot3(), Point3(10,10,0)); - vector correspondences; - Point3Pair ab1(make_pair(Point3(10,10,0), Point3(0,0,0))); - Point3Pair ab2(make_pair(Point3(30,20,0), Point3(20,10,0))); - Point3Pair ab3(make_pair(Point3(20,30,0), Point3(10,20,0))); - correspondences += ab1, ab2, ab3; + Point3Pair ab1(Point3(10,10,0), Point3(0,0,0)); + Point3Pair ab2(Point3(30,20,0), Point3(20,10,0)); + Point3Pair ab3(Point3(20,30,0), Point3(10,20,0)); + const vector correspondences{ab1, ab2, ab3}; boost::optional actual = Pose3::Align(correspondences); EXPECT(assert_equal(expected, *actual)); @@ -825,15 +822,12 @@ TEST(Pose3, Align2) { Rot3 R = Rot3::RzRyRx(0.3, 0.2, 0.1); Pose3 expected(R, t); - vector correspondences; Point3 p1(0,0,1), p2(10,0,2), p3(20,-10,30); Point3 q1 = expected.transformFrom(p1), q2 = expected.transformFrom(p2), q3 = expected.transformFrom(p3); - Point3Pair ab1(make_pair(q1, p1)); - Point3Pair ab2(make_pair(q2, p2)); - Point3Pair ab3(make_pair(q3, p3)); - correspondences += ab1, ab2, ab3; + const Point3Pair ab1{q1, p1}, ab2{q2, p2}, ab3{q3, p3}; + const vector correspondences{ab1, ab2, ab3}; boost::optional actual = Pose3::Align(correspondences); EXPECT(assert_equal(expected, *actual, 1e-5)); diff --git a/gtsam/geometry/tests/testUnit3.cpp b/gtsam/geometry/tests/testUnit3.cpp index b548b9315..c951d857c 100644 --- a/gtsam/geometry/tests/testUnit3.cpp +++ b/gtsam/geometry/tests/testUnit3.cpp @@ -36,7 +36,6 @@ #include #include -using namespace boost::assign; using namespace std::placeholders; using namespace gtsam; using namespace std; @@ -51,9 +50,8 @@ Point3 point3_(const Unit3& p) { } TEST(Unit3, point3) { - vector ps; - ps += Point3(1, 0, 0), Point3(0, 1, 0), Point3(0, 0, 1), Point3(1, 1, 0) - / sqrt(2.0); + const vector ps{Point3(1, 0, 0), Point3(0, 1, 0), Point3(0, 0, 1), + Point3(1, 1, 0) / sqrt(2.0)}; Matrix actualH, expectedH; for(Point3 p: ps) { Unit3 s(p); diff --git a/tests/testGaussianJunctionTreeB.cpp b/tests/testGaussianJunctionTreeB.cpp index dfdb32b46..681554645 100644 --- a/tests/testGaussianJunctionTreeB.cpp +++ b/tests/testGaussianJunctionTreeB.cpp @@ -42,17 +42,11 @@ #include -#include -#include -#include - #include #include #include #include -using namespace boost::assign; - #include using namespace std; @@ -79,8 +73,7 @@ TEST( GaussianJunctionTreeB, constructor2 ) { // linearize GaussianFactorGraph::shared_ptr fg = nlfg.linearize(values); - Ordering ordering; - ordering += X(1), X(3), X(5), X(7), X(2), X(6), X(4); + const Ordering ordering {X(1), X(3), X(5), X(7), X(2), X(6), X(4)}; // create an ordering GaussianEliminationTree etree(*fg, ordering);