TEST(SmCommonTestSuite,testAssertMacros) { SM_DEFINE_EXCEPTION(Exception, std::runtime_error); { double* val = new double; EXPECT_NO_THROW( SM_ASSERT_TRUE(Exception, true, "") ); EXPECT_NO_THROW( SM_ASSERT_FALSE(Exception, false, "") ); EXPECT_NO_THROW( SM_ASSERT_GE_LT(Exception, 0.0, 0.0, 1.0, "") ); EXPECT_NO_THROW( SM_ASSERT_GT_LE(Exception, 0.1, 0.0, 1.0, "") ); EXPECT_NO_THROW( SM_ASSERT_GE_LE(Exception, 0.0, 0.0, 1.0, "") ); EXPECT_NO_THROW( SM_ASSERT_GE_LE(Exception, 1.0, 0.0, 1.0, "") ); EXPECT_NO_THROW( SM_ASSERT_LT(Exception, 0.0, 1.0, "") ); EXPECT_NO_THROW( SM_ASSERT_GT(Exception, 1.0, 0.0, "") ); EXPECT_NO_THROW( SM_ASSERT_POSITIVE(Exception, 1.0, "") ); EXPECT_NO_THROW( SM_ASSERT_NONNEGATIVE(Exception, 0.0, "") ); EXPECT_NO_THROW( SM_ASSERT_NEGATIVE(Exception, -1.0, "") ); EXPECT_NO_THROW( SM_ASSERT_NONPOSITIVE(Exception, 0.0, "") ); EXPECT_NO_THROW( SM_ASSERT_ZERO(Exception, 0.0, "") ); EXPECT_NO_THROW( SM_ASSERT_NOTNULL(Exception, val, "") ); EXPECT_NO_THROW( SM_ASSERT_LE(Exception, 0.0, 0.0, "") ); EXPECT_NO_THROW( SM_ASSERT_GE(Exception, 0.0, 0.0, "") ); EXPECT_NO_THROW( SM_ASSERT_NE(Exception, 0.0, 1.0, "") ); EXPECT_NO_THROW( SM_ASSERT_EQ(Exception, 0.0, 0.0, "") ); EXPECT_NO_THROW( SM_ASSERT_NEAR(Exception, 0.0, 1.0, 2.0, "") ); EXPECT_NO_THROW( SM_ASSERT_FINITE(Exception, 0.0, "") ); EXPECT_NO_THROW( SM_ASSERT_NOTNAN(Exception, 0.0, "") ); delete val; } { double* val = NULL; EXPECT_THROW( SM_ASSERT_TRUE(Exception, false, ""), Exception); EXPECT_THROW( SM_ASSERT_FALSE(Exception, true, ""), Exception ); EXPECT_THROW( SM_ASSERT_GE_LT(Exception, 1.0, 0.0, 1.0, ""), Exception ); EXPECT_THROW( SM_ASSERT_GT_LE(Exception, 0.0, 0.0, 1.0, ""), Exception ); EXPECT_THROW( SM_ASSERT_GE_LE(Exception, -0.1, 0.0, 1.0, ""), Exception ); EXPECT_THROW( SM_ASSERT_GE_LE(Exception, 1.1, 0.0, 1.0, ""), Exception ); EXPECT_THROW( SM_ASSERT_LT(Exception, 1.0, 1.0, ""), Exception ); EXPECT_THROW( SM_ASSERT_GT(Exception, 0.0, 0.0, ""), Exception ); EXPECT_THROW( SM_ASSERT_POSITIVE(Exception, 0.0, ""), Exception ); EXPECT_THROW( SM_ASSERT_NONNEGATIVE(Exception, -1.0, ""), Exception ); EXPECT_THROW( SM_ASSERT_NEGATIVE(Exception, 0.0, ""), Exception ); EXPECT_THROW( SM_ASSERT_NONPOSITIVE(Exception, 1.0, ""), Exception ); EXPECT_THROW( SM_ASSERT_ZERO(Exception, 1.0, ""), Exception ); EXPECT_THROW( SM_ASSERT_NOTNULL(Exception, val, ""), Exception ); EXPECT_THROW( SM_ASSERT_LE(Exception, 1.0, 0.0, ""), Exception ); EXPECT_THROW( SM_ASSERT_GE(Exception, -1.0, 0.0, ""), Exception ); EXPECT_THROW( SM_ASSERT_NE(Exception, 0.0, 0.0, ""), Exception ); EXPECT_THROW( SM_ASSERT_EQ(Exception, 1.0, 0.0, ""), Exception ); EXPECT_THROW( SM_ASSERT_NEAR(Exception, 0.0, 1.0, 0.5, ""), Exception ); EXPECT_THROW( SM_ASSERT_FINITE(Exception, std::numeric_limits<float>::infinity(), ""), Exception ); EXPECT_THROW( SM_ASSERT_NOTNAN(Exception, std::numeric_limits<float>::signaling_NaN(), ""), Exception ); } }
void load(Archive & ar, const unsigned int version) { SM_ASSERT_LE(std::runtime_error, version, (unsigned int) CLASS_SERIALIZATION_VERSION, "Unsupported serialization version"); if (version >= 2) { ar >> BOOST_SERIALIZATION_BASE_OBJECT_NVP(CameraGeometryBase); }
void PoseGraph::load(Archive & ar, const unsigned int version) { SM_ASSERT_LE(std::runtime_error, version, (unsigned int)CLASS_SERIALIZATION_VERSION, "Unsupported serialization version"); _graph.clear(); ar >> BOOST_SERIALIZATION_NVP(_nextVertexId); ar >> BOOST_SERIALIZATION_NVP(_nextEdgeId); ar >> BOOST_SERIALIZATION_NVP(_graph); // Now restore the vertex and edge maps. // See the implementation of save() above to see why this is necessary. // First the vertex map _vertexMap.clear(); boost::graph_traits<graph_t>::vertex_iterator v, vend; boost::tie(v,vend) = vertices(_graph); for( ; v != vend; v++) { // *v is a vertex descriptor. // calling _graph[*v] returns the object stored at the vertex. _vertexMap[_graph[*v].id()] = *v; } // A similar process holds for the edge map _edgeMap.clear(); boost::graph_traits<graph_t>::edge_iterator e, eend; boost::tie(e,eend) = edges(_graph); for( ; e != eend; e++) { // *e is an edge descriptor. // calling _graph[*e] returns the object stored at the edge. _edgeMap[_graph[*e].id()] = *e; } }
void load(Archive & ar, const unsigned int version) { SM_ASSERT_LE(std::runtime_error, version, (unsigned int) CLASS_SERIALIZATION_VERSION, "Unsupported serialization version"); ar >> BOOST_SERIALIZATION_NVP(frameId); ar >> BOOST_SERIALIZATION_NVP(cameraIndex); ar >> BOOST_SERIALIZATION_NVP(keypointIndex); }
void RadialTangentialDistortion::load(Archive & ar, const unsigned int version) { SM_ASSERT_LE(std::runtime_error, version, (unsigned int) CLASS_SERIALIZATION_VERSION, "Unsupported serialization version"); ar >> BOOST_SERIALIZATION_NVP(_k1); ar >> BOOST_SERIALIZATION_NVP(_k2); ar >> BOOST_SERIALIZATION_NVP(_p1); ar >> BOOST_SERIALIZATION_NVP(_p2); }
void load(Archive & ar, const unsigned int version) { SM_ASSERT_LE(std::runtime_error, version, (unsigned int)CLASS_SERIALIZATION_VERSION, "Unsupported serialization version"); ar >> BOOST_SERIALIZATION_BASE_OBJECT_NVP(HomogeneousPoint); ar >> BOOST_SERIALIZATION_NVP(_U); }