Review fixes.

This commit is contained in:
Vladimir Byko-Ianko 2017-10-04 12:58:52 +03:00 committed by Vladimir Byko-Ianko
parent c5edec5aea
commit e93da422f4
4 changed files with 11 additions and 10 deletions

View file

@ -53,4 +53,4 @@ private:
#define DECLARE_VISITOR_AND_DEBUG_PRINT(className, ...) \
DECLARE_VISITOR(__VA_ARGS__) \
DECLARE_DEBUG_PRINT(className)
DECLARE_DEBUG_PRINT(className)

View file

@ -28,7 +28,7 @@ void TestDeserializerFromJson(string const & jsonBuffer, string const & name, ve
TEST_EQUAL(objects.size(), expected.size(), ());
for (size_t i = 0; i < objects.size(); ++i)
TEST(objects[i].IsEqualForTesting(expected[i]), (objects[i], "is not equal to", expected[i]));
TEST(objects[i].IsEqualForTesting(expected[i]), (objects[i], expected[i]));
}
UNIT_TEST(DeserializerFromJson_Stops)

View file

@ -30,6 +30,7 @@ namespace transit
// Let us assume that it takes less than 10^7 seconds (115 days) to get from one station to a neighboring one.
double constexpr kMinDoubleAtTransit = kInvalidWeight;
double constexpr kMaxDoubleAtTransit = 10000000.0;
uint32_t constexpr kDoubleBits = 31;
template <typename Sink>
class Serializer
@ -48,7 +49,7 @@ public:
{
CHECK_GREATER_OR_EQUAL(d, kMinDoubleAtTransit, ());
CHECK_LESS_OR_EQUAL(d, kMaxDoubleAtTransit, ());
(*this)(DoubleToUint32(d, kMinDoubleAtTransit, kMaxDoubleAtTransit, POINT_COORD_BITS), name);
(*this)(DoubleToUint32(d, kMinDoubleAtTransit, kMaxDoubleAtTransit, kDoubleBits), name);
}
void operator()(std::string const & s, char const * /* name */ = nullptr)
@ -99,7 +100,7 @@ public:
{
uint32_t ui;
(*this)(ui, name);
d = Uint32ToDouble(ui, kMinDoubleAtTransit, kMaxDoubleAtTransit, POINT_COORD_BITS);
d = Uint32ToDouble(ui, kMinDoubleAtTransit, kMaxDoubleAtTransit, kDoubleBits);
}
void operator()(std::string & s, char const * /* name */ = nullptr)

View file

@ -40,11 +40,11 @@ struct TransitHeader
bool IsEqualForTesting(TransitHeader const & header) const;
DECLARE_VISITOR_AND_DEBUG_PRINT(
TransitHeader, visitor(m_version, "m_version"), visitor(m_reserve, "m_reserve"),
visitor(m_gatesOffset, "m_gatesOffset"), visitor(m_edgesOffset, "m_edgesOffset"),
visitor(m_transfersOffset, "m_transfersOffset"), visitor(m_linesOffset, "m_linesOffset"),
visitor(m_shapesOffset, "m_shapesOffset"), visitor(m_networksOffset, "m_networksOffset"),
visitor(m_endOffset, "m_endOffset"))
TransitHeader, visitor(m_version, "version"), visitor(m_reserve, "reserve"),
visitor(m_gatesOffset, "gatesOffset"), visitor(m_edgesOffset, "edgesOffset"),
visitor(m_transfersOffset, "transfersOffset"), visitor(m_linesOffset, "linesOffset"),
visitor(m_shapesOffset, "shapesOffset"), visitor(m_networksOffset, "networksOffset"),
visitor(m_endOffset, "endOffset"))
uint16_t m_version;
uint16_t m_reserve;
@ -63,7 +63,7 @@ class Stop
{
public:
Stop() = default;
Stop(StopId id, FeatureId featureId, TransferId m_transferId, std::vector<LineId> const & lineIds,
Stop(StopId id, FeatureId featureId, TransferId transferId, std::vector<LineId> const & lineIds,
m2::PointD const & point);
bool IsEqualForTesting(Stop const & stop) const;