forked from organicmaps/organicmaps-tmp
Fix unit tests.
This commit is contained in:
parent
025b6c2144
commit
ab43a9a8bf
4 changed files with 13 additions and 7 deletions
|
@ -18,11 +18,14 @@ namespace feature
|
|||
}
|
||||
|
||||
uint64_t ReadDataHeader(string const & datFileName, feature::DataHeader & outHeader)
|
||||
{
|
||||
return ReadDataHeader(FilesContainerR(datFileName).GetReader(DATA_FILE_TAG), outHeader);
|
||||
}
|
||||
|
||||
uint64_t ReadDataHeader(FileReader const & reader, feature::DataHeader & outHeader)
|
||||
{
|
||||
try
|
||||
{
|
||||
FileReader reader = FilesContainerR(datFileName).GetReader(DATA_FILE_TAG);
|
||||
|
||||
uint64_t const toSkip = GetSkipHeaderSize(reader);
|
||||
|
||||
ReaderSource<FileReader> src(reader);
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
class Writer;
|
||||
class Reader;
|
||||
class FileReader;
|
||||
|
||||
namespace feature
|
||||
{
|
||||
|
@ -13,5 +14,7 @@ namespace feature
|
|||
/// @return total header size, which should be skipped for data read, or 0 if error
|
||||
uint64_t GetSkipHeaderSize(Reader const & reader);
|
||||
uint64_t ReadDataHeader(string const & datFileName, feature::DataHeader & outHeader);
|
||||
|
||||
uint64_t ReadDataHeader(FileReader const & reader, feature::DataHeader & outHeader);
|
||||
void WriteDataHeader(Writer & writer, feature::DataHeader const & header);
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ UNIT_TEST(DataHeaderSerialization)
|
|||
}
|
||||
|
||||
feature::DataHeader header2;
|
||||
TEST_GREATER(feature::ReadDataHeader(fileName, header2), 0, ());
|
||||
TEST_GREATER(feature::ReadDataHeader(FileReader(fileName), header2), 0, ());
|
||||
|
||||
TEST_EQUAL(header1.Bounds(), header2.Bounds(), ());
|
||||
|
||||
|
|
|
@ -233,14 +233,14 @@ namespace
|
|||
|
||||
UNIT_TEST(IndexForEachTest)
|
||||
{
|
||||
string const path = GetPlatform().WritablePathForFile("minsk-pass");
|
||||
string const path = GetPlatform().WritablePathForFile("minsk-pass" DATA_FILE_EXTENSION);
|
||||
|
||||
model::FeaturesFetcher src1;
|
||||
src1.InitClassificator();
|
||||
src1.AddMap(path + DATA_FILE_EXTENSION);
|
||||
src1.AddMap(path);
|
||||
|
||||
feature::DataHeader mapInfo;
|
||||
TEST_GREATER(feature::ReadDataHeader(path + ".dat", mapInfo), 0, ());
|
||||
TEST_GREATER(feature::ReadDataHeader(path, mapInfo), 0, ());
|
||||
|
||||
vector<m2::RectD> rects;
|
||||
rects.push_back(mapInfo.Bounds());
|
||||
|
@ -253,7 +253,7 @@ UNIT_TEST(IndexForEachTest)
|
|||
feature_cont_t v1, v2;
|
||||
for_each_in_rect<AccumulatorBase>(src1, v1, r);
|
||||
|
||||
file_source_t src2(path + ".dat");
|
||||
file_source_t src2(path);
|
||||
for_each_in_rect<AccumulatorEtalon>(src2, v2, r);
|
||||
|
||||
size_t errInd;
|
||||
|
|
Loading…
Add table
Reference in a new issue