Makes hint Equatable and Printable for tests
This commit is contained in:
parent
88a76aaecf
commit
451bbe3021
@ -34,6 +34,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <iosfwd>
|
||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
@ -57,6 +58,9 @@ struct Hint
|
|||||||
|
|
||||||
std::string ToBase64() const;
|
std::string ToBase64() const;
|
||||||
static Hint FromBase64(const std::string &base64Hint);
|
static Hint FromBase64(const std::string &base64Hint);
|
||||||
|
|
||||||
|
friend bool operator==(const Hint &, const Hint &);
|
||||||
|
friend std::ostream &operator<<(std::ostream &, const Hint &);
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
|
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <ostream>
|
||||||
|
#include <tuple>
|
||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
@ -45,5 +47,14 @@ Hint Hint::FromBase64(const std::string &base64Hint)
|
|||||||
|
|
||||||
return decodeBase64Bytewise<Hint>(encoded);
|
return decodeBase64Bytewise<Hint>(encoded);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool operator==(const Hint &lhs, const Hint &rhs)
|
||||||
|
{
|
||||||
|
return std::tie(lhs.phantom, lhs.data_checksum) ==
|
||||||
|
std::tie(rhs.phantom, rhs.data_checksum);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
std::ostream &operator<<(std::ostream &out, const Hint &hint) { return out << hint.ToBase64(); }
|
||||||
|
|
||||||
|
} // ns engine
|
||||||
|
} // ns osrm
|
||||||
|
Loading…
Reference in New Issue
Block a user