forked from organicmaps/organicmaps-tmp
Add FeatureBuilder1 test.
This commit is contained in:
parent
416aff6975
commit
b1d9e2a0af
4 changed files with 46 additions and 5 deletions
|
@ -359,7 +359,7 @@ string DebugPrint(FeatureBuilder1 const & f)
|
|||
|
||||
switch (f.GetGeomType())
|
||||
{
|
||||
case GEOM_POINT: out << "(" << f.m_Center << ")"; break;
|
||||
case GEOM_POINT: out << DebugPrint(f.m_Center); break;
|
||||
case GEOM_LINE: out << "line with " << f.GetPointsCount() << " points"; break;
|
||||
case GEOM_AREA: out << "area with " << f.GetPointsCount() << " points"; break;
|
||||
default:
|
||||
|
|
|
@ -141,10 +141,6 @@ public:
|
|||
return s;
|
||||
}
|
||||
|
||||
protected:
|
||||
/// Used for feature debugging
|
||||
vector<osm::OsmId> m_osmIds;
|
||||
|
||||
/// @name For diagnostic use only.
|
||||
//@{
|
||||
bool operator== (FeatureBuilder1 const &) const;
|
||||
|
@ -152,6 +148,10 @@ protected:
|
|||
bool CheckValid() const;
|
||||
//@}
|
||||
|
||||
protected:
|
||||
/// Used for feature debugging
|
||||
vector<osm::OsmId> m_osmIds;
|
||||
|
||||
FeatureParams m_Params;
|
||||
|
||||
m2::RectD m_LimitRect;
|
||||
|
|
40
generator/generator_tests/feature_builder_test.cpp
Normal file
40
generator/generator_tests/feature_builder_test.cpp
Normal file
|
@ -0,0 +1,40 @@
|
|||
#include "../../testing/testing.hpp"
|
||||
|
||||
#include "../feature_builder.hpp"
|
||||
|
||||
|
||||
UNIT_TEST(FBuilder_ManyTypes)
|
||||
{
|
||||
FeatureBuilder1 fb1;
|
||||
|
||||
FeatureParams params;
|
||||
params.AddType(70);
|
||||
params.AddType(4098);
|
||||
params.AddType(6339);
|
||||
params.AddType(5379);
|
||||
params.AddType(5451);
|
||||
params.AddType(5195);
|
||||
params.AddType(4122);
|
||||
params.AddType(4250);
|
||||
params.FinishAddingTypes();
|
||||
|
||||
params.AddHouseNumber("75");
|
||||
params.AddHouseName("Best House");
|
||||
params.name.AddString(0, "Name");
|
||||
|
||||
fb1.SetParams(params);
|
||||
fb1.SetCenter(m2::PointD(0, 0));
|
||||
|
||||
TEST(fb1.DoCorrect(), ());
|
||||
TEST(fb1.CheckValid(), ());
|
||||
|
||||
FeatureBuilder1::buffer_t buffer;
|
||||
TEST(fb1.PreSerialize(), ());
|
||||
fb1.Serialize(buffer);
|
||||
|
||||
FeatureBuilder1 fb2;
|
||||
fb2.Deserialize(buffer);
|
||||
|
||||
TEST(fb2.CheckValid(), ());
|
||||
TEST_EQUAL(fb1, fb2, ());
|
||||
}
|
|
@ -28,3 +28,4 @@ SOURCES += \
|
|||
triangles_tree_coding_test.cpp \
|
||||
coasts_test.cpp \
|
||||
concurrent_tests.cpp \
|
||||
feature_builder_test.cpp \
|
||||
|
|
Loading…
Add table
Reference in a new issue