35 using namespace gtsam;
36 using namespace gtsam::serializationTestHelpers;
51 EXPECT(equalityBinary(list));
57 map.insert(make_pair(1,
v1));
58 map.insert(make_pair(2,
v2));
59 map.insert(make_pair(3,
v3));
63 EXPECT(equalityBinary(map));
86 EXPECT(equalityXML(vector));
87 EXPECT(equalityBinary(vector));
91 TEST (Serialization, matrix_vector) {
92 EXPECT(equality<Vector>((
Vector(4) << 1.0, 2.0, 3.0, 4.0).finished()));
95 EXPECT(equality<Vector6>((Vector6() << 1.0, 2.0, 3.0, 4.0, 5.0, 6.0).finished()));
96 EXPECT(equality<Matrix>((
Matrix(2, 2) << 1.0, 2.0, 3.0, 4.0).finished()));
98 EXPECT(equalityXML<Vector>((
Vector(4) << 1.0, 2.0, 3.0, 4.0).finished()));
101 EXPECT(equalityXML<Vector6>((Vector6() << 1.0, 2.0, 3.0, 4.0, 5.0, 6.0).finished()));
102 EXPECT(equalityXML<Matrix>((
Matrix(2, 2) << 1.0, 2.0, 3.0, 4.0).finished()));
104 EXPECT(equalityBinary<Vector>((
Vector(4) << 1.0, 2.0, 3.0, 4.0).finished()));
107 EXPECT(equalityBinary<Vector6>((Vector6() << 1.0, 2.0, 3.0, 4.0, 5.0, 6.0).finished()));
108 EXPECT(equalityBinary<Matrix>((
Matrix(2, 2) << 1.0, 2.0, 3.0, 4.0).finished()));
116 map.insert(make_pair(1,
"apple"));
117 map.insert(make_pair(2,
"banana"));
119 std::string binaryPath =
"saved_map.dat";
121 std::ofstream outputStream(binaryPath);
122 boost::archive::binary_oarchive outputArchive(outputStream);
123 outputArchive << map;
130 mapFromDisk.insert(make_pair(3,
"clam"));
133 std::ifstream ifs(binaryPath);
134 boost::archive::binary_iarchive inputArchive(ifs);
135 inputArchive >> mapFromDisk;