From 68f8c12784aaa2ed4cd7138b44f09e4ab68546f7 Mon Sep 17 00:00:00 2001 From: Maxim Pimenov Date: Tue, 2 Jul 2019 15:24:24 +0300 Subject: [PATCH] [generator] Added forgotten tests of the booking dataset to the projects. --- generator/generator_tests/CMakeLists.txt | 1 + .../{booking_test.cpp => booking_tests.cpp} | 54 ++++++++++++------- .../generator_tool.xcodeproj/project.pbxproj | 4 ++ 3 files changed, 39 insertions(+), 20 deletions(-) rename generator/generator_tests/{booking_test.cpp => booking_tests.cpp} (67%) diff --git a/generator/generator_tests/CMakeLists.txt b/generator/generator_tests/CMakeLists.txt index 4b1f0b24e3..251a6759db 100644 --- a/generator/generator_tests/CMakeLists.txt +++ b/generator/generator_tests/CMakeLists.txt @@ -3,6 +3,7 @@ project(generator_tests) set( SRC altitude_test.cpp + booking_tests.cpp brands_loader_test.cpp camera_collector_tests.cpp check_mwms.cpp diff --git a/generator/generator_tests/booking_test.cpp b/generator/generator_tests/booking_tests.cpp similarity index 67% rename from generator/generator_tests/booking_test.cpp rename to generator/generator_tests/booking_tests.cpp index ef2233a6e1..0debab4ed8 100644 --- a/generator/generator_tests/booking_test.cpp +++ b/generator/generator_tests/booking_tests.cpp @@ -1,61 +1,75 @@ #include "testing/testing.hpp" +#include "platform/platform_tests_support/scoped_file.hpp" + #include "generator/booking_dataset.hpp" +#include +#include + +using namespace platform::tests_support; + +namespace +{ +std::string const kFilePath = "booking_dataset_test.xml"; +} // namespace + UNIT_TEST(BookingDataset_SmokeTest) { - stringstream ss; - generator::BookingDataset data(ss); - TEST_EQUAL(data.Size(), 0, ()); + ScopedFile file(kFilePath, "" /* contents */); + generator::BookingDataset data(file.GetFullPath()); + TEST_EQUAL(data.GetStorage().Size(), 0, ()); } UNIT_TEST(BookingDataset_ParseTest) { - stringstream ss( + ScopedFile file( + kFilePath, "1485988\t36.75818960879561\t3.053177244180233\tAppartement Alger Centre\t50 Avenue Ahmed " "Ghermoul\t0\t0\tNone\tNone\thttp://www.booking.com/hotel/dz/" - "appartement-alger-centre-alger.html\t201\t\t\t"); - generator::BookingDataset data(ss); - TEST_EQUAL(data.Size(), 1, ()); + "appartement-alger-centre-alger.html\t201\t"); + generator::BookingDataset data(file.GetFullPath()); + TEST_EQUAL(data.GetStorage().Size(), 1, ()); } UNIT_TEST(BookingDataset_ParseTest2) { - stringstream ss( + ScopedFile file( + kFilePath, "1485988\t36.75818960879561\t3.053177244180233\tAppartement Alger Centre\t50 Avenue Ahmed " "Ghermoul\t0\t0\tNone\tNone\thttp://www.booking.com/hotel/dz/" - "appartement-alger-centre-alger.html\t201\t\t\t\n" + "appartement-alger-centre-alger.html\t201\t\n" "357811\t34.86737239675703\t-1.31686270236969\tRenaissance Tlemcen Hotel\tRenaissance " "Tlemcen " "Hotel\t5\t2\tNone\tNone\thttp://www.booking.com/hotel/dz/" - "renaissance-tlemcen.html\t204\t\t\t\n" + "renaissance-tlemcen.html\t204\t\n" "1500820\t36.72847621708523\t3.0645270245369147\tMazghana Apartment\tCite Garidi 1 Tours 3 N " "53, " "Kouba\t0\t0\tNone\tNone\thttp://www.booking.com/hotel/dz/" - "mazghana-apartment.html\t201\t\t\t\n" + "mazghana-apartment.html\t201\t\n" "1318991\t35.692865978372666\t-0.6278949570083796\tBest Western Hotel Colombe\t6 Bd Zabour " "Larbi Hai Khaldia " "Delmonte\t4\t2\tNone\tNone\thttp://www.booking.com/hotel/dz/" - "best-western-colombe.html\t204\t\t\t\n" + "best-western-colombe.html\t204\t\n" "1495828\t36.33835943\t6.626214981\tConstantine Marriott Hotel\tOued Rhumel Street, Cites " "des Arcades " "Romaines,\t5\t2\tNone\tNone\thttp://www.booking.com/hotel/dz/" - "constantine-marriott.html\t204\t\t\t\n" + "constantine-marriott.html\t204\t\n" "1411999\t35.73994643933386\t-0.757756233215332\tResidence Nadra\tBoulevard de la plage, " "Niche 1236 Paradis " - "plage\t0\t1\tNone\tNone\thttp://www.booking.com/hotel/dz/residence-nadra.html\t201\t\t\t\n" + "plage\t0\t1\tNone\tNone\thttp://www.booking.com/hotel/dz/residence-nadra.html\t201\t\n" "1497769\t36.80667121575615\t3.231203541069817\tApartment La Pérouse\tLa Pérouse Ain " "Taya\t0\t0\tNone\tNone\thttp://www.booking.com/hotel/dz/" - "apartment-la-perouse.html\t220\t\t\t\n" + "apartment-la-perouse.html\t220\t\n" "1668244\t36.715150622433804\t2.8442734479904175\tAZ Hotel Zeralda\t09 Rue de Mahelma - " "Zeralda - " - "ALGER\t4\t2\tNone\tNone\thttp://www.booking.com/hotel/dz/el-aziz-zeralda.html\t204\t\t\t\n" + "ALGER\t4\t2\tNone\tNone\thttp://www.booking.com/hotel/dz/el-aziz-zeralda.html\t204\t\n" "1486823\t36.73432645678891\t3.0335435271263123\tGuest House Marhaba\tResidence Soumam - " "Bloc B - Appt 17- Said " - "Hamdine\t0\t0\tNone\tNone\thttp://www.booking.com/hotel/dz/marhaba.html\t208\t\t\t\n" + "Hamdine\t0\t0\tNone\tNone\thttp://www.booking.com/hotel/dz/marhaba.html\t208\t\n" "1759799\t35.73832476589291\t-0.7553583383560181\tHotel la brise\tAngle boulevard de la " "plage et route nationale niche 1159 paradis " - "plage\t2\t2\tNone\tNone\thttp://www.booking.com/hotel/dz/la-brise.html\t204\t\t\t\n"); - generator::BookingDataset data(ss); - TEST_EQUAL(data.Size(), 10, ()); + "plage\t2\t2\tNone\tNone\thttp://www.booking.com/hotel/dz/la-brise.html\t204\t\n"); + generator::BookingDataset data(file.GetFullPath()); + TEST_EQUAL(data.GetStorage().Size(), 10, ()); } diff --git a/xcode/generator_tool/generator_tool.xcodeproj/project.pbxproj b/xcode/generator_tool/generator_tool.xcodeproj/project.pbxproj index 723bc3f85e..4471f36400 100644 --- a/xcode/generator_tool/generator_tool.xcodeproj/project.pbxproj +++ b/xcode/generator_tool/generator_tool.xcodeproj/project.pbxproj @@ -29,6 +29,7 @@ 34F558571DBF3CD800A4FC11 /* libstdc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 34F558561DBF3CD800A4FC11 /* libstdc++.tbd */; }; 397057C022CB57F9001A55CA /* cities_ids_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 397057BD22CB57F8001A55CA /* cities_ids_tests.cpp */; }; 397057C122CB57F9001A55CA /* translation_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 397057BE22CB57F9001A55CA /* translation_test.cpp */; }; + 39C4345222CE13F00002AEE3 /* booking_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 39C4345122CE13F00002AEE3 /* booking_tests.cpp */; }; 401E3189225C988500DE7EB8 /* libdescriptions.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 401E3188225C988500DE7EB8 /* libdescriptions.a */; }; 4491F494213D6B470011834F /* speed_cameras_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4491F490213D46380011834F /* speed_cameras_test.cpp */; }; 4491F496213D6B8E0011834F /* osm2meta_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 677E2A0B1CAAC7CB001DC42A /* osm2meta_test.cpp */; }; @@ -233,6 +234,7 @@ 34F558561DBF3CD800A4FC11 /* libstdc++.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libstdc++.tbd"; path = "usr/lib/libstdc++.tbd"; sourceTree = SDKROOT; }; 397057BD22CB57F8001A55CA /* cities_ids_tests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cities_ids_tests.cpp; sourceTree = ""; }; 397057BE22CB57F9001A55CA /* translation_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = translation_test.cpp; sourceTree = ""; }; + 39C4345122CE13F00002AEE3 /* booking_tests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = booking_tests.cpp; sourceTree = ""; }; 401E3188225C988500DE7EB8 /* libdescriptions.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libdescriptions.a; sourceTree = BUILT_PRODUCTS_DIR; }; 4491F490213D46380011834F /* speed_cameras_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = speed_cameras_test.cpp; sourceTree = ""; }; 562147261F6AA36A002D2214 /* libbsdiff.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libbsdiff.a; path = ../bsdiff/build/Debug/libbsdiff.a; sourceTree = ""; }; @@ -528,6 +530,7 @@ 6726C1D71A4C27A5005EEA39 /* generator_tests */ = { isa = PBXGroup; children = ( + 39C4345122CE13F00002AEE3 /* booking_tests.cpp */, 397057BD22CB57F8001A55CA /* cities_ids_tests.cpp */, 397057BE22CB57F9001A55CA /* translation_test.cpp */, 671C2D7F22AFDAB4008B2B8B /* brands_loader_test.cpp */, @@ -792,6 +795,7 @@ 67AB92D61B75157700AB5194 /* tesselator_test.cpp in Sources */, 397057C122CB57F9001A55CA /* translation_test.cpp in Sources */, 671ED3C420D4098100D4317E /* road_access_test.cpp in Sources */, + 39C4345222CE13F00002AEE3 /* booking_tests.cpp in Sources */, 4491F494213D6B470011834F /* speed_cameras_test.cpp in Sources */, 56829A4C2134238800A09A28 /* cities_boundaries_checker_tests.cpp in Sources */, 6726C2411A4C2D9F005EEA39 /* testingmain.cpp in Sources */,